From 5451cfae32e7e2841cc54f671d3cd5574834c2c1 Mon Sep 17 00:00:00 2001
From: Tom French <tom@tomfren.ch>
Date: Fri, 20 May 2022 15:17:57 +0100
Subject: [PATCH] ci: add linter check to CI

---
 .github/workflows/lint.yml       | 29 +++++++++++++++++++++++++++++
 packages/loot-core/.eslintignore |  3 +++
 packages/loot-core/package.json  |  2 +-
 3 files changed, 33 insertions(+), 1 deletion(-)
 create mode 100644 .github/workflows/lint.yml
 create mode 100644 packages/loot-core/.eslintignore

diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml
new file mode 100644
index 000000000..3a1ccb713
--- /dev/null
+++ b/.github/workflows/lint.yml
@@ -0,0 +1,29 @@
+name: Linter
+
+on:
+  push:
+    branches:
+      - master
+  pull_request:
+    branches: '*'
+
+jobs:
+  lint:
+    runs-on: ubuntu-latest
+    steps:
+      - uses: actions/checkout@v2
+      - name: Install node
+        uses: actions/setup-node@v1
+        with:
+          node-version: 16
+      - name: Cache
+        uses: actions/cache@v2
+        id: cache
+        with:
+          path: '**/node_modules'
+          key: yarn-v1-${{ hashFiles('**/yarn.lock') }}
+      - name: Install
+        run: yarn --immutable
+        if: steps.cache.outputs.cache-hit != 'true'
+      - name: Lint
+        run: yarn lint
diff --git a/packages/loot-core/.eslintignore b/packages/loot-core/.eslintignore
new file mode 100644
index 000000000..bb4225346
--- /dev/null
+++ b/packages/loot-core/.eslintignore
@@ -0,0 +1,3 @@
+**/node_modules/*
+**/lib-dist/*
+**/proto/*
diff --git a/packages/loot-core/package.json b/packages/loot-core/package.json
index 2529a5fe3..ab54b9dae 100644
--- a/packages/loot-core/package.json
+++ b/packages/loot-core/package.json
@@ -9,7 +9,7 @@
     "build:api": "cross-env NODE_ENV=development webpack --config ./webpack/webpack.api.config.js",
     "build:browser": "NODE_ENV=production ./bin/build-browser",
     "watch:browser": "NODE_ENV=development ./bin/build-browser",
-    "lint": "eslint --ignore-pattern '**/node_modules/*' --ignore-pattern '**/lib-dist/*' --ignore-pattern '**/proto/*' src"
+    "lint": "eslint src"
   },
   "author": "",
   "license": "ISC",
-- 
GitLab