diff options
author | Markus Hatvan <markus_hatvan@aon.at> | 2021-07-30 10:54:54 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-30 14:24:54 +0530 |
commit | f4b4416ea52d564bc2dbe543a82084ed98843ccc (patch) | |
tree | 7ca6b23571c86458a6b799746c91a7191de02715 /.eslintrc | |
parent | 5.6.1-nightly.8 [skip ci] (diff) | |
download | ferdium-app-f4b4416ea52d564bc2dbe543a82084ed98843ccc.tar.gz ferdium-app-f4b4416ea52d564bc2dbe543a82084ed98843ccc.tar.zst ferdium-app-f4b4416ea52d564bc2dbe543a82084ed98843ccc.zip |
chore: migrate from tslint to @typescript-eslint (#1706)
- update .eslintrc to work for .js and .ts
- update devDependencies
- lint properly both root /src and nested /packages
- update webhint recommended setting for tsconfig.json to shrink output
- Manage all eslint rules from the repo root
- escape single quotes in scripts to please windows build
Co-authored-by: Vijay A <avijayr@protonmail.com>
Diffstat (limited to '.eslintrc')
-rw-r--r-- | .eslintrc | 163 |
1 files changed, 108 insertions, 55 deletions
@@ -3,71 +3,124 @@ | |||
3 | "parser": "@babel/eslint-parser", | 3 | "parser": "@babel/eslint-parser", |
4 | "extends": "eslint-config-airbnb", | 4 | "extends": "eslint-config-airbnb", |
5 | "plugins": ["jest"], | 5 | "plugins": ["jest"], |
6 | "rules": { | 6 | "overrides": [ |
7 | "arrow-parens": 0, | 7 | { |
8 | "consistent-return": 0, | 8 | "files": ["**/*.ts", "**/*.tsx"], |
9 | "no-param-reassign": 0, | 9 | "env": { "browser": true, "es6": true, "node": true }, |
10 | "import/extensions": 0, | 10 | "extends": ["airbnb-typescript"], |
11 | "import/no-extraneous-dependencies": 0, | 11 | "parser": "@typescript-eslint/parser", |
12 | "import/no-unresolved": [ | 12 | "parserOptions": { |
13 | 2, | 13 | "ecmaFeatures": { "jsx": true }, |
14 | { | 14 | "ecmaVersion": 2018, |
15 | "ignore": ["electron"] | 15 | "sourceType": "module", |
16 | } | 16 | "project": "./tsconfig.json" |
17 | ], | 17 | }, |
18 | "import/prefer-default-export": 0, | 18 | "plugins": ["@typescript-eslint"], |
19 | "linebreak-style": 0, | 19 | "rules": { |
20 | "react/static-property-placement": 0, | 20 | // eslint |
21 | "react/state-in-constructor": 0, | 21 | "arrow-parens": 0, |
22 | "react/jsx-props-no-spreading": 0, | 22 | "array-callback-return": 1, |
23 | "react/prefer-stateless-function": 0, | 23 | "class-methods-use-this": 0, |
24 | "react/jsx-filename-extension": [ | 24 | "consistent-return": 0, |
25 | 1, | 25 | "implicit-arrow-linebreak": 0, |
26 | { | 26 | "linebreak-style": 0, |
27 | "extensions": [".js", ".jsx"] | 27 | "max-len": 0, |
28 | } | 28 | "no-confusing-arrow": 0, |
29 | ], | 29 | "no-console": 0, |
30 | "react/forbid-prop-types": 0, | 30 | "no-param-reassign": 0, |
31 | "react/destructuring-assignment": 0, | 31 | "no-return-assign": 1, |
32 | "prefer-destructuring": 1, | 32 | "no-underscore-dangle": 0, |
33 | "no-underscore-dangle": 0, | 33 | "no-use-before-define": 0, |
34 | "max-len": 0, | 34 | "prefer-destructuring": 1, |
35 | "class-methods-use-this": 0, | 35 | "object-curly-newline": 0, |
36 | "no-console": 0, | 36 | "operator-linebreak": 0, |
37 | "react/jsx-no-bind": 0, | 37 | // @typescript-eslint |
38 | "react/sort-comp": 0, | 38 | "@typescript-eslint/indent": 0, |
39 | "jsx-a11y/no-static-element-interactions": 0, | 39 | "@typescript-eslint/no-shadow": 0, |
40 | "react/jsx-no-target-blank": 0, | 40 | "@typescript-eslint/no-unused-expressions": 0, |
41 | "no-restricted-syntax": [0, "ForInStatement"], | 41 | // eslint-plugin-import |
42 | "jsx-a11y/no-noninteractive-element-interactions": 1, | 42 | "import/extensions": 0, |
43 | "jsx-a11y/label-has-for": [ | 43 | "import/no-cycle": 1, |
44 | 2, | 44 | "import/no-extraneous-dependencies": 0, |
45 | { | 45 | "import/no-unresolved": 0, |
46 | "components": ["Label"], | 46 | "import/prefer-default-export": 0, |
47 | "required": { | 47 | // eslint-plugin-react |
48 | "every": ["id"] | 48 | "react/destructuring-assignment": 0, |
49 | }, | 49 | "react/button-has-type": 0, |
50 | "allowChildren": false | 50 | "react/forbid-prop-types": 0, |
51 | "react/jsx-curly-newline": 0, | ||
52 | "react/jsx-no-bind": 0, | ||
53 | "react/jsx-no-target-blank": 0, | ||
54 | "react/jsx-props-no-spreading": 0, | ||
55 | "react/no-deprecated": 1, | ||
56 | "react/no-array-index-key": 0, | ||
57 | "react/prefer-stateless-function": 0, | ||
58 | "react/sort-comp": 0, | ||
59 | "react/state-in-constructor": 0, | ||
60 | "react/static-property-placement": 0, | ||
61 | // eslint-plugin-jsx-a11y | ||
62 | "jsx-a11y/click-events-have-key-events": 1, | ||
63 | "jsx-a11y/mouse-events-have-key-events": 1, | ||
64 | "jsx-a11y/label-has-for": [ | ||
65 | 2, | ||
66 | { | ||
67 | "components": ["Label"], | ||
68 | "required": { | ||
69 | "every": ["id"] | ||
70 | }, | ||
71 | "allowChildren": false | ||
72 | } | ||
73 | ], | ||
74 | "jsx-a11y/no-static-element-interactions": 0, | ||
75 | "jsx-a11y/no-noninteractive-element-interactions": 1 | ||
51 | } | 76 | } |
52 | ], | 77 | } |
53 | "jsx-a11y/click-events-have-key-events": 1 | 78 | ], |
79 | "settings": { | ||
80 | "react": { | ||
81 | "pragma": "React", // Pragma to use, default to "React" | ||
82 | "version": "detect" // React version. "detect" automatically picks the version you have installed. | ||
83 | } | ||
54 | }, | 84 | }, |
55 | "globals": { | 85 | "globals": { |
56 | "window": true, | 86 | "window": true, |
57 | "document": true, | 87 | "document": true, |
58 | "ENV": true, | ||
59 | "FormData": true, | 88 | "FormData": true, |
60 | "localStorage": true, | 89 | "localStorage": true, |
61 | "navigator": true, | 90 | "navigator": true, |
62 | "Worker": true, | 91 | "Element": true |
63 | "atob": true, | ||
64 | "btoa": true, | ||
65 | "ga": true, | ||
66 | "mocha": true, | ||
67 | "Element": true, | ||
68 | "electron": true | ||
69 | }, | 92 | }, |
70 | "env": { | 93 | "env": { |
71 | "jest/globals": true | 94 | "jest/globals": true |
95 | }, | ||
96 | "rules": { | ||
97 | // eslint | ||
98 | "prefer-destructuring": 1, | ||
99 | "class-methods-use-this": 1, | ||
100 | "consistent-return": 1, | ||
101 | "max-len": 0, | ||
102 | "no-param-reassign": 1, | ||
103 | "no-restricted-syntax": 0, | ||
104 | "no-underscore-dangle": 0, | ||
105 | "operator-linebreak": 0, | ||
106 | // eslint-plugin-import | ||
107 | "import/extensions": 1, | ||
108 | "import/prefer-default-export": 0, | ||
109 | "import/no-extraneous-dependencies": 1, | ||
110 | "import/no-unresolved": 1, | ||
111 | // eslint-plugin-react | ||
112 | "react/forbid-prop-types": 1, | ||
113 | "react/destructuring-assignment": 0, | ||
114 | "react/jsx-filename-extension": 1, | ||
115 | "react/jsx-no-bind": 1, | ||
116 | "react/jsx-props-no-spreading": 0, | ||
117 | "react/prefer-stateless-function": 1, | ||
118 | "react/static-property-placement": 0, | ||
119 | "react/state-in-constructor": 1, | ||
120 | "react/sort-comp": 0, | ||
121 | // eslint-plugin-jsx-a11y | ||
122 | "jsx-a11y/click-events-have-key-events": 1, | ||
123 | "jsx-a11y/no-static-element-interactions": 1, | ||
124 | "jsx-a11y/no-noninteractive-element-interactions": 1 | ||
72 | } | 125 | } |
73 | } | 126 | } |