@egs33/eslint-config 3.0.3 → 4.0.1
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/airbnb/best-practices.js +7 -283
- package/airbnb/errors.js +4 -170
- package/airbnb/es6.js +0 -112
- package/airbnb/style.js +3 -521
- package/airbnb/variables.js +1 -32
- package/base.js +8 -6
- package/package.json +19 -19
- package/plugin-rules/imports.js +1 -9
- package/plugin-rules/stylistic.js +187 -0
- package/typescript-base.js +54 -8
- package/typescript-svelte.js +1 -2
package/airbnb/style.js
CHANGED
|
@@ -1,247 +1,12 @@
|
|
|
1
1
|
export const style = {
|
|
2
|
-
// enforce line breaks after opening and before closing array brackets
|
|
3
|
-
// https://eslint.org/docs/rules/array-bracket-newline
|
|
4
|
-
// TODO: enable? semver-major
|
|
5
|
-
'array-bracket-newline': ['off', 'consistent'], // object option alternative: { multiline: true, minItems: 3 }
|
|
6
|
-
|
|
7
|
-
// enforce line breaks between array elements
|
|
8
|
-
// https://eslint.org/docs/rules/array-element-newline
|
|
9
|
-
// TODO: enable? semver-major
|
|
10
|
-
'array-element-newline': ['off', { multiline: true, minItems: 3 }],
|
|
11
|
-
|
|
12
|
-
// enforce spacing inside array brackets
|
|
13
|
-
'array-bracket-spacing': ['error', 'never'],
|
|
14
|
-
|
|
15
|
-
// enforce spacing inside single-line blocks
|
|
16
|
-
// https://eslint.org/docs/rules/block-spacing
|
|
17
|
-
'block-spacing': ['error', 'always'],
|
|
18
|
-
|
|
19
|
-
// enforce one true brace style
|
|
20
|
-
'brace-style': ['error', '1tbs', { allowSingleLine: true }],
|
|
21
|
-
|
|
22
|
-
// require camel case names
|
|
23
2
|
camelcase: ['error', { properties: 'never', ignoreDestructuring: false }],
|
|
24
|
-
|
|
25
|
-
// enforce or disallow capitalization of the first letter of a comment
|
|
26
|
-
// https://eslint.org/docs/rules/capitalized-comments
|
|
27
|
-
'capitalized-comments': [
|
|
28
|
-
'off', 'never', {
|
|
29
|
-
line: {
|
|
30
|
-
ignorePattern: '.*',
|
|
31
|
-
ignoreInlineComments: true,
|
|
32
|
-
ignoreConsecutiveComments: true,
|
|
33
|
-
},
|
|
34
|
-
block: {
|
|
35
|
-
ignorePattern: '.*',
|
|
36
|
-
ignoreInlineComments: true,
|
|
37
|
-
ignoreConsecutiveComments: true,
|
|
38
|
-
},
|
|
39
|
-
},
|
|
40
|
-
],
|
|
41
|
-
|
|
42
|
-
// require trailing commas in multiline object literals
|
|
43
|
-
'comma-dangle': [
|
|
44
|
-
'error', {
|
|
45
|
-
arrays: 'always-multiline',
|
|
46
|
-
objects: 'always-multiline',
|
|
47
|
-
imports: 'always-multiline',
|
|
48
|
-
exports: 'always-multiline',
|
|
49
|
-
functions: 'always-multiline',
|
|
50
|
-
},
|
|
51
|
-
],
|
|
52
|
-
|
|
53
|
-
// enforce spacing before and after comma
|
|
54
|
-
'comma-spacing': ['error', { before: false, after: true }],
|
|
55
|
-
|
|
56
|
-
// enforce one true comma style
|
|
57
|
-
'comma-style': [
|
|
58
|
-
'error', 'last', {
|
|
59
|
-
exceptions: {
|
|
60
|
-
ArrayExpression: false,
|
|
61
|
-
ArrayPattern: false,
|
|
62
|
-
ArrowFunctionExpression: false,
|
|
63
|
-
CallExpression: false,
|
|
64
|
-
FunctionDeclaration: false,
|
|
65
|
-
FunctionExpression: false,
|
|
66
|
-
ImportDeclaration: false,
|
|
67
|
-
ObjectExpression: false,
|
|
68
|
-
ObjectPattern: false,
|
|
69
|
-
VariableDeclaration: false,
|
|
70
|
-
NewExpression: false,
|
|
71
|
-
},
|
|
72
|
-
},
|
|
73
|
-
],
|
|
74
|
-
|
|
75
|
-
// disallow padding inside computed properties
|
|
76
|
-
'computed-property-spacing': ['error', 'never'],
|
|
77
|
-
|
|
78
|
-
// enforces consistent naming when capturing the current execution context
|
|
79
|
-
'consistent-this': 'off',
|
|
80
|
-
|
|
81
|
-
// enforce newline at the end of file, with no multiple empty lines
|
|
82
|
-
'eol-last': ['error', 'always'],
|
|
83
|
-
|
|
84
|
-
// https://eslint.org/docs/rules/function-call-argument-newline
|
|
85
|
-
'function-call-argument-newline': ['error', 'consistent'],
|
|
86
|
-
|
|
87
|
-
// enforce spacing between functions and their invocations
|
|
88
|
-
// https://eslint.org/docs/rules/func-call-spacing
|
|
89
|
-
'func-call-spacing': ['error', 'never'],
|
|
90
|
-
|
|
91
|
-
// requires function names to match the name of the variable or property to which they are
|
|
92
|
-
// assigned
|
|
93
|
-
// https://eslint.org/docs/rules/func-name-matching
|
|
94
|
-
'func-name-matching': [
|
|
95
|
-
'off', 'always', {
|
|
96
|
-
includeCommonJSModuleExports: false,
|
|
97
|
-
considerPropertyDescriptor: true,
|
|
98
|
-
},
|
|
99
|
-
],
|
|
100
|
-
|
|
101
|
-
// require function expressions to have a name
|
|
102
|
-
// https://eslint.org/docs/rules/func-names
|
|
103
3
|
'func-names': 'warn',
|
|
104
|
-
|
|
105
|
-
// enforces use of function declarations or expressions
|
|
106
|
-
// https://eslint.org/docs/rules/func-style
|
|
107
|
-
// TODO: enable
|
|
108
|
-
'func-style': ['off', 'expression'],
|
|
109
|
-
|
|
110
|
-
// require line breaks inside function parentheses if there are line breaks between parameters
|
|
111
|
-
// https://eslint.org/docs/rules/function-paren-newline
|
|
112
|
-
'function-paren-newline': ['error', 'multiline-arguments'],
|
|
113
|
-
|
|
114
|
-
// disallow specified identifiers
|
|
115
|
-
// https://eslint.org/docs/rules/id-denylist
|
|
116
|
-
'id-denylist': 'off',
|
|
117
|
-
|
|
118
|
-
// this option enforces minimum and maximum identifier lengths
|
|
119
|
-
// (variable names, property names etc.)
|
|
120
|
-
'id-length': 'off',
|
|
121
|
-
|
|
122
|
-
// require identifiers to match the provided regular expression
|
|
123
|
-
'id-match': 'off',
|
|
124
|
-
|
|
125
|
-
// Enforce the location of arrow function bodies with implicit returns
|
|
126
|
-
// https://eslint.org/docs/rules/implicit-arrow-linebreak
|
|
127
|
-
'implicit-arrow-linebreak': ['error', 'beside'],
|
|
128
|
-
|
|
129
|
-
// this option sets a specific tab width for your code
|
|
130
|
-
// https://eslint.org/docs/rules/indent
|
|
131
|
-
indent: [
|
|
132
|
-
'error', 2, {
|
|
133
|
-
SwitchCase: 1,
|
|
134
|
-
VariableDeclarator: 1,
|
|
135
|
-
outerIIFEBody: 1,
|
|
136
|
-
// MemberExpression: null,
|
|
137
|
-
FunctionDeclaration: {
|
|
138
|
-
parameters: 1,
|
|
139
|
-
body: 1,
|
|
140
|
-
},
|
|
141
|
-
FunctionExpression: {
|
|
142
|
-
parameters: 1,
|
|
143
|
-
body: 1,
|
|
144
|
-
},
|
|
145
|
-
CallExpression: {
|
|
146
|
-
arguments: 1,
|
|
147
|
-
},
|
|
148
|
-
ArrayExpression: 1,
|
|
149
|
-
ObjectExpression: 1,
|
|
150
|
-
ImportDeclaration: 1,
|
|
151
|
-
flatTernaryExpressions: false,
|
|
152
|
-
// list derived from https://github.com/benjamn/ast-types/blob/HEAD/def/jsx.js
|
|
153
|
-
ignoredNodes: ['JSXElement', 'JSXElement > *', 'JSXAttribute', 'JSXIdentifier', 'JSXNamespacedName', 'JSXMemberExpression', 'JSXSpreadAttribute', 'JSXExpressionContainer', 'JSXOpeningElement', 'JSXClosingElement', 'JSXFragment', 'JSXOpeningFragment', 'JSXClosingFragment', 'JSXText', 'JSXEmptyExpression', 'JSXSpreadChild'],
|
|
154
|
-
ignoreComments: false,
|
|
155
|
-
},
|
|
156
|
-
],
|
|
157
|
-
|
|
158
|
-
// specify whether double or single quotes should be used in JSX attributes
|
|
159
|
-
// https://eslint.org/docs/rules/jsx-quotes
|
|
160
|
-
'jsx-quotes': ['off', 'prefer-double'],
|
|
161
|
-
|
|
162
|
-
// enforces spacing between keys and values in object literal properties
|
|
163
|
-
'key-spacing': ['error', { beforeColon: false, afterColon: true }],
|
|
164
|
-
|
|
165
|
-
// require a space before & after certain keywords
|
|
166
|
-
'keyword-spacing': [
|
|
167
|
-
'error', {
|
|
168
|
-
before: true,
|
|
169
|
-
after: true,
|
|
170
|
-
overrides: {
|
|
171
|
-
return: { after: true },
|
|
172
|
-
throw: { after: true },
|
|
173
|
-
case: { after: true },
|
|
174
|
-
},
|
|
175
|
-
},
|
|
176
|
-
],
|
|
177
|
-
|
|
178
|
-
// enforce position of line comments
|
|
179
|
-
// https://eslint.org/docs/rules/line-comment-position
|
|
180
|
-
// TODO: enable?
|
|
181
|
-
'line-comment-position': [
|
|
182
|
-
'off', {
|
|
183
|
-
position: 'above',
|
|
184
|
-
ignorePattern: '',
|
|
185
|
-
applyDefaultPatterns: true,
|
|
186
|
-
},
|
|
187
|
-
],
|
|
188
|
-
|
|
189
|
-
// disallow mixed 'LF' and 'CRLF' as linebreaks
|
|
190
|
-
// https://eslint.org/docs/rules/linebreak-style
|
|
191
|
-
'linebreak-style': ['error', 'unix'],
|
|
192
|
-
|
|
193
|
-
// require or disallow an empty line between class members
|
|
194
|
-
// https://eslint.org/docs/rules/lines-between-class-members
|
|
195
|
-
'lines-between-class-members': ['error', 'always', { exceptAfterSingleLine: false }],
|
|
196
|
-
|
|
197
|
-
// enforces empty lines around comments
|
|
198
|
-
'lines-around-comment': 'off',
|
|
199
|
-
|
|
200
|
-
// require or disallow newlines around directives
|
|
201
|
-
// https://eslint.org/docs/rules/lines-around-directive
|
|
202
4
|
'lines-around-directive': [
|
|
203
5
|
'error', {
|
|
204
6
|
before: 'always',
|
|
205
7
|
after: 'always',
|
|
206
8
|
},
|
|
207
9
|
],
|
|
208
|
-
|
|
209
|
-
// Require or disallow logical assignment logical operator shorthand
|
|
210
|
-
// https://eslint.org/docs/latest/rules/logical-assignment-operators
|
|
211
|
-
// TODO, semver-major: enable
|
|
212
|
-
'logical-assignment-operators': [
|
|
213
|
-
'off', 'always', {
|
|
214
|
-
enforceForIfStatements: true,
|
|
215
|
-
},
|
|
216
|
-
],
|
|
217
|
-
|
|
218
|
-
// specify the maximum depth that blocks can be nested
|
|
219
|
-
'max-depth': ['off', 4],
|
|
220
|
-
|
|
221
|
-
// specify the maximum length of a line in your program
|
|
222
|
-
// https://eslint.org/docs/rules/max-len
|
|
223
|
-
'max-len': [
|
|
224
|
-
'error', 100, 2, {
|
|
225
|
-
ignoreUrls: true,
|
|
226
|
-
ignoreComments: false,
|
|
227
|
-
ignoreRegExpLiterals: true,
|
|
228
|
-
ignoreStrings: true,
|
|
229
|
-
ignoreTemplateLiterals: true,
|
|
230
|
-
},
|
|
231
|
-
],
|
|
232
|
-
|
|
233
|
-
// specify the max number of lines in a file
|
|
234
|
-
// https://eslint.org/docs/rules/max-lines
|
|
235
|
-
'max-lines': [
|
|
236
|
-
'off', {
|
|
237
|
-
max: 300,
|
|
238
|
-
skipBlankLines: true,
|
|
239
|
-
skipComments: true,
|
|
240
|
-
},
|
|
241
|
-
],
|
|
242
|
-
|
|
243
|
-
// enforce a maximum function length
|
|
244
|
-
// https://eslint.org/docs/rules/max-lines-per-function
|
|
245
10
|
'max-lines-per-function': [
|
|
246
11
|
'off', {
|
|
247
12
|
max: 50,
|
|
@@ -250,30 +15,6 @@ export const style = {
|
|
|
250
15
|
IIFEs: true,
|
|
251
16
|
},
|
|
252
17
|
],
|
|
253
|
-
|
|
254
|
-
// specify the maximum depth callbacks can be nested
|
|
255
|
-
'max-nested-callbacks': 'off',
|
|
256
|
-
|
|
257
|
-
// limits the number of parameters that can be used in the function declaration.
|
|
258
|
-
'max-params': ['off', 3],
|
|
259
|
-
|
|
260
|
-
// specify the maximum number of statement allowed in a function
|
|
261
|
-
'max-statements': ['off', 10],
|
|
262
|
-
|
|
263
|
-
// restrict the number of statements per line
|
|
264
|
-
// https://eslint.org/docs/rules/max-statements-per-line
|
|
265
|
-
'max-statements-per-line': ['off', { max: 1 }],
|
|
266
|
-
|
|
267
|
-
// enforce a particular style for multiline comments
|
|
268
|
-
// https://eslint.org/docs/rules/multiline-comment-style
|
|
269
|
-
'multiline-comment-style': ['off', 'starred-block'],
|
|
270
|
-
|
|
271
|
-
// require multiline ternary
|
|
272
|
-
// https://eslint.org/docs/rules/multiline-ternary
|
|
273
|
-
// TODO: enable?
|
|
274
|
-
'multiline-ternary': ['off', 'never'],
|
|
275
|
-
|
|
276
|
-
// require a capital letter for constructors
|
|
277
18
|
'new-cap': [
|
|
278
19
|
'error', {
|
|
279
20
|
newIsCap: true,
|
|
@@ -282,128 +23,13 @@ export const style = {
|
|
|
282
23
|
capIsNewExceptions: ['Immutable.Map', 'Immutable.Set', 'Immutable.List'],
|
|
283
24
|
},
|
|
284
25
|
],
|
|
285
|
-
|
|
286
|
-
// disallow the omission of parentheses when invoking a constructor with no arguments
|
|
287
|
-
// https://eslint.org/docs/rules/new-parens
|
|
288
|
-
'new-parens': 'error',
|
|
289
|
-
|
|
290
|
-
// allow/disallow an empty newline after var statement
|
|
291
|
-
'newline-after-var': 'off',
|
|
292
|
-
|
|
293
|
-
// https://eslint.org/docs/rules/newline-before-return
|
|
294
|
-
'newline-before-return': 'off',
|
|
295
|
-
|
|
296
|
-
// enforces new line after each method call in the chain to make it
|
|
297
|
-
// more readable and easy to maintain
|
|
298
|
-
// https://eslint.org/docs/rules/newline-per-chained-call
|
|
299
|
-
'newline-per-chained-call': ['error', { ignoreChainWithDepth: 4 }],
|
|
300
|
-
|
|
301
|
-
// disallow use of the Array constructor
|
|
302
26
|
'no-array-constructor': 'error',
|
|
303
|
-
|
|
304
|
-
// disallow use of bitwise operators
|
|
305
|
-
// https://eslint.org/docs/rules/no-bitwise
|
|
306
27
|
'no-bitwise': 'error',
|
|
307
|
-
|
|
308
|
-
// disallow use of the continue statement
|
|
309
|
-
// https://eslint.org/docs/rules/no-continue
|
|
310
|
-
'no-continue': 'error',
|
|
311
|
-
|
|
312
|
-
// disallow comments inline after code
|
|
313
|
-
'no-inline-comments': 'off',
|
|
314
|
-
|
|
315
|
-
// disallow if as the only statement in an else block
|
|
316
|
-
// https://eslint.org/docs/rules/no-lonely-if
|
|
317
28
|
'no-lonely-if': 'error',
|
|
318
|
-
|
|
319
|
-
// disallow un-paren'd mixes of different operators
|
|
320
|
-
// https://eslint.org/docs/rules/no-mixed-operators
|
|
321
|
-
'no-mixed-operators': [
|
|
322
|
-
'error', {
|
|
323
|
-
// the list of arithmetic groups disallows mixing `%` and `**`
|
|
324
|
-
// with other arithmetic operators.
|
|
325
|
-
groups: [
|
|
326
|
-
['%', '**'],
|
|
327
|
-
['%', '+'],
|
|
328
|
-
['%', '-'],
|
|
329
|
-
['%', '*'],
|
|
330
|
-
['%', '/'],
|
|
331
|
-
['/', '*'],
|
|
332
|
-
['&', '|', '<<', '>>', '>>>'],
|
|
333
|
-
['==', '!=', '===', '!=='],
|
|
334
|
-
['&&', '||'],
|
|
335
|
-
],
|
|
336
|
-
allowSamePrecedence: false,
|
|
337
|
-
},
|
|
338
|
-
],
|
|
339
|
-
|
|
340
|
-
// disallow mixed spaces and tabs for indentation
|
|
341
|
-
'no-mixed-spaces-and-tabs': 'error',
|
|
342
|
-
|
|
343
|
-
// disallow use of chained assignment expressions
|
|
344
|
-
// https://eslint.org/docs/rules/no-multi-assign
|
|
345
29
|
'no-multi-assign': ['error'],
|
|
346
|
-
|
|
347
|
-
// disallow multiple empty lines, only one newline at the end, and no new lines at the beginning
|
|
348
|
-
// https://eslint.org/docs/rules/no-multiple-empty-lines
|
|
349
|
-
'no-multiple-empty-lines': ['error', { max: 1, maxBOF: 0, maxEOF: 0 }],
|
|
350
|
-
|
|
351
|
-
// disallow negated conditions
|
|
352
|
-
// https://eslint.org/docs/rules/no-negated-condition
|
|
353
|
-
'no-negated-condition': 'off',
|
|
354
|
-
|
|
355
|
-
// disallow nested ternary expressions
|
|
356
30
|
'no-nested-ternary': 'error',
|
|
357
|
-
|
|
358
|
-
// disallow use of the Object constructor
|
|
359
31
|
'no-new-object': 'error',
|
|
360
|
-
|
|
361
|
-
// disallow use of unary operators, ++ and --
|
|
362
|
-
// https://eslint.org/docs/rules/no-plusplus
|
|
363
|
-
'no-plusplus': 'error',
|
|
364
|
-
|
|
365
|
-
// disallow certain syntax forms
|
|
366
|
-
// https://eslint.org/docs/rules/no-restricted-syntax
|
|
367
|
-
'no-restricted-syntax': [
|
|
368
|
-
'error',
|
|
369
|
-
{
|
|
370
|
-
selector: 'ForInStatement',
|
|
371
|
-
message: 'for..in loops iterate over the entire prototype chain, which is virtually never what you want. Use Object.{keys,values,entries}, and iterate over the resulting array.',
|
|
372
|
-
},
|
|
373
|
-
{
|
|
374
|
-
selector: 'ForOfStatement',
|
|
375
|
-
message: 'iterators/generators require regenerator-runtime, which is too heavyweight for this guide to allow them. Separately, loops should be avoided in favor of array iterations.',
|
|
376
|
-
},
|
|
377
|
-
{
|
|
378
|
-
selector: 'LabeledStatement',
|
|
379
|
-
message: 'Labels are a form of GOTO; using them makes code confusing and hard to maintain and understand.',
|
|
380
|
-
},
|
|
381
|
-
{
|
|
382
|
-
selector: 'WithStatement',
|
|
383
|
-
message: '`with` is disallowed in strict mode because it makes code impossible to predict and optimize.',
|
|
384
|
-
},
|
|
385
|
-
],
|
|
386
|
-
|
|
387
|
-
// disallow space between function identifier and application
|
|
388
|
-
// deprecated in favor of func-call-spacing
|
|
389
32
|
'no-spaced-func': 'off',
|
|
390
|
-
|
|
391
|
-
// disallow tab characters entirely
|
|
392
|
-
'no-tabs': 'error',
|
|
393
|
-
|
|
394
|
-
// disallow the use of ternary operators
|
|
395
|
-
'no-ternary': 'off',
|
|
396
|
-
|
|
397
|
-
// disallow trailing whitespace at the end of lines
|
|
398
|
-
'no-trailing-spaces': [
|
|
399
|
-
'error', {
|
|
400
|
-
skipBlankLines: false,
|
|
401
|
-
ignoreComments: false,
|
|
402
|
-
},
|
|
403
|
-
],
|
|
404
|
-
|
|
405
|
-
// disallow dangling underscores in identifiers
|
|
406
|
-
// https://eslint.org/docs/rules/no-underscore-dangle
|
|
407
33
|
'no-underscore-dangle': [
|
|
408
34
|
'error', {
|
|
409
35
|
allow: [],
|
|
@@ -412,59 +38,12 @@ export const style = {
|
|
|
412
38
|
enforceInMethodNames: true,
|
|
413
39
|
},
|
|
414
40
|
],
|
|
415
|
-
|
|
416
|
-
// disallow the use of Boolean literals in conditional expressions
|
|
417
|
-
// also, prefer `a || b` over `a ? a : b`
|
|
418
|
-
// https://eslint.org/docs/rules/no-unneeded-ternary
|
|
419
41
|
'no-unneeded-ternary': ['error', { defaultAssignment: false }],
|
|
420
|
-
|
|
421
|
-
// disallow whitespace before properties
|
|
422
|
-
// https://eslint.org/docs/rules/no-whitespace-before-property
|
|
423
|
-
'no-whitespace-before-property': 'error',
|
|
424
|
-
|
|
425
|
-
// enforce the location of single-line statements
|
|
426
|
-
// https://eslint.org/docs/rules/nonblock-statement-body-position
|
|
427
|
-
'nonblock-statement-body-position': ['error', 'beside', { overrides: {} }],
|
|
428
|
-
|
|
429
|
-
// require padding inside curly braces
|
|
430
|
-
'object-curly-spacing': ['error', 'always'],
|
|
431
|
-
|
|
432
|
-
// enforce line breaks between braces
|
|
433
|
-
// https://eslint.org/docs/rules/object-curly-newline
|
|
434
|
-
'object-curly-newline': [
|
|
435
|
-
'error', {
|
|
436
|
-
ObjectExpression: { minProperties: 4, multiline: true, consistent: true },
|
|
437
|
-
ObjectPattern: { minProperties: 4, multiline: true, consistent: true },
|
|
438
|
-
ImportDeclaration: { minProperties: 4, multiline: true, consistent: true },
|
|
439
|
-
ExportDeclaration: { minProperties: 4, multiline: true, consistent: true },
|
|
440
|
-
},
|
|
441
|
-
],
|
|
442
|
-
|
|
443
|
-
// enforce "same line" or "multiple line" on object properties.
|
|
444
|
-
// https://eslint.org/docs/rules/object-property-newline
|
|
445
|
-
'object-property-newline': [
|
|
446
|
-
'error', {
|
|
447
|
-
allowAllPropertiesOnSameLine: true,
|
|
448
|
-
},
|
|
449
|
-
],
|
|
450
|
-
|
|
451
|
-
// allow just one var statement per function
|
|
452
42
|
'one-var': ['error', 'never'],
|
|
453
|
-
|
|
454
|
-
// require a newline around variable declaration
|
|
455
|
-
// https://eslint.org/docs/rules/one-var-declaration-per-line
|
|
456
|
-
'one-var-declaration-per-line': ['error', 'always'],
|
|
457
|
-
|
|
458
|
-
// require assignment operator shorthand where possible or prohibit it entirely
|
|
459
|
-
// https://eslint.org/docs/rules/operator-assignment
|
|
43
|
+
'@stylistic/one-var-declaration-per-line': ['error', 'always'],
|
|
460
44
|
'operator-assignment': ['error', 'always'],
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
// https://eslint.org/docs/rules/operator-linebreak
|
|
464
|
-
'operator-linebreak': ['error', 'before', { overrides: { '=': 'none' } }],
|
|
465
|
-
|
|
466
|
-
// disallow padding within blocks
|
|
467
|
-
'padded-blocks': [
|
|
45
|
+
'@stylistic/operator-linebreak': ['error', 'before', { overrides: { '=': 'none' } }],
|
|
46
|
+
'@stylistic/padded-blocks': [
|
|
468
47
|
'error', {
|
|
469
48
|
blocks: 'never',
|
|
470
49
|
classes: 'never',
|
|
@@ -473,104 +52,7 @@ export const style = {
|
|
|
473
52
|
allowSingleLineBlocks: true,
|
|
474
53
|
},
|
|
475
54
|
],
|
|
476
|
-
|
|
477
|
-
// Require or disallow padding lines between statements
|
|
478
|
-
// https://eslint.org/docs/rules/padding-line-between-statements
|
|
479
|
-
'padding-line-between-statements': 'off',
|
|
480
|
-
|
|
481
|
-
// Disallow the use of Math.pow in favor of the ** operator
|
|
482
|
-
// https://eslint.org/docs/rules/prefer-exponentiation-operator
|
|
483
55
|
'prefer-exponentiation-operator': 'error',
|
|
484
|
-
|
|
485
|
-
// Prefer use of an object spread over Object.assign
|
|
486
|
-
// https://eslint.org/docs/rules/prefer-object-spread
|
|
487
56
|
'prefer-object-spread': 'error',
|
|
488
|
-
|
|
489
|
-
// require quotes around object literal property names
|
|
490
|
-
// https://eslint.org/docs/rules/quote-props.html
|
|
491
|
-
'quote-props': ['error', 'as-needed', { keywords: false, unnecessary: true, numbers: false }],
|
|
492
|
-
|
|
493
|
-
// specify whether double or single quotes should be used
|
|
494
|
-
quotes: ['error', 'single', { avoidEscape: true }],
|
|
495
|
-
|
|
496
|
-
// do not require jsdoc
|
|
497
|
-
// https://eslint.org/docs/rules/require-jsdoc
|
|
498
|
-
'require-jsdoc': 'off',
|
|
499
|
-
|
|
500
|
-
// require or disallow use of semicolons instead of ASI
|
|
501
|
-
semi: ['error', 'always'],
|
|
502
|
-
|
|
503
|
-
// enforce spacing before and after semicolons
|
|
504
|
-
'semi-spacing': ['error', { before: false, after: true }],
|
|
505
|
-
|
|
506
|
-
// Enforce location of semicolons
|
|
507
|
-
// https://eslint.org/docs/rules/semi-style
|
|
508
|
-
'semi-style': ['error', 'last'],
|
|
509
|
-
|
|
510
|
-
// requires object keys to be sorted
|
|
511
|
-
'sort-keys': ['off', 'asc', { caseSensitive: false, natural: true }],
|
|
512
|
-
|
|
513
|
-
// sort variables within the same declaration block
|
|
514
|
-
'sort-vars': 'off',
|
|
515
|
-
|
|
516
|
-
// require or disallow space before blocks
|
|
517
|
-
'space-before-blocks': 'error',
|
|
518
|
-
|
|
519
|
-
// require or disallow space before function opening parenthesis
|
|
520
|
-
// https://eslint.org/docs/rules/space-before-function-paren
|
|
521
|
-
'space-before-function-paren': [
|
|
522
|
-
'error', {
|
|
523
|
-
anonymous: 'always',
|
|
524
|
-
named: 'never',
|
|
525
|
-
asyncArrow: 'always',
|
|
526
|
-
},
|
|
527
|
-
],
|
|
528
|
-
|
|
529
|
-
// require or disallow spaces inside parentheses
|
|
530
|
-
'space-in-parens': ['error', 'never'],
|
|
531
|
-
|
|
532
|
-
// require spaces around operators
|
|
533
|
-
'space-infix-ops': 'error',
|
|
534
|
-
|
|
535
|
-
// Require or disallow spaces before/after unary operators
|
|
536
|
-
// https://eslint.org/docs/rules/space-unary-ops
|
|
537
|
-
'space-unary-ops': [
|
|
538
|
-
'error', {
|
|
539
|
-
words: true,
|
|
540
|
-
nonwords: false,
|
|
541
|
-
overrides: {
|
|
542
|
-
},
|
|
543
|
-
},
|
|
544
|
-
],
|
|
545
|
-
|
|
546
|
-
// require or disallow a space immediately following the // or /* in a comment
|
|
547
|
-
// https://eslint.org/docs/rules/spaced-comment
|
|
548
|
-
'spaced-comment': [
|
|
549
|
-
'error', 'always', {
|
|
550
|
-
line: {
|
|
551
|
-
exceptions: ['-', '+'],
|
|
552
|
-
markers: ['=', '!', '/'], // space here to support sprockets directives, slash for TS /// comments
|
|
553
|
-
},
|
|
554
|
-
block: {
|
|
555
|
-
exceptions: ['-', '+'],
|
|
556
|
-
markers: ['=', '!', ':', '::'], // space here to support sprockets directives and flow comment types
|
|
557
|
-
balanced: true,
|
|
558
|
-
},
|
|
559
|
-
},
|
|
560
|
-
],
|
|
561
|
-
|
|
562
|
-
// Enforce spacing around colons of switch statements
|
|
563
|
-
// https://eslint.org/docs/rules/switch-colon-spacing
|
|
564
|
-
'switch-colon-spacing': ['error', { after: true, before: false }],
|
|
565
|
-
|
|
566
|
-
// Require or disallow spacing between template tags and their literals
|
|
567
|
-
// https://eslint.org/docs/rules/template-tag-spacing
|
|
568
|
-
'template-tag-spacing': ['error', 'never'],
|
|
569
|
-
|
|
570
|
-
// require or disallow the Unicode Byte Order Mark
|
|
571
|
-
// https://eslint.org/docs/rules/unicode-bom
|
|
572
57
|
'unicode-bom': ['error', 'never'],
|
|
573
|
-
|
|
574
|
-
// require regex literals to be wrapped in parentheses
|
|
575
|
-
'wrap-regex': 'off',
|
|
576
58
|
};
|
package/airbnb/variables.js
CHANGED
|
@@ -1,18 +1,5 @@
|
|
|
1
1
|
export const variables = {
|
|
2
|
-
// enforce or disallow variable initializations at definition
|
|
3
|
-
'init-declarations': 'off',
|
|
4
|
-
|
|
5
|
-
// disallow the catch clause parameter name being the same as a variable in the outer scope
|
|
6
|
-
'no-catch-shadow': 'off',
|
|
7
|
-
|
|
8
|
-
// disallow deletion of variables
|
|
9
|
-
'no-delete-var': 'error',
|
|
10
|
-
|
|
11
|
-
// disallow labels that share a name with a variable
|
|
12
|
-
// https://eslint.org/docs/rules/no-label-var
|
|
13
2
|
'no-label-var': 'error',
|
|
14
|
-
|
|
15
|
-
// disallow specific globals
|
|
16
3
|
'no-restricted-globals': [
|
|
17
4
|
'error',
|
|
18
5
|
{
|
|
@@ -26,27 +13,9 @@ export const variables = {
|
|
|
26
13
|
'Use Number.isNaN instead https://github.com/airbnb/javascript#standard-library--isnan',
|
|
27
14
|
},
|
|
28
15
|
],
|
|
29
|
-
|
|
30
|
-
// disallow declaration of variables already declared in the outer scope
|
|
31
16
|
'no-shadow': 'error',
|
|
32
|
-
|
|
33
|
-
// disallow shadowing of names such as arguments
|
|
34
|
-
'no-shadow-restricted-names': 'error',
|
|
35
|
-
|
|
36
|
-
// disallow use of undeclared variables unless mentioned in a /*global */ block
|
|
37
|
-
'no-undef': 'error',
|
|
38
|
-
|
|
39
|
-
// disallow use of undefined when initializing variables
|
|
40
17
|
'no-undef-init': 'error',
|
|
41
|
-
|
|
42
|
-
// disallow use of undefined variable
|
|
43
|
-
// https://eslint.org/docs/rules/no-undefined
|
|
44
|
-
// TODO: enable?
|
|
45
|
-
'no-undefined': 'off',
|
|
46
|
-
|
|
47
|
-
// disallow declaration of variables that are not used in the code
|
|
18
|
+
'no-undefined': 'error',
|
|
48
19
|
'no-unused-vars': ['error', { vars: 'all', args: 'after-used', ignoreRestSiblings: true }],
|
|
49
|
-
|
|
50
|
-
// disallow use of variables before they are defined
|
|
51
20
|
'no-use-before-define': ['error', { functions: true, classes: true, variables: true }],
|
|
52
21
|
};
|
package/base.js
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
import { FlatCompat } from '@eslint/eslintrc';
|
|
2
1
|
import importPlugin from 'eslint-plugin-import';
|
|
3
2
|
import promise from 'eslint-plugin-promise';
|
|
4
3
|
import array from 'eslint-plugin-array-func';
|
|
4
|
+
import stylistic from '@stylistic/eslint-plugin';
|
|
5
|
+
import eslintJs from '@eslint/js';
|
|
6
|
+
import { configs as regexpConfig } from 'eslint-plugin-regexp';
|
|
5
7
|
import { rules as PromiseRules } from './plugin-rules/promise.js';
|
|
8
|
+
import { rules as StyleRules } from './plugin-rules/stylistic.js';
|
|
6
9
|
import { bestPractices } from './airbnb/best-practices.js';
|
|
7
10
|
import { errors } from './airbnb/errors.js';
|
|
8
11
|
import { style } from './airbnb/style.js';
|
|
@@ -10,8 +13,6 @@ import { variables } from './airbnb/variables.js';
|
|
|
10
13
|
import { es6 } from './airbnb/es6.js';
|
|
11
14
|
import { imports } from './plugin-rules/imports.js';
|
|
12
15
|
|
|
13
|
-
const compat = new FlatCompat();
|
|
14
|
-
|
|
15
16
|
export default [
|
|
16
17
|
{
|
|
17
18
|
languageOptions: {
|
|
@@ -31,8 +32,10 @@ export default [
|
|
|
31
32
|
},
|
|
32
33
|
},
|
|
33
34
|
},
|
|
35
|
+
stylistic.configs.customize(),
|
|
36
|
+
eslintJs.configs.recommended,
|
|
34
37
|
array.configs.all,
|
|
35
|
-
|
|
38
|
+
regexpConfig['flat/recommended'],
|
|
36
39
|
{
|
|
37
40
|
rules: {
|
|
38
41
|
...bestPractices,
|
|
@@ -48,10 +51,9 @@ export default [
|
|
|
48
51
|
'import/prefer-default-export': 'off',
|
|
49
52
|
'import/no-default-export': 'error',
|
|
50
53
|
'max-lines': ['error', { max: 500, skipComments: true }],
|
|
51
|
-
// https://github.com/airbnb/javascript/blob/master/packages/eslint-config-airbnb-base/rules/style.js#L6
|
|
52
|
-
'array-bracket-newline': 'error',
|
|
53
54
|
'array-func/prefer-array-from': 'off',
|
|
54
55
|
...PromiseRules,
|
|
56
|
+
...StyleRules,
|
|
55
57
|
},
|
|
56
58
|
},
|
|
57
59
|
];
|