-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheslint.config.js
More file actions
352 lines (320 loc) · 18.2 KB
/
Copy patheslint.config.js
File metadata and controls
352 lines (320 loc) · 18.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
import js from '@eslint/js';
import globals from 'globals';
import stylistic from '@stylistic/eslint-plugin';
import jest from 'eslint-plugin-jest';
import { defineConfig } from 'eslint/config';
export default defineConfig([
{
files : [ '**/*.{js,mjs,cjs}' ],
plugins : {
'@stylistic' : stylistic,
js,
},
extends : [ 'js/recommended' ],
languageOptions : {
globals : {
...globals.node,
},
},
rules : {
'accessor-pairs' : [ 'warn', { enforceForTSTypes: true } ],
'array-callback-return' : [ 'warn', { allowVoid: true, checkForEach: true } ],
'arrow-body-style' : [ 'error', 'as-needed' ],
'block-scoped-var' : [ 'error' ],
'camelcase' : [ 'warn', { properties: 'always' } ],
'consistent-return' : [ 'error' ],
'consistent-this' : [ 'warn', 'self' ],
'constructor-super' : [ 'error' ],
'curly' : [ 'error', 'all' ],
'default-case-last' : [ 'error' ],
'default-param-last' : [ 'error' ],
'eqeqeq' : [ 'warn', 'smart' ],
'for-direction' : [ 'warn' ],
'func-name-matching' : [ 'error', 'always', { considerPropertyDescriptor: true } ],
'func-names' : [ 'error', 'always' ],
'func-style' : [ 'error', 'declaration', { allowArrowFunctions: true } ],
'getter-return' : [ 'error' ],
'grouped-accessor-pairs' : [ 'error', 'getBeforeSet', { enforceForTSTypes: true } ],
'guard-for-in' : [ 'warn' ],
'init-declarations' : [ 'error', 'always' ],
'logical-assignment-operators' : [ 'error', 'always', { enforceForIfStatements: true } ],
'no-array-constructor' : [ 'error' ],
'no-async-promise-executor' : [ 'warn' ],
'no-await-in-loop' : [ 'warn' ],
'no-case-declarations' : [ 'error' ],
'no-class-assign' : [ 'error' ],
'no-compare-neg-zero' : [ 'warn' ],
'no-cond-assign' : [ 'error', 'except-parens' ],
'no-console' : [ 'warn' ],
'no-const-assign' : [ 'error' ],
'no-constant-binary-expression' : [ 'warn' ],
'no-constant-condition' : [ 'warn', { checkLoops: 'allExceptWhileTrue' } ],
'no-constructor-return' : [ 'warn' ],
'no-control-regex' : [ 'warn' ],
'no-debugger' : [ 'warn' ],
'no-delete-var' : [ 'error' ],
'no-div-regex' : [ 'warn' ],
'no-dupe-args' : [ 'error' ],
'no-dupe-class-members' : [ 'error' ],
'no-dupe-else-if' : [ 'warn' ],
'no-dupe-keys' : [ 'error' ],
'no-duplicate-case' : [ 'error' ],
'no-duplicate-imports' : [ 'warn', { allowSeparateTypeImports: true } ],
'no-else-return' : [ 'warn', { allowElseIf: false } ],
'no-empty' : [ 'error' ],
'no-empty-character-class' : [ 'error' ],
'no-empty-function' : [ 'warn' ],
'no-empty-pattern' : [ 'error' ],
'no-empty-static-block' : [ 'warn' ],
'no-eq-null' : [ 'warn' ],
'no-eval' : [ 'warn' ],
'no-ex-assign' : [ 'warn' ],
'no-extend-native' : [ 'error' ],
'no-extra-bind' : [ 'warn' ],
'no-extra-boolean-cast' : [ 'warn', { enforceForInnerExpressions: true } ],
'no-extra-label' : [ 'warn' ],
'no-fallthrough' : [ 'warn', { allowEmptyCase: true } ],
'no-func-assign' : [ 'error' ],
'no-global-assign' : [ 'error' ],
'no-implied-eval' : [ 'error' ],
'no-import-assign' : [ 'error' ],
'no-invalid-regexp' : [ 'error' ],
'no-irregular-whitespace' : [ 'error' ],
'no-iterator' : [ 'error' ],
'no-label-var' : [ 'error' ],
'no-lone-blocks' : [ 'warn' ],
'no-lonely-if' : [ 'warn' ],
'no-loop-func' : [ 'warn' ],
'no-loss-of-precision' : [ 'warn' ],
'no-magic-numbers' : [
'warn',
{
detectObjects : true,
ignore : [ -1, 0, 1 ],
ignoreArrayIndexes : true,
ignoreClassFieldInitialValues : true,
ignoreDefaultValues : true,
ignoreEnums : true,
ignoreNumericLiteralTypes : true,
ignoreReadonlyClassProperties : true,
ignoreTypeIndexes : true,
},
],
'no-misleading-character-class' : [ 'error', { allowEscape: true } ],
'no-multi-str' : [ 'error' ],
'no-negated-condition' : [ 'warn' ],
'no-new-native-nonconstructor' : [ 'error' ],
'no-nonoctal-decimal-escape' : [ 'error' ],
'no-obj-calls' : [ 'error' ],
'no-octal' : [ 'error' ],
'no-octal-escape' : [ 'error' ],
'no-promise-executor-return' : [ 'error', { allowVoid: true } ],
'no-proto' : [ 'error' ],
'no-prototype-builtins' : [ 'warn' ],
'no-redeclare' : [ 'error' ],
'no-regex-spaces' : [ 'warn' ],
'no-return-assign' : [ 'error' ],
'no-self-assign' : [ 'warn', { props: false } ],
'no-self-compare' : [ 'warn' ],
'no-setter-return' : [ 'error' ],
'no-shadow' : [
'error',
{
builtinGlobals : true,
hoist : 'all',
ignoreFunctionTypeParameterNameValueShadow : false,
},
],
'no-shadow-restricted-names' : [ 'error' ],
'no-sparse-arrays' : [ 'off' ],
'no-template-curly-in-string' : [ 'warn' ],
'no-this-before-super' : [ 'error' ],
'no-throw-literal' : [ 'error' ],
'no-unassigned-vars' : [ 'error' ],
'no-undef' : [ 'error', { 'typeof': true } ],
'no-unexpected-multiline' : [ 'error' ],
'no-unmodified-loop-condition' : [ 'warn' ],
'no-unneeded-ternary' : [ 'error', { defaultAssignment: false } ],
'no-unreachable' : [ 'warn' ],
'no-unreachable-loop' : [ 'warn', { ignore: [ 'DoWhileStatement' ] } ],
'no-unsafe-finally' : [ 'error' ],
'no-unsafe-negation' : [ 'error', { enforceForOrderingRelations: true } ],
'no-unsafe-optional-chaining' : [ 'error', { disallowArithmeticOperators: true } ],
'no-unused-expressions' : [ 'warn' ],
'no-unused-labels' : [ 'warn' ],
'no-unused-private-class-members' : [ 'warn' ],
'no-unused-vars' : [ 'warn', { args: 'none', ignoreRestSiblings: true, ignoreUsingDeclarations: true } ],
'no-use-before-define' : [ 'error', { allowNamedExports: true } ],
'no-useless-assignment' : [ 'warn' ],
'no-useless-backreference' : [ 'error' ],
'no-useless-call' : [ 'warn' ],
'no-useless-catch' : [ 'warn' ],
'no-useless-computed-key' : [ 'warn' ],
'no-useless-concat' : [ 'warn' ],
'no-useless-constructor' : [ 'warn' ],
'no-useless-escape' : [ 'warn', { allowRegexCharacters: [ '-' ] } ],
'no-useless-rename' : [ 'warn' ],
'no-useless-return' : [ 'warn' ],
'no-var' : [ 'error' ],
'no-with' : [ 'off' ],
'object-shorthand' : [ 'error', 'always', { avoidExplicitReturnArrows: true } ],
'one-var' : [ 'error', 'never' ],
'operator-assignment' : [ 'error', 'always' ],
'prefer-arrow-callback' : [ 'warn' ],
'prefer-const' : [ 'warn' ],
'prefer-exponentiation-operator' : [ 'warn' ],
'prefer-numeric-literals' : [ 'warn' ],
'prefer-object-has-own' : [ 'warn' ],
'prefer-object-spread' : [ 'warn' ],
'prefer-promise-reject-errors' : [ 'error' ],
'prefer-spread' : [ 'warn' ],
'prefer-template' : [ 'warn' ],
'preserve-caught-error' : [ 'warn' ],
'radix' : [ 'error' ],
'require-atomic-updates' : [ 'error' ],
'require-await' : [ 'warn' ],
'require-yield' : [ 'warn' ],
'sort-imports' : [ 'warn', { ignoreDeclarationSort: true } ],
'sort-keys' : [ 'warn', 'asc', { allowLineSeparatedGroups: true, ignoreComputedKeys: true } ],
'unicode-bom' : [ 'error', 'never' ],
'use-isnan' : [ 'error', { enforceForIndexOf: true } ],
'valid-typeof' : [ 'error', { requireStringLiterals: true } ],
'vars-on-top' : [ 'error' ],
'yoda' : [ 'warn', 'never', { exceptRange: true } ],
'@stylistic/array-bracket-newline' : [ 'warn', { multiline: true } ],
'@stylistic/array-bracket-spacing' : [ 'warn', 'always' ],
'@stylistic/array-element-newline' : [ 'warn', { consistent: true, multiline: true } ],
'@stylistic/arrow-parens' : [ 'error', 'always' ],
'@stylistic/arrow-spacing' : [ 'warn' ],
'@stylistic/block-spacing' : [ 'warn' ],
'@stylistic/brace-style' : [ 'error', 'stroustrup', { allowSingleLine: true } ],
'@stylistic/comma-dangle' : [ 'warn', 'always-multiline' ],
'@stylistic/comma-spacing' : [ 'warn', { after: true, before: false } ],
'@stylistic/comma-style' : [ 'warn', 'last' ],
'@stylistic/computed-property-spacing' : [ 'warn', 'never' ],
'@stylistic/curly-newline' : [ 'warn', { consistent: true, multiline: true } ],
'@stylistic/dot-location' : [ 'error', 'property' ],
'@stylistic/eol-last' : [ 'error', 'always' ],
'@stylistic/function-call-argument-newline' : [ 'warn', 'consistent' ],
'@stylistic/function-call-spacing' : [ 'warn', 'never' ],
'@stylistic/function-paren-newline' : [ 'warn', 'multiline' ],
'@stylistic/generator-star-spacing' : [ 'error', 'both' ],
'@stylistic/implicit-arrow-linebreak' : [ 'warn', 'beside' ],
'@stylistic/indent' : [ 'error', 4 ], // eslint-disable-line no-magic-numbers
'@stylistic/key-spacing' : [
'warn',
{
'multiLine' : { afterColon: true, align: 'colon', beforeColon: true },
'singleLine' : { afterColon: true, beforeColon: false },
},
],
'@stylistic/keyword-spacing' : 'warn',
'@stylistic/linebreak-style' : [ 'error', 'unix' ],
'@stylistic/lines-between-class-members' : [
'warn',
{
enforce : [
{ blankLine: 'always', next: '*', prev: '*' },
{ blankLine: 'never', next: 'field', prev: 'field' },
],
},
],
'@stylistic/max-len' : [ 'error', { code: 120 } ], // eslint-disable-line no-magic-numbers
'@stylistic/max-statements-per-line' : [ 'error', { max: 1 } ],
'@stylistic/multiline-ternary' : [ 'warn', 'always-multiline' ],
'@stylistic/new-parens' : [ 'warn', 'never' ],
'@stylistic/no-confusing-arrow' : [ 'error' ],
'@stylistic/no-extra-semi' : [ 'warn' ],
'@stylistic/no-floating-decimal' : [ 'error' ],
'@stylistic/no-mixed-operators' : [ 'error' ],
'@stylistic/no-mixed-spaces-and-tabs' : [ 'error' ],
'@stylistic/no-multi-spaces' : [ 'warn', { ignoreEOLComments: true } ],
'@stylistic/no-trailing-spaces' : [ 'warn' ],
'@stylistic/no-whitespace-before-property' : [ 'error' ],
'@stylistic/object-curly-newline' : [
'warn',
{
'ExportDeclaration' : { consistent: true, multiline: true },
'ImportDeclaration' : 'never',
'ObjectExpression' : { consistent: true, multiline: true },
'ObjectPattern' : { consistent: true, multiline: true },
},
],
'@stylistic/object-curly-spacing' : [ 'warn', 'always' ],
'@stylistic/object-property-newline' : [ 'warn', { allowAllPropertiesOnSameLine: true } ],
'@stylistic/one-var-declaration-per-line' : [ 'error', 'always' ],
'@stylistic/operator-linebreak' : [ 'warn', 'before' ],
'@stylistic/padded-blocks' : [ 'warn', 'never' ],
'@stylistic/padding-line-between-statements' : [
'warn',
{ blankLine: 'always', next: '*', prev: '*' },
{ blankLine: 'never', next: 'directive', prev: 'directive' },
{ blankLine: 'never', next: 'import', prev: 'import' },
{ blankLine: 'any', next: 'singleline-const', prev: 'singleline-const' },
{ blankLine: 'any', next: 'singleline-export', prev: 'singleline-export' },
{ blankLine: 'any', next: 'singleline-expression', prev: 'singleline-expression' },
{ blankLine: 'any', next: 'singleline-let', prev: 'singleline-let' },
{ blankLine: 'any', next: 'singleline-type', prev: 'singleline-type' },
{ blankLine: 'any', next: 'singleline-using', prev: 'singleline-using' },
{ blankLine: 'any', next: 'singleline-var', prev: 'singleline-var' },
],
'@stylistic/quote-props' : [ 'warn', 'consistent' ],
'@stylistic/quotes' : [ 'warn', 'single', { avoidEscape: true } ],
'@stylistic/rest-spread-spacing' : [ 'error', 'never' ],
'@stylistic/semi' : [
'error',
'always',
{
omitLastInOneLineBlock : true,
omitLastInOneLineClassBody : true,
},
],
'@stylistic/semi-spacing' : [ 'warn' ],
'@stylistic/semi-style' : [ 'error', 'last' ],
'@stylistic/space-before-blocks' : [ 'warn', 'always' ],
'@stylistic/space-before-function-paren' : [
'warn',
{
anonymous : 'always',
asyncArrow : 'always',
catch : 'always',
named : 'never',
},
],
'@stylistic/space-in-parens' : [ 'warn', 'never' ],
'@stylistic/space-infix-ops' : [ 'error' ],
'@stylistic/space-unary-ops' : [ 'error', { nonwords: false, words: true } ],
'@stylistic/spaced-comment' : [ 'warn', 'always', { block: { balanced: true } } ],
'@stylistic/switch-colon-spacing' : [ 'error', { after: true, before: false } ],
'@stylistic/template-curly-spacing' : [ 'warn', 'always' ],
'@stylistic/template-tag-spacing' : [ 'error', 'never' ],
'@stylistic/type-annotation-spacing' : [ 'warn', { after: true, before: true } ],
'@stylistic/type-generic-spacing' : [ 'error' ],
'@stylistic/type-named-tuple-spacing' : [ 'warn' ],
'@stylistic/wrap-iife' : [ 'error', 'inside', { functionPrototypeMethods: true } ],
'@stylistic/wrap-regex' : [ 'error' ],
'@stylistic/yield-star-spacing' : [ 'error', 'both' ],
},
},
{
files : [ '**/*.js' ],
languageOptions : { sourceType: 'module' },
},
{
files : [ '__tests__/*.js' ],
plugins : {
'@stylistic' : stylistic,
jest,
js,
},
languageOptions : {
globals : {
...globals.node,
...jest.environments.globals.globals,
},
},
rules : {
'no-magic-numbers' : [ 'off' ],
},
},
]);