@enormora/eslint-config-ava 0.0.8 → 0.0.9

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/ava.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import avaPlugin from 'eslint-plugin-ava';
2
- import { baseConfig } from './base.js';
2
+ import { stylisticRuleSet } from './rule-sets/stylistic.js';
3
3
 
4
4
  const commonTestRules = {
5
5
  'no-magic-numbers': 'off',
@@ -7,7 +7,7 @@ const commonTestRules = {
7
7
  'max-len': [
8
8
  'error',
9
9
  {
10
- ...baseConfig.rules['max-len'][1],
10
+ ...stylisticRuleSet.rules['@stylistic/max-len'][1],
11
11
  ignoreStrings: true
12
12
  }
13
13
  ]
package/package.json CHANGED
@@ -1,16 +1,9 @@
1
1
  {
2
2
  "dependencies": {
3
- "@cspell/eslint-plugin": "7.3.6",
4
- "eslint-plugin-array-func": "4.0.0",
3
+ "@stylistic/eslint-plugin": "1.5.1",
5
4
  "eslint-plugin-ava": "14.0.0",
6
5
  "eslint-plugin-destructuring": "2.2.1",
7
- "eslint-plugin-eslint-comments": "3.2.0",
8
- "eslint-plugin-import": "2.28.1",
9
- "eslint-plugin-no-secrets": "0.8.9",
10
- "eslint-plugin-prettier": "5.0.0",
11
- "eslint-plugin-promise": "6.1.1",
12
- "eslint-plugin-sonarjs": "0.21.0",
13
- "eslint-plugin-unicorn": "^48.0.1"
6
+ "eslint-plugin-prettier": "5.0.1"
14
7
  },
15
8
  "license": "MIT",
16
9
  "main": "ava.js",
@@ -20,5 +13,5 @@
20
13
  "url": "git://github.com/enormora/eslint-config.git"
21
14
  },
22
15
  "type": "module",
23
- "version": "0.0.8"
16
+ "version": "0.0.9"
24
17
  }
@@ -1,10 +1,13 @@
1
1
  import prettierPlugin from 'eslint-plugin-prettier';
2
2
  import destructuringPlugin from 'eslint-plugin-destructuring';
3
+ import stylisticPlugin from '@stylistic/eslint-plugin';
4
+ import { indentSize } from '../constants.js';
3
5
 
4
6
  export const stylisticRuleSet = {
5
7
  plugins: {
6
8
  prettier: prettierPlugin,
7
- destructuring: destructuringPlugin
9
+ destructuring: destructuringPlugin,
10
+ '@stylistic': stylisticPlugin
8
11
  },
9
12
 
10
13
  settings: {},
@@ -14,6 +17,218 @@ export const stylisticRuleSet = {
14
17
 
15
18
  'destructuring/in-methods-params': 'error',
16
19
  'destructuring/in-params': ['error', { 'max-params': 0 }],
17
- 'destructuring/no-rename': 'off'
20
+ 'destructuring/no-rename': 'off',
21
+
22
+ '@stylistic/array-bracket-newline': ['error', 'consistent'],
23
+ '@stylistic/array-bracket-spacing': ['error', 'never'],
24
+ '@stylistic/array-element-newline': ['error', 'consistent'],
25
+ '@stylistic/arrow-parens': ['error', 'always'],
26
+ '@stylistic/arrow-spacing': [
27
+ 'error',
28
+ {
29
+ before: true,
30
+ after: true
31
+ }
32
+ ],
33
+ '@stylistic/block-spacing': 'off',
34
+ '@stylistic/brace-style': ['error', '1tbs', { allowSingleLine: false }],
35
+ '@stylistic/comma-dangle': ['error', 'never'],
36
+ '@stylistic/comma-spacing': [
37
+ 'error',
38
+ {
39
+ before: false,
40
+ after: true
41
+ }
42
+ ],
43
+ '@stylistic/comma-style': ['error', 'last'],
44
+ '@stylistic/computed-property-spacing': [
45
+ 'error',
46
+ 'never',
47
+ {
48
+ enforceForClassMembers: true
49
+ }
50
+ ],
51
+ '@stylistic/dot-location': ['error', 'property'],
52
+ '@stylistic/eol-last': 'error',
53
+ '@stylistic/func-call-spacing': ['error', 'never'],
54
+ '@stylistic/function-call-spacing': ['error', 'never'],
55
+ '@stylistic/function-call-argument-newline': ['error', 'consistent'],
56
+ '@stylistic/function-paren-newline': 'off',
57
+ '@stylistic/generator-star-spacing': ['error', { before: false, after: true }],
58
+ '@stylistic/indent-binary-ops': ['error', indentSize],
59
+ '@stylistic/implicit-arrow-linebreak': 'off',
60
+ '@stylistic/indent': [
61
+ 'error',
62
+ indentSize,
63
+ {
64
+ SwitchCase: 1,
65
+ VariableDeclarator: 1,
66
+ MemberExpression: 1
67
+ }
68
+ ],
69
+ '@stylistic/jsx-child-element-spacing': 'off',
70
+ '@stylistic/jsx-closing-bracket-location': 'off',
71
+ '@stylistic/jsx-closing-tag-location': 'off',
72
+ '@stylistic/jsx-curly-brace-presence': 'off',
73
+ '@stylistic/jsx-curly-newline': 'off',
74
+ '@stylistic/jsx-curly-spacing': 'off',
75
+ '@stylistic/jsx-equals-spacing': 'off',
76
+ '@stylistic/jsx-first-prop-new-line': 'off',
77
+ '@stylistic/jsx-indent': 'off',
78
+ '@stylistic/jsx-indent-props': 'off',
79
+ '@stylistic/jsx-max-props-per-line': 'off',
80
+ '@stylistic/jsx-newline': 'off',
81
+ '@stylistic/jsx-one-expression-per-line': 'off',
82
+ '@stylistic/jsx-props-no-multi-spaces': 'off',
83
+ '@stylistic/jsx-self-closing-comp': 'off',
84
+ '@stylistic/jsx-sort-props': 'off',
85
+ '@stylistic/jsx-tag-spacing': 'off',
86
+ '@stylistic/jsx-quotes': 'off',
87
+ '@stylistic/jsx-wrap-multilines': 'off',
88
+ '@stylistic/key-spacing': [
89
+ 'error',
90
+ {
91
+ beforeColon: false,
92
+ afterColon: true
93
+ }
94
+ ],
95
+ '@stylistic/keyword-spacing': [
96
+ 'error',
97
+ {
98
+ before: true,
99
+ after: true
100
+ }
101
+ ],
102
+ '@stylistic/linebreak-style': ['error', 'unix'],
103
+ '@stylistic/lines-between-class-members': [
104
+ 'error',
105
+ 'always',
106
+ {
107
+ exceptAfterSingleLine: true
108
+ }
109
+ ],
110
+ '@stylistic/lines-around-comment': 'off',
111
+ '@stylistic/max-len': [
112
+ 'error',
113
+ {
114
+ code: 120,
115
+ tabWidth: indentSize,
116
+ ignoreComments: true,
117
+ ignoreTrailingComments: true,
118
+ ignoreUrls: true,
119
+ ignoreStrings: false,
120
+ ignoreTemplateLiterals: false,
121
+ ignoreRegExpLiterals: true
122
+ }
123
+ ],
124
+ '@stylistic/max-statements-per-line': ['error', { max: 1 }],
125
+ '@stylistic/member-delimiter-style': [
126
+ 'error',
127
+ {
128
+ multiline: {
129
+ delimiter: 'semi',
130
+ requireLast: true
131
+ },
132
+ singleline: {
133
+ delimiter: 'semi',
134
+ requireLast: false
135
+ }
136
+ }
137
+ ],
138
+ '@stylistic/multiline-ternary': 'off',
139
+ '@stylistic/new-parens': 'error',
140
+ '@stylistic/newline-per-chained-call': 'off',
141
+ '@stylistic/no-confusing-arrow': 'error',
142
+ // Currently this rule conflicts with prettier, because in some cases prettier adds unnecessary extra parens. Unfortunately there is no way to turn this off yet. We should re-enable this rule once this has been fixed in prettier or once there is a better formatter that doesn’t add unnecessary parens. See https://github.com/prettier/prettier/issues/3089
143
+ '@stylistic/no-extra-parens': 'off',
144
+ '@stylistic/no-extra-semi': 'error',
145
+ '@stylistic/no-floating-decimal': 'error',
146
+ '@stylistic/no-mixed-operators': 'off',
147
+ '@stylistic/no-mixed-spaces-and-tabs': 'error',
148
+ '@stylistic/no-multi-spaces': 'error',
149
+ '@stylistic/no-multiple-empty-lines': ['error', { max: 1 }],
150
+ '@stylistic/no-tabs': 'error',
151
+ '@stylistic/no-trailing-spaces': 'error',
152
+ '@stylistic/no-whitespace-before-property': 'error',
153
+ '@stylistic/nonblock-statement-body-position': 'off',
154
+ '@stylistic/object-curly-newline': 'off',
155
+ '@stylistic/object-curly-spacing': ['error', 'always'],
156
+ '@stylistic/object-property-newline': 'off',
157
+ '@stylistic/one-var-declaration-per-line': 'error',
158
+ '@stylistic/operator-linebreak': ['error', 'after', { overrides: { '?': 'before', ':': 'before' } }],
159
+ '@stylistic/padded-blocks': [
160
+ 'error',
161
+ 'never',
162
+ {
163
+ allowSingleLineBlocks: false
164
+ }
165
+ ],
166
+ '@stylistic/padding-line-between-statements': [
167
+ 'error',
168
+ {
169
+ blankLine: 'always',
170
+ prev: 'directive',
171
+ next: '*'
172
+ },
173
+ {
174
+ blankLine: 'any',
175
+ prev: 'directive',
176
+ next: 'directive'
177
+ }
178
+ ],
179
+ '@stylistic/quote-props': ['error', 'as-needed'],
180
+ '@stylistic/quotes': ['error', 'single', { avoidEscape: true }],
181
+ '@stylistic/rest-spread-spacing': ['error', 'never'],
182
+ '@stylistic/semi': ['error', 'always'],
183
+ '@stylistic/semi-spacing': [
184
+ 'error',
185
+ {
186
+ before: false,
187
+ after: true
188
+ }
189
+ ],
190
+ '@stylistic/semi-style': ['error', 'last'],
191
+ '@stylistic/space-before-blocks': ['error', 'always'],
192
+ '@stylistic/space-before-function-paren': [
193
+ 'error',
194
+ {
195
+ anonymous: 'always',
196
+ named: 'never',
197
+ asyncArrow: 'always'
198
+ }
199
+ ],
200
+ '@stylistic/space-in-parens': ['error', 'never'],
201
+ '@stylistic/space-infix-ops': 'error',
202
+ '@stylistic/space-unary-ops': 'error',
203
+ '@stylistic/spaced-comment': [
204
+ 'error',
205
+ 'always',
206
+ {
207
+ line: {
208
+ exceptions: ['-', '+', '*'],
209
+ markers: ['!', '/', '=>']
210
+ },
211
+ block: {
212
+ exceptions: ['-', '+', '*'],
213
+ markers: ['!', '*'],
214
+ balanced: true
215
+ }
216
+ }
217
+ ],
218
+ '@stylistic/switch-colon-spacing': [
219
+ 'error',
220
+ {
221
+ after: true,
222
+ before: false
223
+ }
224
+ ],
225
+ '@stylistic/template-curly-spacing': 'error',
226
+ '@stylistic/template-tag-spacing': ['error', 'never'],
227
+ '@stylistic/type-annotation-spacing': 'error',
228
+ '@stylistic/type-generic-spacing': 'error',
229
+ '@stylistic/type-named-tuple-spacing': 'error',
230
+ '@stylistic/wrap-iife': ['error', 'inside'],
231
+ '@stylistic/wrap-regex': 'off',
232
+ '@stylistic/yield-star-spacing': ['error', { before: false, after: true }]
18
233
  }
19
234
  };
package/base.js DELETED
@@ -1,608 +0,0 @@
1
- import importPlugin from 'eslint-plugin-import';
2
- import eslintCommentsPlugin from 'eslint-plugin-eslint-comments';
3
- import noSecretsPlugin from 'eslint-plugin-no-secrets';
4
- import codeSpellChecker from '@cspell/eslint-plugin';
5
- import { stylisticRuleSet } from './rule-sets/stylistic.js';
6
- import { bestPracticesRuleSet } from './rule-sets/best-practices.js';
7
- import { ecmaVersion, indentSize, javascriptExtensions } from './constants.js';
8
-
9
- export const baseConfig = {
10
- languageOptions: {
11
- ecmaVersion,
12
- sourceType: 'module',
13
- parserOptions: {
14
- ecmaVersion,
15
- ecmaFeatures: {
16
- jsx: false,
17
- globalReturn: false,
18
- impliedStrict: false
19
- }
20
- }
21
- },
22
- linterOptions: {
23
- noInlineConfig: false,
24
- reportUnusedDisableDirectives: true
25
- },
26
- plugins: {
27
- ...stylisticRuleSet.plugins,
28
- ...bestPracticesRuleSet.plugins,
29
- import: importPlugin,
30
- 'eslint-comments': eslintCommentsPlugin,
31
- 'no-secrets': noSecretsPlugin,
32
- '@cspell': codeSpellChecker
33
- },
34
- settings: {
35
- ...stylisticRuleSet.settings,
36
- ...bestPracticesRuleSet.settings,
37
- 'import/parsers': {
38
- espree: javascriptExtensions
39
- }
40
- },
41
- rules: {
42
- ...stylisticRuleSet.rules,
43
- ...bestPracticesRuleSet.rules,
44
-
45
- 'array-callback-return': 'error',
46
- 'no-array-constructor': 'error',
47
- 'no-bitwise': 'error',
48
- 'no-caller': 'error',
49
- 'no-case-declarations': 'error',
50
- 'no-class-assign': 'error',
51
- 'no-cond-assign': 'error',
52
- 'no-confusing-arrow': 'error',
53
- 'no-console': 'error',
54
- 'no-const-assign': 'error',
55
- 'no-constant-condition': 'error',
56
- 'no-continue': 'error',
57
- 'no-control-regex': 'error',
58
- 'no-debugger': 'error',
59
- 'no-delete-var': 'error',
60
- 'no-div-regex': 'error',
61
- 'no-dupe-class-members': 'error',
62
- 'no-dupe-keys': 'error',
63
- 'no-dupe-args': 'error',
64
- 'no-duplicate-case': 'error',
65
- 'no-duplicate-imports': 'error',
66
- 'no-else-return': ['error', { allowElseIf: false }],
67
- 'no-empty': ['error', { allowEmptyCatch: true }],
68
- 'no-empty-character-class': 'error',
69
- 'no-empty-function': 'off',
70
- 'no-empty-pattern': 'error',
71
- 'no-empty-static-block': 'error',
72
- 'no-eq-null': 'error',
73
- 'no-eval': 'error',
74
- 'no-ex-assign': 'error',
75
- 'no-extend-native': 'error',
76
- 'no-extra-bind': 'error',
77
- 'no-extra-boolean-cast': 'error',
78
- 'no-extra-label': 'error',
79
- 'no-extra-parens': 'error',
80
- 'no-extra-semi': 'error',
81
- 'no-fallthrough': 'error',
82
- 'no-floating-decimal': 'error',
83
- 'no-func-assign': 'error',
84
- 'no-implicit-coercion': 'error',
85
- 'no-implicit-globals': 'error',
86
- 'no-implied-eval': 'error',
87
- 'no-inline-comments': 'off',
88
- 'no-inner-declarations': ['error', 'functions'],
89
- 'no-invalid-regexp': 'error',
90
- 'no-invalid-this': 'off',
91
- 'no-irregular-whitespace': 'error',
92
- 'no-iterator': 'error',
93
- 'no-label-var': 'error',
94
- 'no-labels': 'error',
95
- 'no-lone-blocks': 'error',
96
- 'no-lonely-if': 'error',
97
- 'no-loop-func': 'error',
98
- 'no-mixed-spaces-and-tabs': 'error',
99
- 'no-new-native-nonconstructor': 'error',
100
- 'linebreak-style': ['error', 'unix'],
101
- 'no-multi-spaces': 'error',
102
- 'no-multi-str': 'error',
103
- 'no-multiple-empty-lines': ['error', { max: 1 }],
104
- 'no-global-assign': 'error',
105
- 'no-negated-condition': 'off',
106
- 'no-nested-ternary': 'error',
107
- 'no-new': 'error',
108
- 'no-new-func': 'error',
109
- 'no-new-object': 'error',
110
- 'no-new-symbol': 'error',
111
- 'no-new-wrappers': 'error',
112
- 'no-obj-calls': 'error',
113
- 'no-octal': 'error',
114
- 'no-octal-escape': 'error',
115
- 'no-param-reassign': ['error', { props: true }],
116
- 'no-plusplus': 'error',
117
- 'no-proto': 'error',
118
- 'no-prototype-builtins': 'error',
119
- 'no-redeclare': ['error', { builtinGlobals: true }],
120
- 'no-regex-spaces': 'error',
121
- 'no-restricted-syntax': 'off',
122
- 'no-return-assign': ['error', 'always'],
123
- 'no-self-assign': ['error', { props: true }],
124
- 'no-self-compare': 'error',
125
- 'no-sequences': 'error',
126
- 'no-shadow': ['error', { builtinGlobals: true }],
127
- 'no-shadow-restricted-names': 'error',
128
- 'no-sparse-arrays': 'error',
129
- 'no-tabs': 'error',
130
- 'no-ternary': 'off',
131
- 'no-trailing-spaces': 'error',
132
- 'no-this-before-super': 'error',
133
- 'no-throw-literal': 'error',
134
- 'no-undef': ['error', { typeof: true }],
135
- 'no-undef-init': 'error',
136
- 'no-undefined': 'off',
137
- 'no-unexpected-multiline': 'error',
138
- 'no-underscore-dangle': 'error',
139
- 'no-unmodified-loop-condition': 'error',
140
- 'no-unneeded-ternary': 'error',
141
- 'no-unreachable': 'error',
142
- 'no-unsafe-finally': 'error',
143
- 'no-unused-expressions': 'error',
144
- 'no-unused-labels': 'error',
145
- 'no-unused-vars': [
146
- 'error',
147
- {
148
- vars: 'all',
149
- args: 'after-used',
150
- ignoreRestSiblings: true,
151
- argsIgnorePattern: '^_$',
152
- caughtErrors: 'all',
153
- caughtErrorsIgnorePattern: '^_$'
154
- }
155
- ],
156
- 'no-use-before-define': 'error',
157
- 'no-useless-call': 'error',
158
- 'no-useless-computed-key': 'error',
159
- 'no-useless-concat': 'error',
160
- 'no-useless-constructor': 'error',
161
- 'no-useless-escape': 'error',
162
- 'no-useless-rename': 'error',
163
- 'no-whitespace-before-property': 'error',
164
- 'no-void': 'error',
165
- 'prefer-const': [
166
- 'error',
167
- {
168
- destructuring: 'all'
169
- }
170
- ],
171
- 'prefer-spread': 'error',
172
- 'prefer-template': 'error',
173
- 'no-var': 'error',
174
- 'no-warning-comments': [
175
- 'error',
176
- {
177
- terms: ['todo', 'fixme', 'wtf', 'falls through', 'istanbul', 'c8'],
178
- location: 'anywhere'
179
- }
180
- ],
181
- 'no-with': 'error',
182
- 'no-magic-numbers': [
183
- 'error',
184
- {
185
- ignoreDefaultValues: true,
186
- ignoreArrayIndexes: false,
187
- detectObjects: false,
188
- enforceConst: false,
189
- ignoreClassFieldInitialValues: false,
190
- ignore: [-1, 0, 1]
191
- }
192
- ],
193
- 'no-mixed-operators': 'off',
194
- 'array-bracket-spacing': ['error', 'never'],
195
- 'array-bracket-newline': ['error', 'consistent'],
196
- 'array-element-newline': ['error', 'consistent'],
197
- 'arrow-body-style': ['error', 'always'],
198
- 'arrow-parens': ['error', 'always'],
199
- 'arrow-spacing': [
200
- 'error',
201
- {
202
- before: true,
203
- after: true
204
- }
205
- ],
206
- 'accessor-pairs': [
207
- 'error',
208
- {
209
- enforceForClassMembers: true
210
- }
211
- ],
212
- 'block-scoped-var': 'off',
213
- 'block-spacing': 'off',
214
- 'brace-style': ['error', '1tbs', { allowSingleLine: false }],
215
- camelcase: 'off',
216
- 'comma-dangle': ['error', 'never'],
217
- 'comma-spacing': [
218
- 'error',
219
- {
220
- before: false,
221
- after: true
222
- }
223
- ],
224
- 'comma-style': ['error', 'last'],
225
- complexity: ['error', { max: 6 }],
226
- 'computed-property-spacing': [
227
- 'error',
228
- 'never',
229
- {
230
- enforceForClassMembers: true
231
- }
232
- ],
233
- 'consistent-return': 'error',
234
- 'consistent-this': ['error', 'self'],
235
- 'constructor-super': 'error',
236
- 'generator-star-spacing': ['error', { before: false, after: true }],
237
- curly: ['error', 'all'],
238
- 'default-case': 'error',
239
- 'dot-location': ['error', 'property'],
240
- 'dot-notation': 'error',
241
- 'eol-last': 'error',
242
- eqeqeq: 'error',
243
- 'func-names': 'off',
244
- 'func-style': 'off',
245
- 'guard-for-in': 'error',
246
- 'id-length': ['error', { min: 2, properties: 'never' }],
247
- indent: [
248
- 'error',
249
- indentSize,
250
- {
251
- SwitchCase: 1,
252
- VariableDeclarator: 1,
253
- MemberExpression: 1
254
- }
255
- ],
256
- 'init-declarations': ['error', 'always'],
257
- 'jsx-quotes': 'off',
258
- 'key-spacing': [
259
- 'error',
260
- {
261
- beforeColon: false,
262
- afterColon: true
263
- }
264
- ],
265
- 'lines-around-comment': 'off',
266
- 'max-depth': ['error', { max: 5 }],
267
- 'max-lines': ['error', { max: 500, skipBlankLines: true, skipComments: true }],
268
- 'max-nested-callbacks': ['error', { max: 4 }],
269
- 'max-params': ['error', { max: 4 }],
270
- 'max-statements': ['error', { max: 10 }],
271
- 'multiline-ternary': 'off',
272
- 'max-statements-per-line': ['error', { max: 1 }],
273
- 'new-cap': [
274
- 'error',
275
- {
276
- newIsCap: true,
277
- capIsNew: true
278
- }
279
- ],
280
- 'new-parens': 'error',
281
- 'newline-per-chained-call': 'off',
282
- 'object-curly-newline': 'off',
283
- 'object-curly-spacing': ['error', 'always'],
284
- 'object-property-newline': 'off',
285
- 'object-shorthand': ['error', 'always'],
286
- 'one-var': ['error', 'never'],
287
- 'one-var-declaration-per-line': 'error',
288
- 'operator-assignment': ['error', 'always'],
289
- 'operator-linebreak': ['error', 'after', { overrides: { '?': 'before', ':': 'before' } }],
290
- 'padded-blocks': [
291
- 'error',
292
- 'never',
293
- {
294
- allowSingleLineBlocks: false
295
- }
296
- ],
297
- 'prefer-arrow-callback': [
298
- 'error',
299
- {
300
- allowNamedFunctions: true
301
- }
302
- ],
303
- 'prefer-rest-params': 'error',
304
- 'quote-props': ['error', 'as-needed'],
305
- quotes: ['error', 'single', { avoidEscape: true }],
306
- radix: 'error',
307
- 'id-match': 'off',
308
- 'require-yield': 'error',
309
- 'rest-spread-spacing': ['error', 'never'],
310
- semi: ['error', 'always'],
311
- 'semi-spacing': [
312
- 'error',
313
- {
314
- before: false,
315
- after: true
316
- }
317
- ],
318
- 'sort-vars': 'off',
319
- 'keyword-spacing': [
320
- 'error',
321
- {
322
- before: true,
323
- after: true
324
- }
325
- ],
326
- 'space-before-blocks': ['error', 'always'],
327
- 'space-before-function-paren': [
328
- 'error',
329
- {
330
- anonymous: 'always',
331
- named: 'never',
332
- asyncArrow: 'always'
333
- }
334
- ],
335
- 'space-in-parens': ['error', 'never'],
336
- 'space-infix-ops': 'error',
337
- 'space-unary-ops': 'error',
338
- 'spaced-comment': [
339
- 'error',
340
- 'always',
341
- {
342
- line: {
343
- exceptions: ['-', '+', '*'],
344
- markers: ['!', '/', '=>']
345
- },
346
- block: {
347
- exceptions: ['-', '+', '*'],
348
- markers: ['!', '*'],
349
- balanced: true
350
- }
351
- }
352
- ],
353
- 'sort-imports': 'off',
354
- strict: ['error', 'safe'],
355
- 'template-curly-spacing': 'error',
356
- 'unicode-bom': ['error', 'never'],
357
- 'use-isnan': 'error',
358
- 'valid-typeof': 'error',
359
- 'vars-on-top': 'error',
360
- 'wrap-iife': ['error', 'inside'],
361
- 'wrap-regex': 'off',
362
- 'yield-star-spacing': ['error', { before: false, after: true }],
363
- yoda: ['error', 'never'],
364
- 'capitalized-comments': 'off',
365
- 'class-methods-use-this': 'error',
366
- 'func-call-spacing': ['error', 'never'],
367
- 'func-name-matching': 'off',
368
- 'line-comment-position': 'off',
369
- 'no-await-in-loop': 'off',
370
- 'no-compare-neg-zero': 'error',
371
- 'no-multi-assign': 'error',
372
- 'no-restricted-properties': 'off',
373
- 'no-template-curly-in-string': 'error',
374
- 'no-unsafe-negation': 'error',
375
- 'no-useless-return': 'error',
376
- 'nonblock-statement-body-position': 'off',
377
- 'prefer-destructuring': [
378
- 'error',
379
- {
380
- VariableDeclarator: {
381
- array: false,
382
- object: true
383
- },
384
- AssignmentExpression: {
385
- array: false,
386
- object: false
387
- }
388
- },
389
- {
390
- enforceForRenamedProperties: false
391
- }
392
- ],
393
- 'prefer-numeric-literals': 'error',
394
- 'prefer-promise-reject-errors': [
395
- 'error',
396
- {
397
- allowEmptyReject: false
398
- }
399
- ],
400
- 'require-await': 'off',
401
- 'sort-keys': 'off',
402
- 'symbol-description': 'error',
403
- 'template-tag-spacing': ['error', 'never'],
404
- 'for-direction': 'off',
405
- 'padding-line-between-statements': [
406
- 'error',
407
- {
408
- blankLine: 'always',
409
- prev: 'directive',
410
- next: '*'
411
- },
412
- {
413
- blankLine: 'any',
414
- prev: 'directive',
415
- next: 'directive'
416
- }
417
- ],
418
- 'semi-style': ['error', 'last'],
419
- 'switch-colon-spacing': [
420
- 'error',
421
- {
422
- after: true,
423
- before: false
424
- }
425
- ],
426
- 'function-paren-newline': 'off',
427
- 'getter-return': [
428
- 'error',
429
- {
430
- allowImplicit: false
431
- }
432
- ],
433
- 'implicit-arrow-linebreak': 'off',
434
- 'lines-between-class-members': [
435
- 'error',
436
- 'always',
437
- {
438
- exceptAfterSingleLine: true
439
- }
440
- ],
441
- 'multiline-comment-style': 'off',
442
- 'max-classes-per-file': 'off',
443
- 'max-lines-per-function': ['error', { max: 75, skipBlankLines: true, skipComments: true }],
444
- 'prefer-object-spread': 'error',
445
- 'no-async-promise-executor': 'error',
446
- 'no-misleading-character-class': 'error',
447
- 'default-param-last': 'error',
448
- 'prefer-regex-literals': 'error',
449
- 'require-unicode-regexp': 'off',
450
- 'function-call-argument-newline': ['error', 'consistent'],
451
- 'no-useless-catch': 'error',
452
- 'prefer-named-capture-group': 'error',
453
- 'no-import-assign': 'error',
454
- 'require-atomic-updates': 'error',
455
-
456
- 'no-restricted-imports': 'off',
457
-
458
- 'no-alert': 'off',
459
- 'no-script-url': 'off',
460
- 'no-restricted-globals': 'off',
461
- 'max-len': [
462
- 'error',
463
- {
464
- code: 120,
465
- tabWidth: indentSize,
466
- ignoreComments: true,
467
- ignoreTrailingComments: true,
468
- ignoreUrls: true,
469
- ignoreStrings: false,
470
- ignoreTemplateLiterals: false,
471
- ignoreRegExpLiterals: true
472
- }
473
- ],
474
-
475
- 'grouped-accessor-pairs': 'off',
476
- 'no-constructor-return': 'error',
477
- 'no-dupe-else-if': 'error',
478
- 'no-setter-return': 'error',
479
- 'prefer-exponentiation-operator': 'error',
480
-
481
- 'default-case-last': 'error',
482
- 'no-restricted-exports': 'off',
483
- 'no-useless-backreference': 'error',
484
- 'id-denylist': 'off',
485
- 'no-loss-of-precision': 'off',
486
- 'no-promise-executor-return': 'error',
487
- 'no-unreachable-loop': 'error',
488
- 'no-nonoctal-decimal-escape': 'error',
489
- 'no-unsafe-optional-chaining': 'error',
490
- 'no-unused-private-class-members': 'error',
491
- 'no-constant-binary-expression': 'error',
492
- 'logical-assignment-operators': ['error', 'never'],
493
- 'prefer-object-has-own': 'error',
494
-
495
- 'no-secrets/no-secrets': ['error', { tolerance: 5 }],
496
-
497
- 'eslint-comments/disable-enable-pair': [
498
- 'error',
499
- {
500
- allowWholeFile: true
501
- }
502
- ],
503
- 'eslint-comments/no-aggregating-enable': 'error',
504
- 'eslint-comments/no-duplicate-disable': 'error',
505
- 'eslint-comments/no-unused-disable': 'error',
506
- 'eslint-comments/no-unused-enable': 'error',
507
- 'eslint-comments/no-restricted-disable': 'off',
508
- 'eslint-comments/no-unlimited-disable': 'error',
509
- 'eslint-comments/no-use': 'off',
510
- 'eslint-comments/require-description': 'error',
511
-
512
- 'import/no-deprecated': 'error',
513
- 'import/exports-last': 'off',
514
- 'import/dynamic-import-chunkname': 'off',
515
- 'import/unambiguous': 'off',
516
- 'import/no-dynamic-require': 'error',
517
- 'import/no-named-export': 'off',
518
- 'import/no-default-export': 'error',
519
- 'import/prefer-default-export': 'off',
520
- 'import/newline-after-import': 'error',
521
- 'import/no-nodejs-modules': 'off',
522
- 'import/max-dependencies': ['error', { max: 8 }],
523
- 'import/first': 'error',
524
- 'import/no-unused-modules': 'error',
525
- 'import/no-anonymous-default-export': 'off',
526
- 'import/no-named-default': 'off',
527
- 'import/no-cycle': 'error',
528
- 'import/no-relative-parent-imports': 'off',
529
- 'import/group-exports': 'off',
530
- 'import/no-internal-modules': 'off',
531
- 'import/no-restricted-paths': 'off',
532
- 'import/named': 'off',
533
- 'import/no-namespace': 'off',
534
- 'import/default': 'error',
535
- 'import/export': 'error',
536
- 'import/extensions': [
537
- 'error',
538
- {
539
- js: 'always',
540
- jsx: 'always',
541
- json: 'always'
542
- }
543
- ],
544
- 'import/namespace': [
545
- 'error',
546
- {
547
- allowComputed: true
548
- }
549
- ],
550
- 'import/no-absolute-path': 'error',
551
- 'import/no-webpack-loader-syntax': 'error',
552
- 'import/no-self-import': 'error',
553
- 'import/no-useless-path-segments': [
554
- 'error',
555
- {
556
- noUselessIndex: true
557
- }
558
- ],
559
- 'import/no-amd': 'error',
560
- 'import/no-commonjs': 'error',
561
- 'import/no-duplicates': 'error',
562
- 'import/no-extraneous-dependencies': 'error',
563
- 'import/no-mutable-exports': 'error',
564
- 'import/no-named-as-default-member': 'error',
565
- 'import/no-named-as-default': 'error',
566
- 'import/order': 'error',
567
- 'import/no-unassigned-import': [
568
- 'error',
569
- {
570
- allow: []
571
- }
572
- ],
573
- // this rule doesn’t work correctly for ESM modules which use the exports field in package.json instead of main, see also https://github.com/import-js/eslint-plugin-import/issues/2703
574
- 'import/no-unresolved': 'off',
575
- 'import/no-relative-packages': 'off',
576
- 'import/no-import-module-exports': 'off',
577
- 'import/no-empty-named-blocks': 'error',
578
- 'import/consistent-type-specifier-style': 'off',
579
-
580
- '@cspell/spellchecker': [
581
- 'warn',
582
- {
583
- autoFix: false,
584
- numSuggestions: 3,
585
- generateSuggestions: true,
586
- ignoreImports: true,
587
- ignoreImportProperties: true,
588
- checkIdentifiers: true,
589
- checkStrings: true,
590
- checkStringTemplates: true,
591
- checkJSXText: true,
592
- checkComments: true,
593
- cspell: {
594
- words: [],
595
- ignoreWords: [],
596
- flagWords: [],
597
- ignoreRegExpList: [],
598
- includeRegExpList: [],
599
- allowCompoundWords: true,
600
- import: [],
601
- dictionaries: []
602
- },
603
- customWordListFile: undefined,
604
- debugMode: false
605
- }
606
- ]
607
- }
608
- };
@@ -1,188 +0,0 @@
1
- import unicornPlugin from 'eslint-plugin-unicorn';
2
- import promisePlugin from 'eslint-plugin-promise';
3
- import arrayFunctionPlugin from 'eslint-plugin-array-func';
4
- import sonarjsPlugin from 'eslint-plugin-sonarjs';
5
-
6
- const maxSwitchCases = 6;
7
-
8
- export const bestPracticesRuleSet = {
9
- plugins: {
10
- unicorn: unicornPlugin,
11
- promise: promisePlugin,
12
- 'array-func': arrayFunctionPlugin,
13
- sonarjs: sonarjsPlugin
14
- },
15
- settings: {},
16
- rules: {
17
- 'unicorn/string-content': 'off',
18
- 'unicorn/prefer-string-trim-start-end': 'error',
19
- 'unicorn/prefer-set-has': 'error',
20
- 'unicorn/prefer-string-replace-all': 'error',
21
- 'unicorn/prefer-number-properties': 'error',
22
- 'unicorn/prefer-negative-index': 'error',
23
- 'unicorn/prefer-modern-dom-apis': 'off',
24
- 'unicorn/no-null': 'off',
25
- 'unicorn/catch-error-name': 'error',
26
- 'unicorn/consistent-function-scoping': 'off',
27
- 'unicorn/custom-error-definition': 'off',
28
- 'unicorn/error-message': 'error',
29
- 'unicorn/escape-case': 'error',
30
- 'unicorn/expiring-todo-comments': 'error',
31
- 'unicorn/explicit-length-check': 'error',
32
- 'unicorn/no-useless-length-check': 'error',
33
- 'unicorn/filename-case': 'off',
34
- 'unicorn/new-for-builtins': 'error',
35
- 'unicorn/no-abusive-eslint-disable': 'error',
36
- 'unicorn/no-instanceof-array': 'error',
37
- 'unicorn/no-console-spaces': 'error',
38
- 'unicorn/no-array-callback-reference': 'off',
39
- 'unicorn/no-for-loop': 'error',
40
- 'unicorn/no-hex-escape': 'error',
41
- 'unicorn/no-keyword-prefix': 'off',
42
- 'unicorn/no-nested-ternary': 'off',
43
- 'unicorn/no-new-buffer': 'error',
44
- 'unicorn/no-process-exit': 'error',
45
- 'unicorn/no-unreadable-array-destructuring': 'error',
46
- 'unicorn/no-unused-properties': 'off',
47
- 'unicorn/no-zero-fractions': 'error',
48
- 'unicorn/number-literal-case': 'error',
49
- 'unicorn/prefer-add-event-listener': 'error',
50
- 'unicorn/prefer-dom-node-dataset': 'error',
51
- 'unicorn/prefer-keyboard-event-key': 'error',
52
- 'unicorn/prefer-array-flat-map': 'error',
53
- 'unicorn/prefer-includes': 'error',
54
- 'unicorn/prefer-dom-node-append': 'error',
55
- 'unicorn/prefer-dom-node-remove': 'error',
56
- 'unicorn/prefer-query-selector': 'error',
57
- 'unicorn/prefer-reflect-apply': 'error',
58
- 'unicorn/prefer-spread': 'off',
59
- 'unicorn/prefer-string-starts-ends-with': 'error',
60
- 'unicorn/prefer-string-slice': 'error',
61
- 'unicorn/prefer-dom-node-text-content': 'error',
62
- 'unicorn/prefer-type-error': 'error',
63
- 'unicorn/prevent-abbreviations': 'off',
64
- 'unicorn/better-regex': 'error',
65
- 'unicorn/throw-new-error': 'error',
66
- 'unicorn/no-array-reduce': 'off',
67
- 'unicorn/no-useless-undefined': 'off',
68
- 'unicorn/prefer-optional-catch-binding': 'error',
69
- 'unicorn/no-object-as-default-parameter': 'off',
70
- 'unicorn/prefer-array-find': 'error',
71
- 'unicorn/import-style': 'off',
72
- 'unicorn/numeric-separators-style': 'error',
73
- 'unicorn/prefer-math-trunc': 'error',
74
- 'unicorn/prefer-ternary': 'error',
75
- 'unicorn/prefer-array-some': 'error',
76
- 'unicorn/prefer-default-parameters': 'error',
77
- 'unicorn/no-lonely-if': 'error',
78
- 'unicorn/empty-brace-spaces': 'off',
79
- 'unicorn/prefer-date-now': 'error',
80
- 'unicorn/consistent-destructuring': 'off',
81
- 'unicorn/no-array-for-each': 'off',
82
- 'unicorn/no-array-push-push': 'error',
83
- 'unicorn/no-new-array': 'error',
84
- 'unicorn/no-this-assignment': 'error',
85
- 'unicorn/prefer-array-index-of': 'error',
86
- 'unicorn/prefer-regexp-test': 'error',
87
- 'unicorn/no-static-only-class': 'error',
88
- 'unicorn/prefer-array-flat': 'error',
89
- 'unicorn/prefer-module': 'off',
90
- 'unicorn/prefer-node-protocol': 'error',
91
- 'unicorn/prefer-switch': 'off',
92
- 'unicorn/no-document-cookie': 'off',
93
- 'unicorn/require-array-join-separator': 'off',
94
- 'unicorn/require-number-to-fixed-digits-argument': 'off',
95
- 'unicorn/prefer-prototype-methods': 'off',
96
- 'unicorn/no-array-method-this-argument': 'off',
97
- 'unicorn/require-post-message-target-origin': 'error',
98
- 'unicorn/no-useless-spread': 'error',
99
- 'unicorn/prefer-object-from-entries': 'error',
100
- 'unicorn/no-useless-fallback-in-spread': 'error',
101
- 'unicorn/no-invalid-remove-event-listener': 'off',
102
- 'unicorn/template-indent': 'error',
103
- 'unicorn/no-empty-file': 'error',
104
- 'unicorn/prefer-export-from': 'error',
105
- 'unicorn/no-await-expression-member': 'error',
106
- 'unicorn/prefer-code-point': 'error',
107
- 'unicorn/no-thenable': 'off',
108
- 'unicorn/no-useless-promise-resolve-reject': 'error',
109
- 'unicorn/prefer-json-parse-buffer': 'off',
110
- 'unicorn/relative-url-style': 'off',
111
- 'unicorn/text-encoding-identifier-case': 'off',
112
- 'unicorn/no-useless-switch-case': 'error',
113
- 'unicorn/prefer-modern-math-apis': 'error',
114
- 'unicorn/no-unreadable-iife': 'error',
115
- 'unicorn/prefer-native-coercion-functions': 'error',
116
- 'unicorn/prefer-event-target': 'off',
117
- 'unicorn/prefer-logical-operator-over-ternary': 'off',
118
- 'unicorn/no-unnecessary-await': 'error',
119
- 'unicorn/switch-case-braces': 'off',
120
- 'unicorn/no-negated-condition': 'error',
121
- 'unicorn/no-typeof-undefined': 'error',
122
- 'unicorn/prefer-set-size': 'error',
123
- 'unicorn/prefer-blob-reading-methods': 'error',
124
- 'unicorn/prefer-top-level-await': 'off',
125
- 'unicorn/prefer-at': 'error',
126
-
127
- 'array-func/from-map': 'error',
128
- 'array-func/no-unnecessary-this-arg': 'error',
129
- 'array-func/prefer-array-from': 'error',
130
- 'array-func/avoid-reverse': 'error',
131
- 'array-func/prefer-flat-map': 'error',
132
- 'array-func/prefer-flat': 'error',
133
-
134
- 'sonarjs/cognitive-complexity': 'off',
135
- 'sonarjs/elseif-without-else': 'off',
136
- 'sonarjs/max-switch-cases': ['error', maxSwitchCases],
137
- 'sonarjs/no-all-duplicated-branches': 'error',
138
- 'sonarjs/no-collapsible-if': 'error',
139
- 'sonarjs/no-collection-size-mischeck': 'error',
140
- 'sonarjs/no-duplicate-string': 'off',
141
- 'sonarjs/no-duplicated-branches': 'error',
142
- 'sonarjs/no-element-overwrite': 'error',
143
- 'sonarjs/no-empty-collection': 'error',
144
- 'sonarjs/no-extra-arguments': 'off',
145
- 'sonarjs/no-gratuitous-expressions': 'error',
146
- 'sonarjs/no-identical-conditions': 'error',
147
- 'sonarjs/no-identical-expressions': 'error',
148
- 'sonarjs/no-identical-functions': 'error',
149
- 'sonarjs/no-ignored-return': 'error',
150
- 'sonarjs/no-inverted-boolean-check': 'error',
151
- 'sonarjs/no-nested-switch': 'error',
152
- 'sonarjs/no-nested-template-literals': 'error',
153
- 'sonarjs/no-one-iteration-loop': 'error',
154
- 'sonarjs/no-redundant-boolean': 'off',
155
- 'sonarjs/no-redundant-jump': 'off',
156
- 'sonarjs/no-same-line-conditional': 'error',
157
- 'sonarjs/no-small-switch': 'error',
158
- 'sonarjs/no-unused-collection': 'error',
159
- 'sonarjs/no-use-of-empty-return-value': 'error',
160
- 'sonarjs/no-useless-catch': 'error',
161
- 'sonarjs/non-existent-operator': 'error',
162
- 'sonarjs/prefer-immediate-return': 'off',
163
- 'sonarjs/prefer-object-literal': 'error',
164
- 'sonarjs/prefer-single-boolean-return': 'error',
165
- 'sonarjs/prefer-while': 'error',
166
-
167
- 'promise/avoid-new': 'off',
168
- 'promise/no-nesting': 'error',
169
- 'promise/no-promise-in-callback': 'error',
170
- 'promise/no-callback-in-promise': 'error',
171
- 'promise/no-native': 'off',
172
- 'promise/prefer-await-to-callbacks': 'off',
173
- 'promise/catch-or-return': 'error',
174
- 'promise/always-return': 'off',
175
- 'promise/param-names': 'error',
176
- 'promise/no-return-wrap': [
177
- 'error',
178
- {
179
- allowReject: true
180
- }
181
- ],
182
- 'promise/no-new-statics': 'error',
183
- 'promise/no-return-in-finally': 'error',
184
- 'promise/valid-params': 'error',
185
- 'promise/prefer-await-to-then': 'error',
186
- 'promise/no-multiple-resolved': 'error'
187
- }
188
- };