lint-rules-alvin 1.0.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/.vscode/settings.json +9 -0
- package/README.md +13 -0
- package/eslint/configs/astro.js +31 -0
- package/eslint/configs/base.js +22 -0
- package/eslint/configs/custom.js +45 -0
- package/eslint/configs/importX.js +77 -0
- package/eslint/configs/importXTs.js +22 -0
- package/eslint/configs/index.d.ts +12 -0
- package/eslint/configs/index.js +10 -0
- package/eslint/configs/json.js +22 -0
- package/eslint/configs/markdown.js +10 -0
- package/eslint/configs/reactHooks.js +8 -0
- package/eslint/configs/stylistic.js +490 -0
- package/eslint/configs/typescript.js +398 -0
- package/eslint/custom_rules/chain-first-on-newline.js +174 -0
- package/eslint/custom_rules/jsx-multiline-prop-newline.js +99 -0
- package/eslint/custom_rules/jsx-no-single-object-curly-newline.js +100 -0
- package/eslint/custom_rules/max-chain-per-line.js +149 -0
- package/eslint/custom_rules/multiline-paren-newline.js +153 -0
- package/eslint/custom_rules/newline-between-imports.js +77 -0
- package/eslint/custom_rules/unnamed-imports-last.js +84 -0
- package/eslint/presets/astroReact.js +33 -0
- package/eslint/presets/astroReactTs.js +39 -0
- package/eslint/presets/index.d.ts +14 -0
- package/eslint/presets/index.js +2 -0
- package/eslint.config.js +17 -0
- package/package.json +57 -0
|
@@ -0,0 +1,490 @@
|
|
|
1
|
+
import eslintPluginStylistic from '@stylistic/eslint-plugin';
|
|
2
|
+
|
|
3
|
+
export const stylistic = {
|
|
4
|
+
name: 'eslint-plugin-stylistic',
|
|
5
|
+
...eslintPluginStylistic.configs.recommended,
|
|
6
|
+
plugins: { '@stylistic': eslintPluginStylistic },
|
|
7
|
+
rules: {
|
|
8
|
+
'@stylistic/array-bracket-newline': [
|
|
9
|
+
'error',
|
|
10
|
+
{
|
|
11
|
+
multiline: true,
|
|
12
|
+
minItems: 2
|
|
13
|
+
}
|
|
14
|
+
],
|
|
15
|
+
'@stylistic/array-bracket-spacing': [
|
|
16
|
+
'error',
|
|
17
|
+
'always'
|
|
18
|
+
],
|
|
19
|
+
'@stylistic/array-element-newline': [
|
|
20
|
+
'error',
|
|
21
|
+
{
|
|
22
|
+
consistent: true,
|
|
23
|
+
multiline: true,
|
|
24
|
+
minItems: 2
|
|
25
|
+
}
|
|
26
|
+
],
|
|
27
|
+
'@stylistic/arrow-parens': [
|
|
28
|
+
'error',
|
|
29
|
+
'always'
|
|
30
|
+
],
|
|
31
|
+
'@stylistic/arrow-spacing': [
|
|
32
|
+
'error',
|
|
33
|
+
{
|
|
34
|
+
before: true,
|
|
35
|
+
after: true
|
|
36
|
+
}
|
|
37
|
+
],
|
|
38
|
+
'@stylistic/block-spacing': [
|
|
39
|
+
'error',
|
|
40
|
+
'always'
|
|
41
|
+
],
|
|
42
|
+
'@stylistic/brace-style': [
|
|
43
|
+
'error',
|
|
44
|
+
'1tbs',
|
|
45
|
+
{ allowSingleLine: false }
|
|
46
|
+
],
|
|
47
|
+
'@stylistic/comma-dangle': [
|
|
48
|
+
'error',
|
|
49
|
+
'never'
|
|
50
|
+
],
|
|
51
|
+
'@stylistic/comma-spacing': [
|
|
52
|
+
'error',
|
|
53
|
+
{
|
|
54
|
+
before: false,
|
|
55
|
+
after: true
|
|
56
|
+
}
|
|
57
|
+
],
|
|
58
|
+
'@stylistic/comma-style': [
|
|
59
|
+
'error',
|
|
60
|
+
'last'
|
|
61
|
+
],
|
|
62
|
+
'@stylistic/computed-property-spacing': [
|
|
63
|
+
'error',
|
|
64
|
+
'never',
|
|
65
|
+
{ enforceForClassMembers: true }
|
|
66
|
+
],
|
|
67
|
+
'@stylistic/curly-newline': [
|
|
68
|
+
'error',
|
|
69
|
+
{
|
|
70
|
+
multiline: true,
|
|
71
|
+
minElements: 2,
|
|
72
|
+
consistent: true
|
|
73
|
+
}
|
|
74
|
+
],
|
|
75
|
+
'@stylistic/dot-location': [
|
|
76
|
+
'error',
|
|
77
|
+
'property'
|
|
78
|
+
],
|
|
79
|
+
'@stylistic/eol-last': [
|
|
80
|
+
'error',
|
|
81
|
+
'always'
|
|
82
|
+
],
|
|
83
|
+
'@stylistic/function-call-argument-newline': [
|
|
84
|
+
'error',
|
|
85
|
+
'always'
|
|
86
|
+
],
|
|
87
|
+
'@stylistic/function-call-spacing': [
|
|
88
|
+
'error',
|
|
89
|
+
'never'
|
|
90
|
+
],
|
|
91
|
+
'@stylistic/function-paren-newline': 'off',
|
|
92
|
+
'@stylistic/generator-star-spacing': [
|
|
93
|
+
'error',
|
|
94
|
+
'after'
|
|
95
|
+
],
|
|
96
|
+
'@stylistic/implicit-arrow-linebreak': [
|
|
97
|
+
'error',
|
|
98
|
+
'beside'
|
|
99
|
+
],
|
|
100
|
+
'@stylistic/indent': [
|
|
101
|
+
'error',
|
|
102
|
+
'tab'
|
|
103
|
+
],
|
|
104
|
+
'@stylistic/indent-binary-ops': [
|
|
105
|
+
'error',
|
|
106
|
+
'tab'
|
|
107
|
+
],
|
|
108
|
+
'@stylistic/jsx-child-element-spacing': [ 'error' ],
|
|
109
|
+
'@stylistic/jsx-closing-bracket-location': [
|
|
110
|
+
'error',
|
|
111
|
+
'tag-aligned'
|
|
112
|
+
],
|
|
113
|
+
'@stylistic/jsx-closing-tag-location': [
|
|
114
|
+
'error',
|
|
115
|
+
'line-aligned'
|
|
116
|
+
],
|
|
117
|
+
'@stylistic/jsx-curly-brace-presence': [
|
|
118
|
+
'error',
|
|
119
|
+
'always'
|
|
120
|
+
],
|
|
121
|
+
'@stylistic/jsx-curly-newline': [
|
|
122
|
+
'error',
|
|
123
|
+
{
|
|
124
|
+
multiline: 'consistent',
|
|
125
|
+
singleline: 'consistent'
|
|
126
|
+
}
|
|
127
|
+
],
|
|
128
|
+
'@stylistic/jsx-curly-spacing': [
|
|
129
|
+
'error',
|
|
130
|
+
{
|
|
131
|
+
when: 'never',
|
|
132
|
+
attributes: true,
|
|
133
|
+
children: true
|
|
134
|
+
}
|
|
135
|
+
],
|
|
136
|
+
'@stylistic/jsx-equals-spacing': [
|
|
137
|
+
'error',
|
|
138
|
+
'never'
|
|
139
|
+
],
|
|
140
|
+
'@stylistic/jsx-first-prop-new-line': [
|
|
141
|
+
'error',
|
|
142
|
+
'multiline-multiprop'
|
|
143
|
+
],
|
|
144
|
+
'@stylistic/jsx-function-call-newline': [
|
|
145
|
+
'error',
|
|
146
|
+
'multiline'
|
|
147
|
+
],
|
|
148
|
+
'@stylistic/jsx-indent': [ 'off' ],
|
|
149
|
+
'@stylistic/jsx-indent-props': [
|
|
150
|
+
'error',
|
|
151
|
+
'tab'
|
|
152
|
+
],
|
|
153
|
+
'@stylistic/jsx-max-props-per-line': [
|
|
154
|
+
'error',
|
|
155
|
+
{ maximum: 1 }
|
|
156
|
+
],
|
|
157
|
+
'@stylistic/jsx-newline': [
|
|
158
|
+
'error',
|
|
159
|
+
{
|
|
160
|
+
prevent: true,
|
|
161
|
+
allowMultilines: true
|
|
162
|
+
}
|
|
163
|
+
],
|
|
164
|
+
'@stylistic/jsx-one-expression-per-line': [
|
|
165
|
+
'error',
|
|
166
|
+
{ allow: 'none' }
|
|
167
|
+
],
|
|
168
|
+
'@stylistic/jsx-pascal-case': [ 'off' ],
|
|
169
|
+
'@stylistic/jsx-props-no-multi-spaces': [ 'off' ], // Off in favor for 'no-multi-spaces'
|
|
170
|
+
'@stylistic/jsx-quotes': [
|
|
171
|
+
'error',
|
|
172
|
+
'prefer-double'
|
|
173
|
+
],
|
|
174
|
+
'@stylistic/jsx-self-closing-comp': [
|
|
175
|
+
'error',
|
|
176
|
+
{ component: true }
|
|
177
|
+
],
|
|
178
|
+
'@stylistic/jsx-sort-props': [
|
|
179
|
+
'error',
|
|
180
|
+
{
|
|
181
|
+
ignoreCase: false,
|
|
182
|
+
callbacksLast: true,
|
|
183
|
+
shorthandFirst: true,
|
|
184
|
+
shorthandLast: false,
|
|
185
|
+
multiline: 'ignore',
|
|
186
|
+
noSortAlphabetically: true,
|
|
187
|
+
reservedFirst: true,
|
|
188
|
+
locale: 'en'
|
|
189
|
+
}
|
|
190
|
+
],
|
|
191
|
+
'@stylistic/jsx-tag-spacing': [
|
|
192
|
+
'error',
|
|
193
|
+
{
|
|
194
|
+
closingSlash: 'never',
|
|
195
|
+
beforeSelfClosing: 'always',
|
|
196
|
+
afterOpening: 'never',
|
|
197
|
+
beforeClosing: 'never'
|
|
198
|
+
}
|
|
199
|
+
],
|
|
200
|
+
'@stylistic/jsx-wrap-multilines': [
|
|
201
|
+
'error',
|
|
202
|
+
{
|
|
203
|
+
declaration: 'parens-new-line',
|
|
204
|
+
assignment: 'parens-new-line',
|
|
205
|
+
return: 'parens-new-line',
|
|
206
|
+
arrow: 'parens-new-line',
|
|
207
|
+
condition: 'parens',
|
|
208
|
+
logical: 'parens',
|
|
209
|
+
prop: 'parens-new-line',
|
|
210
|
+
propertyValue: 'parens'
|
|
211
|
+
}
|
|
212
|
+
],
|
|
213
|
+
'@stylistic/key-spacing': [
|
|
214
|
+
'error',
|
|
215
|
+
{
|
|
216
|
+
beforeColon: false,
|
|
217
|
+
afterColon: true,
|
|
218
|
+
mode: 'strict'
|
|
219
|
+
}
|
|
220
|
+
],
|
|
221
|
+
'@stylistic/line-comment-position': [ 'off' ],
|
|
222
|
+
'@stylistic/linebreak-style': [
|
|
223
|
+
'error',
|
|
224
|
+
'unix'
|
|
225
|
+
],
|
|
226
|
+
'@stylistic/lines-around-comment': [
|
|
227
|
+
'error',
|
|
228
|
+
{
|
|
229
|
+
beforeBlockComment: true,
|
|
230
|
+
afterBlockComment: false,
|
|
231
|
+
beforeLineComment: true,
|
|
232
|
+
afterLineComment: false,
|
|
233
|
+
allowBlockStart: false,
|
|
234
|
+
allowBlockEnd: false,
|
|
235
|
+
allowClassStart: false,
|
|
236
|
+
allowClassEnd: false,
|
|
237
|
+
allowObjectStart: false,
|
|
238
|
+
allowObjectEnd: false,
|
|
239
|
+
allowArrayStart: true,
|
|
240
|
+
allowArrayEnd: false,
|
|
241
|
+
applyDefaultIgnorePatterns: true,
|
|
242
|
+
afterHashbangComment: true
|
|
243
|
+
}
|
|
244
|
+
],
|
|
245
|
+
'@stylistic/lines-between-class-members': [
|
|
246
|
+
'error',
|
|
247
|
+
'always'
|
|
248
|
+
],
|
|
249
|
+
'@stylistic/max-len': [
|
|
250
|
+
'warn',
|
|
251
|
+
{
|
|
252
|
+
code: 120,
|
|
253
|
+
tabWidth: 2,
|
|
254
|
+
ignoreComments: false,
|
|
255
|
+
ignoreTrailingComments: false,
|
|
256
|
+
ignoreUrls: true,
|
|
257
|
+
ignoreStrings: false,
|
|
258
|
+
ignoreTemplateLiterals: true
|
|
259
|
+
}
|
|
260
|
+
],
|
|
261
|
+
'@stylistic/max-statements-per-line': [
|
|
262
|
+
'error',
|
|
263
|
+
{
|
|
264
|
+
max: 1,
|
|
265
|
+
ignoredNodes: [ 'BreakStatement' ]
|
|
266
|
+
}
|
|
267
|
+
],
|
|
268
|
+
'@stylistic/member-delimiter-style': [
|
|
269
|
+
'error',
|
|
270
|
+
{
|
|
271
|
+
multiline: {
|
|
272
|
+
delimiter: 'semi',
|
|
273
|
+
requireLast: true
|
|
274
|
+
},
|
|
275
|
+
singleline: {
|
|
276
|
+
delimiter: 'comma',
|
|
277
|
+
requireLast: false
|
|
278
|
+
},
|
|
279
|
+
multilineDetection: 'brackets'
|
|
280
|
+
}
|
|
281
|
+
],
|
|
282
|
+
'@stylistic/multiline-comment-style': [
|
|
283
|
+
'error',
|
|
284
|
+
'starred-block'
|
|
285
|
+
],
|
|
286
|
+
'@stylistic/multiline-ternary': [
|
|
287
|
+
'error',
|
|
288
|
+
'always'
|
|
289
|
+
],
|
|
290
|
+
'@stylistic/new-parens': [
|
|
291
|
+
'error',
|
|
292
|
+
'always'
|
|
293
|
+
],
|
|
294
|
+
|
|
295
|
+
/*
|
|
296
|
+
* '@stylistic/newline-per-chained-call': ['error', {
|
|
297
|
+
* ignoreChainWithDepth: 1 // currently 'broken', in favor of custom rule custom/newline-per-chained-call
|
|
298
|
+
* }],
|
|
299
|
+
*/
|
|
300
|
+
'@stylistic/no-confusing-arrow': [
|
|
301
|
+
'error',
|
|
302
|
+
{
|
|
303
|
+
allowParens: true,
|
|
304
|
+
onlyOneSimpleParam: false
|
|
305
|
+
}
|
|
306
|
+
],
|
|
307
|
+
'@stylistic/no-extra-parens': [
|
|
308
|
+
'error',
|
|
309
|
+
'all',
|
|
310
|
+
{
|
|
311
|
+
ignoreJSX: 'multi-line',
|
|
312
|
+
ignoredNodes: [
|
|
313
|
+
|
|
314
|
+
// Arrow function ternaries
|
|
315
|
+
'ArrowFunctionExpression[body.type="ConditionalExpression"]',
|
|
316
|
+
'ArrowFunctionExpression > ParenthesizedExpression > ConditionalExpression',
|
|
317
|
+
|
|
318
|
+
// Nested binary expressions (direct child)
|
|
319
|
+
'BinaryExpression > BinaryExpression',
|
|
320
|
+
|
|
321
|
+
// Triple-nested or deeply nested inside another expression
|
|
322
|
+
'BinaryExpression > BinaryExpression > BinaryExpression',
|
|
323
|
+
|
|
324
|
+
// Specifically ignore parenthesized binary expressions used as the RHS of assignments
|
|
325
|
+
'AssignmentExpression > ParenthesizedExpression > BinaryExpression',
|
|
326
|
+
|
|
327
|
+
// Also ignore parenthesized binary expressions used as operands of bitwise expressions
|
|
328
|
+
'BinaryExpression > ParenthesizedExpression > BinaryExpression'
|
|
329
|
+
|
|
330
|
+
]
|
|
331
|
+
}
|
|
332
|
+
],
|
|
333
|
+
'@stylistic/no-extra-semi': [ 'error' ],
|
|
334
|
+
'@stylistic/no-floating-decimal': [ 'error' ],
|
|
335
|
+
'@stylistic/no-mixed-operators': [ 'error' ],
|
|
336
|
+
'@stylistic/no-mixed-spaces-and-tabs': [
|
|
337
|
+
'error',
|
|
338
|
+
'smart-tabs'
|
|
339
|
+
],
|
|
340
|
+
'@stylistic/no-multi-spaces': [ 'error' ],
|
|
341
|
+
'@stylistic/no-multiple-empty-lines': [
|
|
342
|
+
'error',
|
|
343
|
+
{ max: 1 }
|
|
344
|
+
],
|
|
345
|
+
'@stylistic/no-tabs': [ 'off' ],
|
|
346
|
+
'@stylistic/no-trailing-spaces': [ 'error' ],
|
|
347
|
+
'@stylistic/no-whitespace-before-property': [ 'error' ],
|
|
348
|
+
'@stylistic/nonblock-statement-body-position': [
|
|
349
|
+
'error',
|
|
350
|
+
'below'
|
|
351
|
+
],
|
|
352
|
+
'@stylistic/object-curly-newline': [
|
|
353
|
+
'error',
|
|
354
|
+
{
|
|
355
|
+
multiline: true,
|
|
356
|
+
minProperties: 2,
|
|
357
|
+
consistent: false
|
|
358
|
+
}
|
|
359
|
+
],
|
|
360
|
+
'@stylistic/object-curly-spacing': [
|
|
361
|
+
'error',
|
|
362
|
+
'always'
|
|
363
|
+
],
|
|
364
|
+
'@stylistic/object-property-newline': [
|
|
365
|
+
'error',
|
|
366
|
+
{ allowAllPropertiesOnSameLine: false }
|
|
367
|
+
],
|
|
368
|
+
'@stylistic/one-var-declaration-per-line': [
|
|
369
|
+
'error',
|
|
370
|
+
'always'
|
|
371
|
+
],
|
|
372
|
+
'@stylistic/operator-linebreak': [
|
|
373
|
+
'error',
|
|
374
|
+
'before'
|
|
375
|
+
],
|
|
376
|
+
'@stylistic/padded-blocks': [
|
|
377
|
+
'error',
|
|
378
|
+
'always',
|
|
379
|
+
{ allowSingleLineBlocks: true }
|
|
380
|
+
],
|
|
381
|
+
'@stylistic/padding-line-between-statements': [ 'off' ],
|
|
382
|
+
'@stylistic/quote-props': [
|
|
383
|
+
'error',
|
|
384
|
+
'as-needed'
|
|
385
|
+
],
|
|
386
|
+
'@stylistic/quotes': [
|
|
387
|
+
'error',
|
|
388
|
+
'single',
|
|
389
|
+
{
|
|
390
|
+
avoidEscape: false,
|
|
391
|
+
allowTemplateLiterals: 'avoidEscape',
|
|
392
|
+
ignoreStringLiterals: false
|
|
393
|
+
}
|
|
394
|
+
],
|
|
395
|
+
'@stylistic/rest-spread-spacing': [
|
|
396
|
+
'error',
|
|
397
|
+
'never'
|
|
398
|
+
],
|
|
399
|
+
'@stylistic/semi': [
|
|
400
|
+
'error',
|
|
401
|
+
'always'
|
|
402
|
+
],
|
|
403
|
+
'@stylistic/semi-spacing': [
|
|
404
|
+
'error',
|
|
405
|
+
{
|
|
406
|
+
before: false,
|
|
407
|
+
after: true
|
|
408
|
+
}
|
|
409
|
+
],
|
|
410
|
+
'@stylistic/semi-style': [
|
|
411
|
+
'error',
|
|
412
|
+
'last'
|
|
413
|
+
],
|
|
414
|
+
'@stylistic/space-before-blocks': [
|
|
415
|
+
'error',
|
|
416
|
+
'always'
|
|
417
|
+
],
|
|
418
|
+
'@stylistic/space-before-function-paren': [
|
|
419
|
+
'error',
|
|
420
|
+
{
|
|
421
|
+
anonymous: 'never',
|
|
422
|
+
named: 'never',
|
|
423
|
+
asyncArrow: 'never',
|
|
424
|
+
catch: 'never'
|
|
425
|
+
}
|
|
426
|
+
],
|
|
427
|
+
'@stylistic/space-in-parens': [
|
|
428
|
+
'error',
|
|
429
|
+
'never'
|
|
430
|
+
],
|
|
431
|
+
'@stylistic/space-infix-ops': [
|
|
432
|
+
'error',
|
|
433
|
+
{
|
|
434
|
+
int32Hint: true,
|
|
435
|
+
ignoreTypes: false
|
|
436
|
+
}
|
|
437
|
+
],
|
|
438
|
+
'@stylistic/space-unary-ops': [
|
|
439
|
+
'error',
|
|
440
|
+
{
|
|
441
|
+
words: true,
|
|
442
|
+
nonwords: false
|
|
443
|
+
}
|
|
444
|
+
],
|
|
445
|
+
'@stylistic/spaced-comment': [
|
|
446
|
+
'error',
|
|
447
|
+
'always',
|
|
448
|
+
{
|
|
449
|
+
exceptions: [
|
|
450
|
+
'-',
|
|
451
|
+
'+'
|
|
452
|
+
]
|
|
453
|
+
}
|
|
454
|
+
],
|
|
455
|
+
'@stylistic/switch-colon-spacing': [
|
|
456
|
+
'error',
|
|
457
|
+
{
|
|
458
|
+
after: true,
|
|
459
|
+
before: false
|
|
460
|
+
}
|
|
461
|
+
],
|
|
462
|
+
'@stylistic/template-curly-spacing': [
|
|
463
|
+
'error',
|
|
464
|
+
'never'
|
|
465
|
+
],
|
|
466
|
+
'@stylistic/template-tag-spacing': [
|
|
467
|
+
'error',
|
|
468
|
+
'always'
|
|
469
|
+
],
|
|
470
|
+
'@stylistic/type-annotation-spacing': [
|
|
471
|
+
'error',
|
|
472
|
+
{
|
|
473
|
+
before: false,
|
|
474
|
+
after: true
|
|
475
|
+
}
|
|
476
|
+
],
|
|
477
|
+
'@stylistic/type-generic-spacing': [ 'error' ],
|
|
478
|
+
'@stylistic/type-named-tuple-spacing': [ 'error' ],
|
|
479
|
+
'@stylistic/wrap-iife': [
|
|
480
|
+
'error',
|
|
481
|
+
'inside',
|
|
482
|
+
{ functionPrototypeMethods: true }
|
|
483
|
+
],
|
|
484
|
+
'@stylistic/wrap-regex': [ 'error' ],
|
|
485
|
+
'@stylistic/yield-star-spacing': [
|
|
486
|
+
'error',
|
|
487
|
+
'after'
|
|
488
|
+
]
|
|
489
|
+
}
|
|
490
|
+
};
|