@croct/eslint-plugin 0.8.1 → 0.8.2
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/configs/javascript.js +10 -55
- package/configs/typescript.js +17 -12
- package/package.json +1 -1
package/configs/javascript.js
CHANGED
|
@@ -71,7 +71,6 @@ const baseRules = {
|
|
|
71
71
|
'no-fallthrough': 'error',
|
|
72
72
|
'@stylistic/no-floating-decimal': 'error',
|
|
73
73
|
'no-global-assign': ['error', { exceptions: [] }],
|
|
74
|
-
'no-native-reassign': 'off',
|
|
75
74
|
'no-implicit-coercion': ['off', {
|
|
76
75
|
boolean: false,
|
|
77
76
|
number: true,
|
|
@@ -159,7 +158,6 @@ const baseRules = {
|
|
|
159
158
|
message: 'Use the exponentiation operator (**) instead.',
|
|
160
159
|
}],
|
|
161
160
|
'no-return-assign': ['error', 'always'],
|
|
162
|
-
'no-return-await': 'error',
|
|
163
161
|
'no-script-url': 'error',
|
|
164
162
|
'no-self-assign': ['error', {
|
|
165
163
|
props: true,
|
|
@@ -240,10 +238,8 @@ const baseRules = {
|
|
|
240
238
|
'no-unsafe-optional-chaining': ['error', { disallowArithmeticOperators: true }],
|
|
241
239
|
'no-unused-private-class-members': 'off',
|
|
242
240
|
'no-useless-backreference': 'error',
|
|
243
|
-
'no-negated-in-lhs': 'off',
|
|
244
241
|
'require-atomic-updates': 'off',
|
|
245
242
|
'use-isnan': 'error',
|
|
246
|
-
'valid-jsdoc': 'off',
|
|
247
243
|
'valid-typeof': ['error', { requireStringLiterals: true }],
|
|
248
244
|
// Style (from airbnb-base, with customizations)
|
|
249
245
|
'@stylistic/array-bracket-newline': ['error', 'consistent'],
|
|
@@ -264,13 +260,7 @@ const baseRules = {
|
|
|
264
260
|
ignoreConsecutiveComments: true,
|
|
265
261
|
},
|
|
266
262
|
}],
|
|
267
|
-
'@stylistic/comma-dangle': ['error',
|
|
268
|
-
arrays: 'always-multiline',
|
|
269
|
-
objects: 'always-multiline',
|
|
270
|
-
imports: 'always-multiline',
|
|
271
|
-
exports: 'always-multiline',
|
|
272
|
-
functions: 'always-multiline',
|
|
273
|
-
}],
|
|
263
|
+
'@stylistic/comma-dangle': ['error', 'always-multiline'],
|
|
274
264
|
'@stylistic/comma-spacing': ['error', { before: false, after: true }],
|
|
275
265
|
'@stylistic/comma-style': ['error', 'last', {
|
|
276
266
|
exceptions: {
|
|
@@ -291,7 +281,7 @@ const baseRules = {
|
|
|
291
281
|
'consistent-this': 'off',
|
|
292
282
|
'@stylistic/eol-last': ['error', 'always'],
|
|
293
283
|
'@stylistic/function-call-argument-newline': ['error', 'consistent'],
|
|
294
|
-
'
|
|
284
|
+
'@stylistic/function-call-spacing': ['error', 'never'],
|
|
295
285
|
'func-name-matching': ['off', 'always', {
|
|
296
286
|
includeCommonJSModuleExports: false,
|
|
297
287
|
considerPropertyDescriptor: true,
|
|
@@ -346,7 +336,7 @@ const baseRules = {
|
|
|
346
336
|
ignoreComments: false,
|
|
347
337
|
},
|
|
348
338
|
],
|
|
349
|
-
'jsx-quotes': ['error', 'prefer-double'],
|
|
339
|
+
'@stylistic/jsx-quotes': ['error', 'prefer-double'],
|
|
350
340
|
'@stylistic/key-spacing': ['error', { beforeColon: false, afterColon: true }],
|
|
351
341
|
'@stylistic/keyword-spacing': ['error', {
|
|
352
342
|
before: true,
|
|
@@ -365,12 +355,8 @@ const baseRules = {
|
|
|
365
355
|
'@stylistic/linebreak-style': ['error', 'unix'],
|
|
366
356
|
'@stylistic/lines-between-class-members': ['error', 'always', { exceptAfterSingleLine: false }],
|
|
367
357
|
'@stylistic/lines-around-comment': 'off',
|
|
368
|
-
'lines-around-directive': ['error', {
|
|
369
|
-
before: 'always',
|
|
370
|
-
after: 'always',
|
|
371
|
-
}],
|
|
372
358
|
'max-depth': ['off', 4],
|
|
373
|
-
'max-len': [
|
|
359
|
+
'@stylistic/max-len': [
|
|
374
360
|
'error',
|
|
375
361
|
{
|
|
376
362
|
code: 120,
|
|
@@ -395,7 +381,7 @@ const baseRules = {
|
|
|
395
381
|
'max-nested-callbacks': 'off',
|
|
396
382
|
'max-params': ['off', 3],
|
|
397
383
|
'max-statements': ['off', 10],
|
|
398
|
-
'max-statements-per-line': ['off', { max: 1 }],
|
|
384
|
+
'@stylistic/max-statements-per-line': ['off', { max: 1 }],
|
|
399
385
|
'@stylistic/multiline-comment-style': ['off', 'starred-block'],
|
|
400
386
|
'@stylistic/multiline-ternary': ['error', 'always-multiline'],
|
|
401
387
|
'new-cap': ['error', {
|
|
@@ -405,15 +391,13 @@ const baseRules = {
|
|
|
405
391
|
capIsNewExceptions: ['Immutable.Map', 'Immutable.Set', 'Immutable.List'],
|
|
406
392
|
}],
|
|
407
393
|
'@stylistic/new-parens': 'error',
|
|
408
|
-
'newline-after-var': 'off',
|
|
409
|
-
'newline-before-return': 'off',
|
|
410
394
|
'@stylistic/newline-per-chained-call': 'off',
|
|
411
395
|
'no-array-constructor': 'error',
|
|
412
396
|
'no-bitwise': 'off',
|
|
413
397
|
'no-continue': 'off',
|
|
414
398
|
'no-inline-comments': 'off',
|
|
415
399
|
'no-lonely-if': 'error',
|
|
416
|
-
'no-mixed-operators': ['error', {
|
|
400
|
+
'@stylistic/no-mixed-operators': ['error', {
|
|
417
401
|
groups: [
|
|
418
402
|
['%', '**'],
|
|
419
403
|
['%', '+'],
|
|
@@ -427,7 +411,7 @@ const baseRules = {
|
|
|
427
411
|
],
|
|
428
412
|
allowSamePrecedence: false,
|
|
429
413
|
}],
|
|
430
|
-
'no-mixed-spaces-and-tabs': 'error',
|
|
414
|
+
'@stylistic/no-mixed-spaces-and-tabs': 'error',
|
|
431
415
|
'no-multi-assign': ['error'],
|
|
432
416
|
'@stylistic/no-multiple-empty-lines': [
|
|
433
417
|
'error',
|
|
@@ -439,7 +423,6 @@ const baseRules = {
|
|
|
439
423
|
],
|
|
440
424
|
'no-negated-condition': 'off',
|
|
441
425
|
'no-nested-ternary': 'error',
|
|
442
|
-
'no-new-object': 'error',
|
|
443
426
|
'no-plusplus': 'off',
|
|
444
427
|
'no-restricted-syntax': [
|
|
445
428
|
'error',
|
|
@@ -447,8 +430,7 @@ const baseRules = {
|
|
|
447
430
|
'LabeledStatement',
|
|
448
431
|
'WithStatement',
|
|
449
432
|
],
|
|
450
|
-
'no-
|
|
451
|
-
'no-tabs': 'error',
|
|
433
|
+
'@stylistic/no-tabs': 'error',
|
|
452
434
|
'no-ternary': 'off',
|
|
453
435
|
'@stylistic/no-trailing-spaces': ['error', {
|
|
454
436
|
skipBlankLines: false,
|
|
@@ -472,7 +454,7 @@ const baseRules = {
|
|
|
472
454
|
'one-var': ['error', 'never'],
|
|
473
455
|
'@stylistic/one-var-declaration-per-line': ['error', 'always'],
|
|
474
456
|
'operator-assignment': ['error', 'always'],
|
|
475
|
-
'@stylistic/operator-linebreak': ['error', 'before', { overrides: { '=': '
|
|
457
|
+
'@stylistic/operator-linebreak': ['error', 'before', { overrides: { '=': 'ignore' } }],
|
|
476
458
|
'@stylistic/padded-blocks': ['error', {
|
|
477
459
|
blocks: 'never',
|
|
478
460
|
classes: 'never',
|
|
@@ -547,9 +529,8 @@ const baseRules = {
|
|
|
547
529
|
],
|
|
548
530
|
'prefer-exponentiation-operator': 'error',
|
|
549
531
|
'prefer-object-spread': 'error',
|
|
550
|
-
'@stylistic/quote-props': ['error', 'as-needed', { keywords: false, unnecessary: true, numbers:
|
|
532
|
+
'@stylistic/quote-props': ['error', 'as-needed', { keywords: false, unnecessary: true, numbers: true }],
|
|
551
533
|
'@stylistic/quotes': ['error', 'single', { avoidEscape: true }],
|
|
552
|
-
'require-jsdoc': 'off',
|
|
553
534
|
'@stylistic/semi': ['error', 'always'],
|
|
554
535
|
'@stylistic/semi-spacing': ['error', { before: false, after: true }],
|
|
555
536
|
'@stylistic/semi-style': ['error', 'last'],
|
|
@@ -640,7 +621,6 @@ const baseRules = {
|
|
|
640
621
|
enforceForRenamedProperties: false,
|
|
641
622
|
}],
|
|
642
623
|
'prefer-numeric-literals': 'error',
|
|
643
|
-
'prefer-reflect': 'off',
|
|
644
624
|
'prefer-rest-params': 'error',
|
|
645
625
|
'prefer-spread': 'error',
|
|
646
626
|
'prefer-template': 'error',
|
|
@@ -657,7 +637,6 @@ const baseRules = {
|
|
|
657
637
|
'@stylistic/yield-star-spacing': ['error', 'after'],
|
|
658
638
|
// Variables (from airbnb-base)
|
|
659
639
|
'init-declarations': 'off',
|
|
660
|
-
'no-catch-shadow': 'off',
|
|
661
640
|
'no-delete-var': 'error',
|
|
662
641
|
'no-label-var': 'error',
|
|
663
642
|
'no-restricted-globals': [
|
|
@@ -749,21 +728,8 @@ const baseRules = {
|
|
|
749
728
|
],
|
|
750
729
|
// Strict (from airbnb-base)
|
|
751
730
|
strict: ['error', 'never'],
|
|
752
|
-
// Node (from airbnb-base)
|
|
753
|
-
'callback-return': 'off',
|
|
754
|
-
'global-require': 'error',
|
|
755
|
-
'handle-callback-err': 'off',
|
|
756
|
-
'no-buffer-constructor': 'error',
|
|
757
|
-
'no-mixed-requires': ['off', false],
|
|
758
|
-
'no-new-require': 'error',
|
|
759
|
-
'no-path-concat': 'error',
|
|
760
|
-
'no-process-env': 'off',
|
|
761
|
-
'no-process-exit': 'off',
|
|
762
|
-
'no-restricted-modules': 'off',
|
|
763
|
-
'no-sync': 'off',
|
|
764
731
|
// Import rules (from airbnb-base)
|
|
765
732
|
'import-x/no-unresolved': 'off',
|
|
766
|
-
'import-x/named': 'error',
|
|
767
733
|
'import-x/default': 'off',
|
|
768
734
|
'import-x/namespace': 'off',
|
|
769
735
|
'import-x/export': 'error',
|
|
@@ -776,7 +742,6 @@ const baseRules = {
|
|
|
776
742
|
'import-x/no-amd': 'error',
|
|
777
743
|
'import-x/no-nodejs-modules': 'off',
|
|
778
744
|
'import-x/first': 'error',
|
|
779
|
-
'import-x/imports-first': 'off',
|
|
780
745
|
'import-x/no-duplicates': 'error',
|
|
781
746
|
'import-x/no-namespace': 'off',
|
|
782
747
|
'import-x/extensions': [
|
|
@@ -898,15 +863,5 @@ function createJavaScriptConfig(plugin) {
|
|
|
898
863
|
...baseRules,
|
|
899
864
|
},
|
|
900
865
|
},
|
|
901
|
-
{
|
|
902
|
-
name: '@croct/javascript/tests',
|
|
903
|
-
files: [
|
|
904
|
-
'src/**/*.test.js',
|
|
905
|
-
'test/**/*.js',
|
|
906
|
-
],
|
|
907
|
-
rules: {
|
|
908
|
-
'no-new-object': 'off',
|
|
909
|
-
},
|
|
910
|
-
},
|
|
911
866
|
];
|
|
912
867
|
}
|
package/configs/typescript.js
CHANGED
|
@@ -29,12 +29,11 @@ const baseRules = {
|
|
|
29
29
|
ignoreTypeValueShadow: true,
|
|
30
30
|
ignoreFunctionTypeParameterNameValueShadow: true,
|
|
31
31
|
}],
|
|
32
|
-
'@typescript-eslint/no-empty-interface': 'off',
|
|
33
32
|
'@typescript-eslint/explicit-member-accessibility': [
|
|
34
33
|
'error',
|
|
35
34
|
],
|
|
36
35
|
'@typescript-eslint/explicit-module-boundary-types': 'off',
|
|
37
|
-
'@typescript-eslint/explicit-function-return-type': ['error'],
|
|
36
|
+
'@typescript-eslint/explicit-function-return-type': ['error', { allowExpressions: true }],
|
|
38
37
|
'@typescript-eslint/no-explicit-any': 'off',
|
|
39
38
|
'no-use-before-define': 'off',
|
|
40
39
|
'@typescript-eslint/no-use-before-define': 'off',
|
|
@@ -75,6 +74,22 @@ const baseRules = {
|
|
|
75
74
|
}],
|
|
76
75
|
'no-undef': 'off',
|
|
77
76
|
'@typescript-eslint/no-namespace': 'off',
|
|
77
|
+
'@typescript-eslint/restrict-template-expressions': 'off',
|
|
78
|
+
// Disable rules that turn `any` into `unknown`, places where `unknown` is the preferred type
|
|
79
|
+
// have that type already.
|
|
80
|
+
'@typescript-eslint/no-unsafe-argument': 'off',
|
|
81
|
+
'@typescript-eslint/no-unsafe-assignment': 'off',
|
|
82
|
+
'@typescript-eslint/no-unsafe-call': 'off',
|
|
83
|
+
'@typescript-eslint/no-unsafe-enum-comparison': 'off',
|
|
84
|
+
'@typescript-eslint/no-unsafe-member-access': 'off',
|
|
85
|
+
'@typescript-eslint/no-unsafe-return': 'off',
|
|
86
|
+
'@typescript-eslint/no-unsafe-unary-minus': 'off',
|
|
87
|
+
// Breaks with overloaded functions that implement both callback and Promise signatures
|
|
88
|
+
'@typescript-eslint/no-misused-promises': 'off',
|
|
89
|
+
// Doesn't detect classes that implement `toString` method
|
|
90
|
+
'@typescript-eslint/no-base-to-string': 'off',
|
|
91
|
+
// Conflict with TS promise ignore explicitly (void Promise)
|
|
92
|
+
'no-void': 'off',
|
|
78
93
|
};
|
|
79
94
|
// Factory function to create TypeScript config with the plugin reference
|
|
80
95
|
function createTypescriptConfig(plugin, javascriptConfig) {
|
|
@@ -98,15 +113,5 @@ function createTypescriptConfig(plugin, javascriptConfig) {
|
|
|
98
113
|
},
|
|
99
114
|
rules: baseRules,
|
|
100
115
|
},
|
|
101
|
-
{
|
|
102
|
-
name: '@croct/typescript/tests',
|
|
103
|
-
files: [
|
|
104
|
-
'src/**/*.test.ts',
|
|
105
|
-
'test/**/*.ts',
|
|
106
|
-
],
|
|
107
|
-
rules: {
|
|
108
|
-
'no-new-object': 'off',
|
|
109
|
-
},
|
|
110
|
-
},
|
|
111
116
|
];
|
|
112
117
|
}
|