diff options
author | 2021-01-03 04:47:41 +0300 | |
---|---|---|
committer | 2021-01-03 04:51:51 +0300 | |
commit | 051dbe93d9b365dd3f7c6a09fe4cc47c5b752fcf (patch) | |
tree | 6327d42d50f9afff4bf7c4f5afd05e5a4664210e | |
parent | Cleans Up Dependencies (diff) |
Adds EsLint
Adds eslint, eslint rules, and updates the workflow file. Adds a yarn
command to run linting.
Signed-off-by: Hassan Abouelela <[email protected]>
-rw-r--r-- | .eslintrc.json | 41 | ||||
-rw-r--r-- | .github/workflows/test_and_lint.yml | 15 | ||||
-rw-r--r-- | .gitignore | 3 | ||||
-rw-r--r-- | package.json | 3 |
4 files changed, 59 insertions, 3 deletions
diff --git a/.eslintrc.json b/.eslintrc.json new file mode 100644 index 0000000..4e55622 --- /dev/null +++ b/.eslintrc.json @@ -0,0 +1,41 @@ +{ + "env": { + "browser": true, + "es2021": true + }, + "extends": [ + "eslint:recommended", + "plugin:react/recommended", + "plugin:@typescript-eslint/recommended" + ], + "parser": "@typescript-eslint/parser", + "parserOptions": { + "ecmaFeatures": { + "jsx": true + }, + "ecmaVersion": 12, + "sourceType": "module" + }, + "plugins": [ + "react", + "@typescript-eslint" + ], + "rules": { + "indent": [ + "error", + 4 + ], + "linebreak-style": [ + "error", + "unix" + ], + "quotes": [ + "error", + "double" + ], + "semi": [ + "error", + "always" + ] + } +} diff --git a/.github/workflows/test_and_lint.yml b/.github/workflows/test_and_lint.yml index e7a0d05..636e181 100644 --- a/.github/workflows/test_and_lint.yml +++ b/.github/workflows/test_and_lint.yml @@ -32,5 +32,16 @@ jobs: - name: Run tests run: yarn test - - + + lint: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - uses: EgorDm/gha-yarn-node-cache@v1 + + - name: Install dependencies + run: yarn install --dev + + - name: Lint + run: yarn run eslint --ext .ts,.tsx --quiet src/ @@ -8,6 +8,9 @@ # testing /coverage +# linting +.eslintcache + # production /build diff --git a/package.json b/package.json index 059077c..641fe19 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,8 @@ "scripts": { "start": "cross-env NODE_ENV=development webpack serve", "build": "cross-env REACT_APP_SHA=$COMMIT_REF REACT_APP_BRANCH=$BRANCH webpack", - "test": "cross-env jest" + "test": "cross-env jest", + "lint": "cross-env eslint --cache src/" }, "eslintConfig": { "extends": "react-app" |