diff options
Diffstat (limited to '.eslintrc.js')
-rw-r--r-- | .eslintrc.js | 159 |
1 files changed, 51 insertions, 108 deletions
diff --git a/.eslintrc.js b/.eslintrc.js index e89b5a618..db66bbc4a 100644 --- a/.eslintrc.js +++ b/.eslintrc.js | |||
@@ -1,5 +1,4 @@ | |||
1 | /** @type {import('eslint').Linter.Config} */ | 1 | /** @type {import('eslint').Linter.Config} */ |
2 | |||
3 | module.exports = { | 2 | module.exports = { |
4 | root: true, | 3 | root: true, |
5 | parserOptions: { | 4 | parserOptions: { |
@@ -10,9 +9,14 @@ module.exports = { | |||
10 | sourceType: 'module', | 9 | sourceType: 'module', |
11 | project: './tsconfig.json', | 10 | project: './tsconfig.json', |
12 | }, | 11 | }, |
13 | ignorePatterns: ['node_modules', 'build', 'recipes', '.eslintrc.js'], | 12 | ignorePatterns: ['node_modules', 'build', 'recipes'], |
14 | extends: ['airbnb', 'plugin:unicorn/recommended', 'prettier'], | 13 | extends: [ |
15 | plugins: ['jest', 'prettier'], | 14 | 'airbnb', |
15 | 'plugin:jest/recommended', | ||
16 | 'plugin:unicorn/recommended', | ||
17 | 'plugin:prettier/recommended', | ||
18 | ], | ||
19 | plugins: ['jest'], | ||
16 | settings: { | 20 | settings: { |
17 | react: { | 21 | react: { |
18 | pragma: 'React', // Pragma to use, default to "React" | 22 | pragma: 'React', // Pragma to use, default to "React" |
@@ -28,123 +32,50 @@ module.exports = { | |||
28 | node: true, | 32 | node: true, |
29 | jest: true, | 33 | jest: true, |
30 | }, | 34 | }, |
35 | reportUnusedDisableDirectives: true, | ||
31 | overrides: [ | 36 | overrides: [ |
32 | { | 37 | { |
33 | files: ['**/*.ts', '**/*.tsx'], | 38 | files: ['**/*.ts', '**/*.tsx'], |
34 | extends: ['airbnb-typescript', 'plugin:unicorn/recommended', 'prettier'], | 39 | extends: [ |
40 | 'airbnb-typescript', | ||
41 | 'plugin:@typescript-eslint/eslint-recommended', | ||
42 | 'plugin:@typescript-eslint/strict', | ||
43 | // TODO: Opt-in to a stricter ruleset in the future | ||
44 | // 'plugin:@typescript-eslint/strict-type-checked', | ||
45 | 'plugin:@typescript-eslint/stylistic-type-checked', | ||
46 | ], | ||
35 | parser: '@typescript-eslint/parser', | 47 | parser: '@typescript-eslint/parser', |
36 | plugins: ['@typescript-eslint', 'jest', 'prettier'], | 48 | plugins: [], |
37 | rules: { | 49 | rules: { |
38 | // eslint | ||
39 | 'arrow-parens': 0, | ||
40 | 'array-callback-return': 1, | ||
41 | 'class-methods-use-this': 0, | ||
42 | 'consistent-return': 0, | ||
43 | 'function-paren-newline': 0, | ||
44 | 'implicit-arrow-linebreak': 0, | ||
45 | 'linebreak-style': 0, | ||
46 | 'max-len': 0, | ||
47 | 'no-confusing-arrow': 0, | ||
48 | 'no-console': 0, | ||
49 | 'no-param-reassign': 0, | ||
50 | 'no-restricted-syntax': 0, | ||
51 | 'no-return-assign': 1, | ||
52 | 'no-underscore-dangle': 0, | ||
53 | 'no-use-before-define': 0, | ||
54 | 'prefer-destructuring': 1, | ||
55 | 'object-curly-newline': 0, | ||
56 | 'operator-linebreak': 0, | ||
57 | // @typescript-eslint | 50 | // @typescript-eslint |
58 | // TODO: Turn this rule on again after gulp -> webpack migration | ||
59 | // gulp-typescript doesn't consider custom index.d.ts in @types | ||
60 | // This is necessary as workaround for window.ferdium vs window['ferdium'] | 51 | // This is necessary as workaround for window.ferdium vs window['ferdium'] |
61 | '@typescript-eslint/dot-notation': 0, | 52 | '@typescript-eslint/dot-notation': 0, |
62 | '@typescript-eslint/indent': 0, | 53 | '@typescript-eslint/indent': 0, |
63 | '@typescript-eslint/no-shadow': 0, | 54 | '@typescript-eslint/no-shadow': 0, |
64 | '@typescript-eslint/no-unused-expressions': 0, | 55 | '@typescript-eslint/no-var-requires': 0, |
56 | '@typescript-eslint/no-explicit-any': 0, | ||
57 | '@typescript-eslint/no-inferrable-types': 0, | ||
58 | '@typescript-eslint/no-non-null-assertion': 0, | ||
59 | '@typescript-eslint/prefer-nullish-coalescing': 0, | ||
60 | '@typescript-eslint/consistent-indexed-object-style': 0, | ||
61 | '@typescript-eslint/consistent-type-assertions': 0, | ||
62 | '@typescript-eslint/consistent-type-definitions': 0, | ||
63 | '@typescript-eslint/no-empty-interface': 0, | ||
64 | |||
65 | // eslint-plugin-import | 65 | // eslint-plugin-import |
66 | 'import/extensions': 0, | 66 | 'import/no-extraneous-dependencies': 0, // various false positives, re-enable at some point |
67 | 'import/no-cycle': 1, | ||
68 | 'import/no-extraneous-dependencies': 0, | ||
69 | 'import/no-unresolved': 0, | ||
70 | 'import/prefer-default-export': 0, | ||
71 | // eslint-plugin-react | ||
72 | // TODO: [TS DEBT] should remove below config once application converted to TS | ||
73 | 'react/default-props-match-prop-types': 0, | ||
74 | 'react/require-default-props': 0, | ||
75 | '@typescript-eslint/no-useless-constructor': 0, | ||
76 | // eslint-plugin-react | ||
77 | 'react/destructuring-assignment': 0, | ||
78 | 'react/button-has-type': 0, | ||
79 | 'react/forbid-prop-types': 0, | ||
80 | 'react/jsx-curly-newline': 0, | ||
81 | 'react/no-unused-prop-types': 1, | ||
82 | 'react/react-in-jsx-scope': 0, | ||
83 | 'react/jsx-no-bind': 0, | ||
84 | 'react/jsx-no-target-blank': 0, | ||
85 | 'react/jsx-props-no-spreading': 0, | ||
86 | 'react/no-deprecated': 1, | ||
87 | 'react/no-array-index-key': 0, | ||
88 | 'react/prefer-stateless-function': 0, | ||
89 | 'react/sort-comp': 0, | ||
90 | 'react/state-in-constructor': 0, | ||
91 | 'react/static-property-placement': 0, | ||
92 | 'react/function-component-definition': 0, | ||
93 | 'react/jsx-no-useless-fragment': 0, | ||
94 | // eslint-plugin-jsx-a11y | ||
95 | 'jsx-a11y/click-events-have-key-events': 1, | ||
96 | 'jsx-a11y/mouse-events-have-key-events': 1, | ||
97 | 'jsx-a11y/label-has-for': [ | ||
98 | 2, | ||
99 | { | ||
100 | components: ['Label'], | ||
101 | required: { | ||
102 | every: ['id'], | ||
103 | }, | ||
104 | allowChildren: false, | ||
105 | }, | ||
106 | ], | ||
107 | 'jsx-a11y/no-static-element-interactions': 0, | ||
108 | 'jsx-a11y/no-noninteractive-element-interactions': 1, | ||
109 | // eslint-plugin-unicorn | ||
110 | 'unicorn/filename-case': 0, | ||
111 | 'unicorn/no-null': 0, | ||
112 | 'unicorn/no-useless-undefined': 0, | ||
113 | 'unicorn/prefer-module': 0, | ||
114 | 'unicorn/prevent-abbreviations': 0, | ||
115 | 'unicorn/prefer-node-protocol': 0, | ||
116 | 'unicorn/import-style': [ | ||
117 | 2, | ||
118 | { | ||
119 | styles: { | ||
120 | path: { | ||
121 | named: true, | ||
122 | }, | ||
123 | }, | ||
124 | }, | ||
125 | ], | ||
126 | 'unicorn/consistent-destructuring': 0, | ||
127 | // INFO: Turned off due to src/internal-server/database/factory.js | ||
128 | 'unicorn/no-empty-file': 0, | ||
129 | // eslint-plugin-prettier | ||
130 | 'prettier/prettier': 1, | ||
131 | }, | 67 | }, |
132 | }, | 68 | }, |
133 | ], | 69 | ], |
134 | rules: { | 70 | rules: { |
135 | // eslint | 71 | // eslint |
136 | 'arrow-parens': 0, | 72 | 'array-callback-return': 1, |
137 | 'class-methods-use-this': 0, | 73 | 'class-methods-use-this': 0, |
138 | 'consistent-return': 1, | 74 | 'consistent-return': 1, |
139 | 'implicit-arrow-linebreak': 0, | ||
140 | indent: 0, | ||
141 | // TODO: Turn this rule on once the js to ts conversions are over | 75 | // TODO: Turn this rule on once the js to ts conversions are over |
142 | // This is necessary as workaround for window.ferdium vs window['ferdium'] | 76 | // This is necessary as workaround for window.ferdium vs window['ferdium'] |
143 | 'dot-notation': 0, | ||
144 | 'function-paren-newline': 0, | ||
145 | 'linebreak-style': 0, | ||
146 | 'max-len': 0, | ||
147 | 'no-await-in-loop': 1, | 77 | 'no-await-in-loop': 1, |
78 | 'no-return-assign': 1, | ||
148 | 'no-console': [ | 79 | 'no-console': [ |
149 | 1, | 80 | 1, |
150 | { | 81 | { |
@@ -154,18 +85,16 @@ module.exports = { | |||
154 | 'no-param-reassign': 1, | 85 | 'no-param-reassign': 1, |
155 | 'no-restricted-syntax': 0, | 86 | 'no-restricted-syntax': 0, |
156 | 'no-underscore-dangle': 0, | 87 | 'no-underscore-dangle': 0, |
157 | 'operator-linebreak': 0, | ||
158 | 'prefer-destructuring': 1, | 88 | 'prefer-destructuring': 1, |
159 | 'object-curly-newline': 0, | ||
160 | // eslint-plugin-import | 89 | // eslint-plugin-import |
161 | 'import/extensions': 0, | 90 | 'import/extensions': 0, |
162 | 'import/prefer-default-export': 0, | 91 | 'import/prefer-default-export': 0, |
163 | 'import/no-extraneous-dependencies': 0, // various false positives, re-enable at some point | ||
164 | 'import/no-unresolved': 0, | 92 | 'import/no-unresolved': 0, |
93 | 'import/no-cycle': 1, | ||
94 | 'import/no-extraneous-dependencies': 0, // various false positives, re-enable at some point | ||
165 | // eslint-plugin-react | 95 | // eslint-plugin-react |
166 | 'react/forbid-prop-types': 1, | 96 | 'react/forbid-prop-types': 1, |
167 | 'react/destructuring-assignment': 0, | 97 | 'react/destructuring-assignment': 0, |
168 | 'react/jsx-curly-newline': 0, | ||
169 | 'react/react-in-jsx-scope': 0, | 98 | 'react/react-in-jsx-scope': 0, |
170 | 'react/jsx-filename-extension': 1, | 99 | 'react/jsx-filename-extension': 1, |
171 | 'react/jsx-one-expression-per-line': 0, | 100 | 'react/jsx-one-expression-per-line': 0, |
@@ -178,11 +107,27 @@ module.exports = { | |||
178 | 'react/sort-comp': 0, | 107 | 'react/sort-comp': 0, |
179 | 'react/function-component-definition': 0, | 108 | 'react/function-component-definition': 0, |
180 | 'react/jsx-no-useless-fragment': 0, | 109 | 'react/jsx-no-useless-fragment': 0, |
181 | // eslint-plugin-jsx-a11y | 110 | // TODO: [TS DEBT] should remove below config once application converted to TS |
111 | 'react/default-props-match-prop-types': 0, | ||
112 | 'react/require-default-props': 0, | ||
113 | 'react/button-has-type': 0, | ||
114 | 'react/no-unused-prop-types': 1, | ||
115 | 'react/no-deprecated': 1, | ||
116 | // eslint-plugin-jsx-a11y | ||
182 | 'jsx-a11y/click-events-have-key-events': 1, | 117 | 'jsx-a11y/click-events-have-key-events': 1, |
183 | 'jsx-a11y/no-static-element-interactions': 1, | 118 | 'jsx-a11y/no-static-element-interactions': 1, |
184 | 'jsx-a11y/no-noninteractive-element-interactions': 1, | 119 | 'jsx-a11y/no-noninteractive-element-interactions': 1, |
185 | // eslint-plugin-unicorn | 120 | 'jsx-a11y/label-has-for': [ |
121 | 2, | ||
122 | { | ||
123 | components: ['Label'], | ||
124 | required: { | ||
125 | every: ['id'], | ||
126 | }, | ||
127 | allowChildren: false, | ||
128 | }, | ||
129 | ], | ||
130 | // eslint-plugin-unicorn | ||
186 | 'unicorn/filename-case': 0, | 131 | 'unicorn/filename-case': 0, |
187 | 'unicorn/no-null': 0, | 132 | 'unicorn/no-null': 0, |
188 | 'unicorn/no-useless-undefined': 0, | 133 | 'unicorn/no-useless-undefined': 0, |
@@ -202,7 +147,5 @@ module.exports = { | |||
202 | 'unicorn/consistent-destructuring': 0, | 147 | 'unicorn/consistent-destructuring': 0, |
203 | // INFO: Turned off due to src/internal-server/database/factory.js | 148 | // INFO: Turned off due to src/internal-server/database/factory.js |
204 | 'unicorn/no-empty-file': 0, | 149 | 'unicorn/no-empty-file': 0, |
205 | // eslint-plugin-prettier | ||
206 | 'prettier/prettier': 1, | ||
207 | }, | 150 | }, |
208 | }; | 151 | }; |