@allthings/eslint-config 1.0.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/index.js +214 -0
- package/node.js +30 -0
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -40,7 +40,7 @@ yarn deploy
|
|
|
40
40
|
|
|
41
41
|
Run `yarn link` in the project folder
|
|
42
42
|
|
|
43
|
-
Run `yarn link @allthings/eslint-config` in the project that you want to test it against
|
|
43
|
+
Run `yarn link @allthings/eslint-config` in the project that you want to test it against
|
|
44
44
|
|
|
45
45
|
After you finish run in your project `yarn unlink @allthings/eslint-config` and then `yarn install --force`
|
|
46
46
|
to restore the initial state of dependencies
|
package/index.js
CHANGED
|
@@ -30,6 +30,7 @@ sortedPaths.push(...keptPaths)
|
|
|
30
30
|
|
|
31
31
|
const hookPropertyMap = new Map(
|
|
32
32
|
[
|
|
33
|
+
['eslint-plugin-jest', 'eslint-plugin-jest'],
|
|
33
34
|
['eslint-plugin-import', 'eslint-plugin-import'],
|
|
34
35
|
['eslint-plugin-react', 'eslint-plugin-react'],
|
|
35
36
|
['eslint-plugin-react-hooks', 'eslint-plugin-react-hooks'],
|
|
@@ -38,6 +39,7 @@ const hookPropertyMap = new Map(
|
|
|
38
39
|
'eslint-plugin-typescript-sort-keys',
|
|
39
40
|
'eslint-plugin-typescript-sort-keys',
|
|
40
41
|
],
|
|
42
|
+
['eslint-plugin-prefer-arrow', 'eslint-plugin-prefer-arrow'],
|
|
41
43
|
['eslint-plugin-simple-import-sort', 'eslint-plugin-simple-import-sort'],
|
|
42
44
|
].map(([request, replacement]) => [
|
|
43
45
|
request,
|
|
@@ -71,14 +73,82 @@ module.exports = {
|
|
|
71
73
|
'plugin:prettier/recommended',
|
|
72
74
|
],
|
|
73
75
|
plugins: [
|
|
76
|
+
'jest',
|
|
74
77
|
'import',
|
|
75
78
|
'react',
|
|
76
79
|
'react-hooks',
|
|
77
80
|
'jsx-a11y',
|
|
78
81
|
'typescript-sort-keys',
|
|
82
|
+
'prefer-arrow',
|
|
79
83
|
'simple-import-sort',
|
|
80
84
|
],
|
|
81
85
|
rules: {
|
|
86
|
+
'@typescript-eslint/adjacent-overload-signatures': 'error',
|
|
87
|
+
'@typescript-eslint/array-type': [
|
|
88
|
+
'error',
|
|
89
|
+
{
|
|
90
|
+
default: 'array',
|
|
91
|
+
},
|
|
92
|
+
],
|
|
93
|
+
'@typescript-eslint/ban-types': [
|
|
94
|
+
'error',
|
|
95
|
+
{
|
|
96
|
+
types: {
|
|
97
|
+
Object: {
|
|
98
|
+
message: 'Avoid using the `Object` type. Did you mean `object`?',
|
|
99
|
+
},
|
|
100
|
+
Function: {
|
|
101
|
+
message:
|
|
102
|
+
'Avoid using the `Function` type. Prefer a specific function type, like `() => void`.',
|
|
103
|
+
},
|
|
104
|
+
Boolean: {
|
|
105
|
+
message: 'Avoid using the `Boolean` type. Did you mean `boolean`?',
|
|
106
|
+
},
|
|
107
|
+
Number: {
|
|
108
|
+
message: 'Avoid using the `Number` type. Did you mean `number`?',
|
|
109
|
+
},
|
|
110
|
+
String: {
|
|
111
|
+
message: 'Avoid using the `String` type. Did you mean `string`?',
|
|
112
|
+
},
|
|
113
|
+
Symbol: {
|
|
114
|
+
message: 'Avoid using the `Symbol` type. Did you mean `symbol`?',
|
|
115
|
+
},
|
|
116
|
+
},
|
|
117
|
+
},
|
|
118
|
+
],
|
|
119
|
+
'@typescript-eslint/consistent-type-assertions': 'error',
|
|
120
|
+
'@typescript-eslint/explicit-function-return-type': [
|
|
121
|
+
'warn', // TODO: strict later
|
|
122
|
+
{
|
|
123
|
+
allowExpressions: false,
|
|
124
|
+
allowTypedFunctionExpressions: false,
|
|
125
|
+
allowHigherOrderFunctions: false,
|
|
126
|
+
allowDirectConstAssertionInArrowFunctions: true,
|
|
127
|
+
allowConciseArrowFunctionExpressionsStartingWithVoid: true,
|
|
128
|
+
},
|
|
129
|
+
],
|
|
130
|
+
'@typescript-eslint/explicit-module-boundary-types': [
|
|
131
|
+
'warn', // TODO: strict later
|
|
132
|
+
{
|
|
133
|
+
allowArgumentsExplicitlyTypedAsAny: true,
|
|
134
|
+
allowDirectConstAssertionInArrowFunctions: true,
|
|
135
|
+
allowHigherOrderFunctions: false,
|
|
136
|
+
allowTypedFunctionExpressions: false,
|
|
137
|
+
},
|
|
138
|
+
],
|
|
139
|
+
'@typescript-eslint/member-delimiter-style': [
|
|
140
|
+
'error',
|
|
141
|
+
{
|
|
142
|
+
multiline: {
|
|
143
|
+
delimiter: 'none',
|
|
144
|
+
requireLast: true,
|
|
145
|
+
},
|
|
146
|
+
singleline: {
|
|
147
|
+
delimiter: 'semi',
|
|
148
|
+
requireLast: false,
|
|
149
|
+
},
|
|
150
|
+
},
|
|
151
|
+
],
|
|
82
152
|
'@typescript-eslint/naming-convention': [
|
|
83
153
|
'error',
|
|
84
154
|
{
|
|
@@ -90,7 +160,69 @@ module.exports = {
|
|
|
90
160
|
selector: 'interface',
|
|
91
161
|
},
|
|
92
162
|
],
|
|
163
|
+
'@typescript-eslint/no-empty-function': 'error',
|
|
164
|
+
'@typescript-eslint/no-empty-interface': 'error',
|
|
165
|
+
'@typescript-eslint/no-explicit-any': 'error',
|
|
166
|
+
'@typescript-eslint/no-for-in-array': 'error',
|
|
167
|
+
'@typescript-eslint/no-inferrable-types': 'error',
|
|
168
|
+
'@typescript-eslint/no-misused-new': 'error',
|
|
169
|
+
'@typescript-eslint/no-namespace': 'error',
|
|
170
|
+
'@typescript-eslint/no-shadow': [
|
|
171
|
+
'error',
|
|
172
|
+
{
|
|
173
|
+
hoist: 'all',
|
|
174
|
+
},
|
|
175
|
+
],
|
|
176
|
+
'@typescript-eslint/no-this-alias': 'error',
|
|
177
|
+
'@typescript-eslint/no-unused-expressions': 'error',
|
|
93
178
|
'@typescript-eslint/no-unused-vars': 'error',
|
|
179
|
+
'@typescript-eslint/no-use-before-define': 'error',
|
|
180
|
+
'@typescript-eslint/no-var-requires': 'error',
|
|
181
|
+
'@typescript-eslint/prefer-for-of': 'error',
|
|
182
|
+
'@typescript-eslint/prefer-function-type': 'error',
|
|
183
|
+
'@typescript-eslint/prefer-namespace-keyword': 'error',
|
|
184
|
+
'@typescript-eslint/quotes': [
|
|
185
|
+
'error',
|
|
186
|
+
'single',
|
|
187
|
+
{
|
|
188
|
+
avoidEscape: true,
|
|
189
|
+
},
|
|
190
|
+
],
|
|
191
|
+
'@typescript-eslint/semi': ['error', 'never'],
|
|
192
|
+
'@typescript-eslint/triple-slash-reference': [
|
|
193
|
+
'error',
|
|
194
|
+
{
|
|
195
|
+
path: 'always',
|
|
196
|
+
types: 'prefer-import',
|
|
197
|
+
lib: 'always',
|
|
198
|
+
},
|
|
199
|
+
],
|
|
200
|
+
'@typescript-eslint/type-annotation-spacing': 'error',
|
|
201
|
+
'@typescript-eslint/typedef': 'error',
|
|
202
|
+
'@typescript-eslint/unified-signatures': 'error',
|
|
203
|
+
'arrow-body-style': ['error', 'as-needed'],
|
|
204
|
+
complexity: [
|
|
205
|
+
'error',
|
|
206
|
+
{
|
|
207
|
+
max: 15,
|
|
208
|
+
},
|
|
209
|
+
],
|
|
210
|
+
'constructor-super': 'error',
|
|
211
|
+
eqeqeq: ['error', 'smart'],
|
|
212
|
+
'guard-for-in': 'error',
|
|
213
|
+
'id-denylist': [
|
|
214
|
+
'error',
|
|
215
|
+
'any',
|
|
216
|
+
'Number',
|
|
217
|
+
'number',
|
|
218
|
+
'String',
|
|
219
|
+
'string',
|
|
220
|
+
'Boolean',
|
|
221
|
+
'boolean',
|
|
222
|
+
'Undefined',
|
|
223
|
+
'undefined',
|
|
224
|
+
],
|
|
225
|
+
'id-match': 'error',
|
|
94
226
|
'import/no-anonymous-default-export': [
|
|
95
227
|
'error',
|
|
96
228
|
{
|
|
@@ -104,8 +236,58 @@ module.exports = {
|
|
|
104
236
|
allowObject: true,
|
|
105
237
|
},
|
|
106
238
|
],
|
|
239
|
+
'import/no-extraneous-dependencies': [
|
|
240
|
+
'error',
|
|
241
|
+
{
|
|
242
|
+
devDependencies: true,
|
|
243
|
+
},
|
|
244
|
+
],
|
|
245
|
+
'jest/no-disabled-tests': 'warn',
|
|
246
|
+
'jest/no-focused-tests': 'error',
|
|
247
|
+
'jest/no-identical-title': 'error',
|
|
248
|
+
'jest/valid-expect': 'error',
|
|
249
|
+
'max-classes-per-file': ['error', 1],
|
|
250
|
+
'no-bitwise': 'error',
|
|
251
|
+
'no-caller': 'error',
|
|
252
|
+
'no-cond-assign': 'error',
|
|
107
253
|
'no-console': 'error',
|
|
254
|
+
'no-debugger': 'error',
|
|
255
|
+
'no-duplicate-case': 'error',
|
|
256
|
+
'no-duplicate-imports': 'error',
|
|
257
|
+
'no-empty': 'error',
|
|
258
|
+
'no-eval': 'error',
|
|
259
|
+
'no-extra-bind': 'error',
|
|
260
|
+
'no-multiple-empty-lines': 'error',
|
|
261
|
+
'no-new-func': 'error',
|
|
262
|
+
'no-new-wrappers': 'error',
|
|
263
|
+
'no-param-reassign': 'error',
|
|
264
|
+
'no-redeclare': 'error',
|
|
265
|
+
'no-return-await': 'error',
|
|
266
|
+
'no-sequences': 'error',
|
|
267
|
+
'no-sparse-arrays': 'error',
|
|
268
|
+
'no-template-curly-in-string': 'error',
|
|
269
|
+
'no-throw-literal': 'error',
|
|
270
|
+
'no-trailing-spaces': 'error',
|
|
271
|
+
'no-undef-init': 'error',
|
|
272
|
+
'no-unsafe-finally': 'error',
|
|
273
|
+
'no-unused-labels': 'error',
|
|
274
|
+
'no-var': 'error',
|
|
275
|
+
'object-shorthand': 'error',
|
|
276
|
+
'one-var': ['error', 'never'],
|
|
277
|
+
'padding-line-between-statements': [
|
|
278
|
+
'error',
|
|
279
|
+
{
|
|
280
|
+
blankLine: 'always',
|
|
281
|
+
prev: '*',
|
|
282
|
+
next: 'return',
|
|
283
|
+
},
|
|
284
|
+
],
|
|
285
|
+
'prefer-arrow/prefer-arrow-functions': 'error',
|
|
286
|
+
'prefer-const': 'error',
|
|
287
|
+
'prefer-object-spread': 'error',
|
|
288
|
+
'prefer-template': 'error',
|
|
108
289
|
quotes: ['error', 'single', { avoidEscape: true }],
|
|
290
|
+
radix: 'error',
|
|
109
291
|
'react-hooks/exhaustive-deps': 'error',
|
|
110
292
|
'react/jsx-curly-brace-presence': [
|
|
111
293
|
'error',
|
|
@@ -124,6 +306,14 @@ module.exports = {
|
|
|
124
306
|
'simple-import-sort/imports': 'error',
|
|
125
307
|
'simple-import-sort/exports': 'error',
|
|
126
308
|
'sort-keys': 'error',
|
|
309
|
+
'spaced-comment': [
|
|
310
|
+
'error',
|
|
311
|
+
'always',
|
|
312
|
+
{
|
|
313
|
+
markers: ['/'],
|
|
314
|
+
},
|
|
315
|
+
],
|
|
316
|
+
'use-isnan': 'error',
|
|
127
317
|
},
|
|
128
318
|
parser: '@typescript-eslint/parser',
|
|
129
319
|
parserOptions: {
|
|
@@ -159,6 +349,30 @@ module.exports = {
|
|
|
159
349
|
env: {
|
|
160
350
|
browser: true,
|
|
161
351
|
node: true,
|
|
352
|
+
'jest/globals': true,
|
|
353
|
+
},
|
|
354
|
+
globals: {
|
|
355
|
+
describe: true,
|
|
356
|
+
expect: true,
|
|
357
|
+
fetch: false,
|
|
358
|
+
it: true,
|
|
359
|
+
jest: true,
|
|
360
|
+
MutationObserver: true,
|
|
162
361
|
},
|
|
362
|
+
overrides: [
|
|
363
|
+
{
|
|
364
|
+
// because of jest
|
|
365
|
+
files: ['*.test.ts'],
|
|
366
|
+
rules: {
|
|
367
|
+
'@typescript-eslint/explicit-function-return-type': [
|
|
368
|
+
'warn',
|
|
369
|
+
{
|
|
370
|
+
allowTypedFunctionExpressions: true,
|
|
371
|
+
},
|
|
372
|
+
],
|
|
373
|
+
'@typescript-eslint/no-explicit-any': 'off',
|
|
374
|
+
},
|
|
375
|
+
},
|
|
376
|
+
],
|
|
163
377
|
root: true,
|
|
164
378
|
}
|
package/node.js
CHANGED
|
@@ -28,6 +28,7 @@ sortedPaths.push(...keptPaths.reverse())
|
|
|
28
28
|
|
|
29
29
|
const hookPropertyMap = new Map(
|
|
30
30
|
[
|
|
31
|
+
['eslint-plugin-jest', 'eslint-plugin-jest'],
|
|
31
32
|
['eslint-plugin-import', 'eslint-plugin-import'],
|
|
32
33
|
[
|
|
33
34
|
'eslint-plugin-typescript-sort-keys',
|
|
@@ -64,6 +65,7 @@ module.exports = {
|
|
|
64
65
|
'plugin:prettier/recommended',
|
|
65
66
|
],
|
|
66
67
|
plugins: [
|
|
68
|
+
'jest',
|
|
67
69
|
'import',
|
|
68
70
|
'typescript-sort-keys',
|
|
69
71
|
'prefer-arrow',
|
|
@@ -230,6 +232,10 @@ module.exports = {
|
|
|
230
232
|
devDependencies: true,
|
|
231
233
|
},
|
|
232
234
|
],
|
|
235
|
+
'jest/no-disabled-tests': 'warn',
|
|
236
|
+
'jest/no-focused-tests': 'error',
|
|
237
|
+
'jest/no-identical-title': 'error',
|
|
238
|
+
'jest/valid-expect': 'error',
|
|
233
239
|
'max-classes-per-file': ['error', 1],
|
|
234
240
|
'no-bitwise': 'error',
|
|
235
241
|
'no-caller': 'error',
|
|
@@ -316,6 +322,30 @@ module.exports = {
|
|
|
316
322
|
env: {
|
|
317
323
|
node: true,
|
|
318
324
|
es6: true,
|
|
325
|
+
'jest/globals': true,
|
|
319
326
|
},
|
|
327
|
+
globals: {
|
|
328
|
+
describe: true,
|
|
329
|
+
expect: true,
|
|
330
|
+
fetch: false,
|
|
331
|
+
it: true,
|
|
332
|
+
jest: true,
|
|
333
|
+
MutationObserver: true,
|
|
334
|
+
},
|
|
335
|
+
overrides: [
|
|
336
|
+
{
|
|
337
|
+
// because of jest
|
|
338
|
+
files: ['*.test.ts'],
|
|
339
|
+
rules: {
|
|
340
|
+
'@typescript-eslint/explicit-function-return-type': [
|
|
341
|
+
'warn',
|
|
342
|
+
{
|
|
343
|
+
allowTypedFunctionExpressions: true,
|
|
344
|
+
},
|
|
345
|
+
],
|
|
346
|
+
'@typescript-eslint/no-explicit-any': 'off',
|
|
347
|
+
},
|
|
348
|
+
},
|
|
349
|
+
],
|
|
320
350
|
root: true,
|
|
321
351
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@allthings/eslint-config",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "ESlint shareable config for Allthings style",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"files": [
|
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
"eslint-import-resolver-node": "^0.3.9",
|
|
23
23
|
"eslint-import-resolver-typescript": "^3.6.0",
|
|
24
24
|
"eslint-plugin-import": "^2.28.1",
|
|
25
|
+
"eslint-plugin-jest": "^27.4.0",
|
|
25
26
|
"eslint-plugin-jsx-a11y": "^6.7.1",
|
|
26
27
|
"eslint-plugin-n": "^16.0.2",
|
|
27
28
|
"eslint-plugin-prefer-arrow": "^1.2.3",
|