@mikey-pro/eslint-config 4.7.0 → 4.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.
Files changed (2) hide show
  1. package/index.js +212 -202
  2. package/package.json +9 -8
package/index.js CHANGED
@@ -1,4 +1,11 @@
1
1
  module.exports = {
2
+ env: {
3
+ browser: true,
4
+ commonjs: true,
5
+ es2021: true,
6
+ es6: true,
7
+ node: true,
8
+ },
2
9
  extends: [
3
10
  'eslint:recommended',
4
11
  'react-app',
@@ -9,33 +16,44 @@ module.exports = {
9
16
  'plugin:css-modules/recommended',
10
17
  'plugin:prettier/recommended',
11
18
  ],
19
+ ignorePatterns: [
20
+ '!.*',
21
+ 'node_modules',
22
+ 'vendor',
23
+ 'dist',
24
+ 'package-lock.json',
25
+ 'LICENSE',
26
+ '.vscode',
27
+ '.github',
28
+ 'tsconfig.json',
29
+ ],
12
30
  overrides: [
13
31
  {
32
+ extends: [
33
+ 'plugin:@typescript-eslint/recommended',
34
+ 'plugin:@typescript-eslint/recommended-requiring-type-checking',
35
+ ],
14
36
  files: ['*.ts', '*.tsx'],
15
37
  parser: '@typescript-eslint/parser',
16
38
  parserOptions: {
17
- tsconfigRootDir: __dirname,
18
- project: ['../../../tsconfig.json'],
19
- extraFileExtensions: ['.vue', '.svelte'],
20
- sourceType: 'module',
21
- ecmaVersion: 'latest',
22
39
  ecmaFeatures: {
23
40
  jsx: true,
24
41
  },
42
+ ecmaVersion: 'latest',
43
+ extraFileExtensions: ['.vue', '.svelte'],
44
+ project: ['../../../tsconfig.json'],
45
+ sourceType: 'module',
46
+ tsconfigRootDir: __dirname,
25
47
  },
26
48
  plugins: ['@typescript-eslint'],
27
- extends: [
28
- 'plugin:@typescript-eslint/recommended',
29
- 'plugin:@typescript-eslint/recommended-requiring-type-checking',
30
- ],
31
49
  rules: {
32
- 'import/named': 0,
33
- 'import/namespace': 0,
34
- 'import/default': 0,
35
- 'import/no-named-as-default-member': 0,
36
- 'import/no-unresolved': 0,
37
- '@typescript-eslint/indent': 0,
38
- '@typescript-eslint/naming-convention': 0,
50
+ '@typescript-eslint/indent': 1,
51
+ '@typescript-eslint/naming-convention': 1,
52
+ 'import/default': 1,
53
+ 'import/named': 1,
54
+ 'import/namespace': 1,
55
+ 'import/no-named-as-default-member': 1,
56
+ 'import/no-unresolved': 1,
39
57
  'prettier/prettier': [1, { parser: 'typescript' }],
40
58
  },
41
59
  },
@@ -58,25 +76,25 @@ module.exports = {
58
76
  },
59
77
  },
60
78
  {
79
+ extends: ['plugin:yaml/recommended'],
61
80
  files: ['*.yaml', '*.yml'],
62
81
  plugins: ['yaml'],
63
- extends: ['plugin:yaml/recommended'],
64
82
  rules: {
65
83
  'prettier/prettier': [1, { parser: 'yaml' }],
66
84
  },
67
85
  },
68
86
  {
87
+ extends: ['plugin:toml/standard'],
69
88
  files: ['*.toml'],
70
89
  parser: 'toml-eslint-parser',
71
- extends: ['plugin:toml/standard'],
72
90
  rules: {
73
- 'prettier/prettier': 0,
91
+ 'prettier/prettier': 1,
74
92
  },
75
93
  },
76
94
  {
95
+ extends: ['plugin:md/recommended'],
77
96
  files: ['*.md'],
78
97
  parser: 'markdown-eslint-parser',
79
- extends: ['plugin:md/recommended'],
80
98
  rules: {
81
99
  'md/remark': [
82
100
  1,
@@ -97,41 +115,28 @@ module.exports = {
97
115
  },
98
116
  },
99
117
  {
118
+ extends: ['plugin:@html-eslint/recommended'],
100
119
  files: ['*.html'],
101
120
  parser: '@html-eslint/parser',
102
- extends: ['plugin:@html-eslint/recommended'],
103
121
  plugins: ['@html-eslint'],
104
122
  rules: {
105
- 'spaced-comment': 0,
106
- '@html-eslint/indent': 0,
107
- '@html-eslint/no-extra-spacing-attrs': 0,
108
- '@html-eslint/require-closing-tags': 0,
123
+ '@html-eslint/indent': 1,
124
+ '@html-eslint/no-extra-spacing-attrs': 1,
125
+ '@html-eslint/require-closing-tags': 1,
109
126
  'disable-autofix/@html-eslint/require-closing-tags': [
110
127
  1,
111
128
  { selfClosing: 'always' },
112
129
  ],
113
130
  'prettier/prettier': [1, { parser: 'html' }],
131
+ 'spaced-comment': 1,
114
132
  },
115
133
  },
116
134
  {
135
+ extends: ['plugin:vue/vue3-recommended'],
117
136
  files: ['*.vue'],
118
137
  parser: 'vue-eslint-parser',
119
- extends: ['plugin:vue/vue3-recommended'],
120
138
  parserOptions: {
121
- requireConfigFile: false,
122
- ecmaVersion: 'latest',
123
- sourceType: 'module',
124
139
  babelOptions: {
125
- presets: [
126
- [
127
- '@babel/preset-env',
128
- {
129
- targets: {
130
- node: 'current',
131
- },
132
- },
133
- ],
134
- ],
135
140
  plugins: [
136
141
  'eslint-plugin-vue',
137
142
  [
@@ -142,45 +147,58 @@ module.exports = {
142
147
  },
143
148
  ],
144
149
  ],
150
+ presets: [
151
+ [
152
+ '@babel/preset-env',
153
+ {
154
+ targets: {
155
+ node: 'current',
156
+ },
157
+ },
158
+ ],
159
+ ],
145
160
  },
161
+ ecmaVersion: 'latest',
162
+ requireConfigFile: false,
163
+ sourceType: 'module',
146
164
  },
147
165
  rules: {
166
+ 'prettier/prettier': 1,
167
+ 'vue/component-tags-order': [
168
+ 1,
169
+ {
170
+ order: [['script', 'template'], 'style'],
171
+ },
172
+ ],
148
173
  'vue/html-self-closing': [
149
174
  1,
150
175
  {
151
176
  html: {
152
- void: 'always',
153
- normal: 'always',
154
177
  component: 'always',
178
+ normal: 'always',
179
+ void: 'always',
155
180
  },
156
- svg: 'always',
157
181
  math: 'always',
182
+ svg: 'always',
158
183
  },
159
184
  ],
160
- 'vue/component-tags-order': [
161
- 1,
162
- {
163
- order: [['script', 'template'], 'style'],
164
- },
165
- ],
166
- 'prettier/prettier': 0,
167
185
  },
168
186
  },
169
187
  {
170
188
  files: ['*.svelte'],
171
- processor: 'svelte3/svelte3',
172
189
  plugins: ['svelte3'],
190
+ processor: 'svelte3/svelte3',
173
191
  rules: {
174
- 'import/first': 0,
175
- 'import/no-duplicates': 0,
176
- 'import/no-mutable-exports': 0,
177
- 'import/no-unresolved': 0,
178
- 'prettier/prettier': 0,
192
+ 'import/first': 1,
193
+ 'import/no-duplicates': 1,
194
+ 'import/no-mutable-exports': 1,
195
+ 'import/no-unresolved': 1,
196
+ 'prettier/prettier': 1,
179
197
  },
180
198
  },
181
199
  {
182
- files: ['*.json', '*.jsonc', '*rc'],
183
200
  extends: ['plugin:jsonc/recommended-with-json'],
201
+ files: ['*.json', '*.jsonc', '*rc'],
184
202
  parser: 'jsonc-eslint-parser',
185
203
  plugins: ['json-format'],
186
204
  rules: {
@@ -188,49 +206,56 @@ module.exports = {
188
206
  },
189
207
  },
190
208
  {
191
- files: ['*.json5'],
192
209
  extends: ['plugin:jsonc/recommended-with-json5'],
210
+ files: ['*.json5'],
193
211
  parser: 'jsonc-eslint-parser',
194
212
  rules: {
195
213
  'prettier/prettier': [1, { parser: 'json5' }],
196
214
  },
197
215
  },
198
216
  ],
199
- env: {
200
- browser: true,
201
- node: true,
202
- es6: true,
203
- commonjs: true,
204
- es2021: true,
217
+ parser: '@babel/eslint-parser',
218
+ parserOptions: {
219
+ babelOptions: {
220
+ presets: [
221
+ [
222
+ '@babel/preset-env',
223
+ {
224
+ targets: {
225
+ node: 'current',
226
+ },
227
+ },
228
+ ],
229
+ '@babel/preset-react',
230
+ ],
231
+ },
232
+ ecmaVersion: 'latest',
233
+ requireConfigFile: false,
234
+ sourceType: 'module',
205
235
  },
236
+ plugins: [
237
+ 'prettier',
238
+ 'css-modules',
239
+ 'disable-autofix',
240
+ '@babel',
241
+ 'unicorn',
242
+ 'sonarjs',
243
+ 'only-warn',
244
+ 'sort-keys-fix',
245
+ ],
246
+ root: true,
206
247
  rules: {
207
- 'no-restricted-syntax': [
208
- 1,
209
- {
210
- selector: 'ForInStatement',
211
- message:
212
- '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.',
213
- },
214
- {
215
- selector: 'LabeledStatement',
216
- message:
217
- 'Labels are a form of GOTO; using them makes code confusing and hard to maintain and understand.',
218
- },
219
- {
220
- selector: 'WithStatement',
221
- message:
222
- '`with` is disallowed in strict mode because it makes code impossible to predict and optimize.',
223
- },
224
- ],
225
- camelcase: 0,
226
- 'no-console': 0,
227
- 'func-names': 0,
228
- 'no-process-exit': 0,
229
- 'class-methods-use-this': 0,
230
- 'no-underscore-dangle': 0,
248
+ camelcase: 1,
249
+ 'class-methods-use-this': 1,
250
+ 'constructor-super': 1,
251
+ 'dot-notation': 1,
252
+ 'filenames/match-regex': 1,
253
+ 'func-names': 1,
254
+ 'import/extensions': [1, 'never', { ignorePackages: true }],
255
+ 'import/no-commonjs': 1,
231
256
  'import/no-unresolved': [
232
257
  1,
233
- { commonjs: true, amd: true, ignore: ['^node:'] },
258
+ { amd: true, commonjs: true, ignore: ['^node:'] },
234
259
  ],
235
260
  'import/order': [
236
261
  1,
@@ -241,41 +266,55 @@ module.exports = {
241
266
  'newlines-between': 'always',
242
267
  },
243
268
  ],
244
- 'import/extensions': [1, 'never', { ignorePackages: true }],
245
- 'prefer-destructuring': [
246
- 1,
247
- {
248
- object: true,
249
- array: false,
250
- },
251
- ],
269
+ 'jsx-quotes': 1,
252
270
  'keyword-spacing': 1,
253
- 'require-atomic-updates': 0,
254
- 'import/no-commonjs': 0,
255
- 'sort-imports': 0,
256
- 'constructor-super': 1,
257
271
  'no-caller': 1,
272
+ 'no-confusing-arrow': 1,
273
+ 'no-console': 1,
258
274
  'no-const-assign': 1,
259
275
  'no-delete-var': 1,
260
276
  'no-dupe-class-members': 1,
261
277
  'no-dupe-keys': 1,
262
278
  'no-duplicate-imports': 1,
263
279
  'no-else-return': 1,
264
- 'no-empty-pattern': 0,
265
- 'no-empty': 0,
266
- 'no-extra-parens': 0,
280
+ 'no-empty': 1,
281
+ 'no-empty-pattern': 1,
282
+ 'no-extra-bind': 1,
283
+ 'no-extra-parens': 1,
284
+ 'no-extra-semi': 1,
285
+ 'no-floating-decimal': 1,
267
286
  'no-iterator': 1,
268
287
  'no-lonely-if': 1,
269
288
  'no-mixed-spaces-and-tabs': [1, 'smart-tabs'],
270
289
  'no-multi-str': 1,
271
290
  'no-new-wrappers': 1,
291
+ 'no-process-exit': 1,
272
292
  'no-proto': 1,
273
293
  'no-redeclare': 1,
294
+ 'no-restricted-syntax': [
295
+ 1,
296
+ {
297
+ message:
298
+ '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.',
299
+ selector: 'ForInStatement',
300
+ },
301
+ {
302
+ message:
303
+ 'Labels are a form of GOTO; using them makes code confusing and hard to maintain and understand.',
304
+ selector: 'LabeledStatement',
305
+ },
306
+ {
307
+ message:
308
+ '`with` is disallowed in strict mode because it makes code impossible to predict and optimize.',
309
+ selector: 'WithStatement',
310
+ },
311
+ ],
312
+ 'no-shadow': 1,
274
313
  'no-shadow-restricted-names': 1,
275
- 'no-shadow': 0,
276
314
  'no-spaced-func': 1,
277
315
  'no-this-before-super': 1,
278
316
  'no-undef-init': 1,
317
+ 'no-underscore-dangle': 1,
279
318
  'no-unneeded-ternary': 1,
280
319
  'no-unused-vars': [
281
320
  1,
@@ -290,91 +329,65 @@ module.exports = {
290
329
  'no-useless-constructor': 1,
291
330
  'no-useless-escape': 1,
292
331
  'no-useless-rename': 1,
332
+ 'no-useless-return': 1,
293
333
  'no-var': 1,
294
334
  'no-with': 1,
295
- semi: 0,
296
- strict: [1, 'never'],
297
- 'object-curly-spacing': [0, 'always'],
298
- 'rest-spread-spacing': 0,
299
- 'space-before-function-paren': [0, 'always'],
300
- 'space-in-parens': [0, 'never'],
335
+ 'object-curly-spacing': [1, 'always'],
301
336
  'object-shorthand': 1,
302
337
  'prefer-arrow-callback': 1,
338
+ 'prefer-destructuring': [
339
+ 1,
340
+ {
341
+ array: false,
342
+ object: true,
343
+ },
344
+ ],
303
345
  'prefer-rest-params': 1,
304
346
  'prefer-spread': 1,
305
347
  'prefer-template': 1,
348
+ 'prettier/prettier': [1, { parser: 'babel' }],
349
+ 'quote-props': [1, 'as-needed'],
306
350
  quotes: [
307
- 0,
351
+ 1,
308
352
  'single',
309
353
  {
310
- avoidEscape: true,
311
354
  allowTemplateLiterals: true,
355
+ avoidEscape: true,
312
356
  },
313
357
  ],
314
- 'quote-props': [1, 'as-needed'],
315
358
  radix: 1,
316
- 'unicode-bom': 1,
317
- 'valid-jsdoc': 0,
318
- 'spaced-comment': [
319
- 1,
320
- 'always',
321
- {
322
- line: {
323
- markers: ['/'],
324
- exceptions: ['-', '+'],
325
- },
326
- block: {
327
- markers: ['!'],
328
- exceptions: ['*'],
329
- balanced: true,
330
- },
331
- },
332
- ],
333
- 'unicorn/import-index': [1, { ignoreImports: true }],
334
- 'filenames/match-regex': 0,
335
- 'unicorn/filename-case': [
336
- 1,
337
- {
338
- cases: {
339
- camelCase: true,
340
- pascalCase: true,
341
- },
342
- ignore: ['README.md'],
343
- },
344
- ],
345
- 'react/state-in-constructor': 0,
346
- 'react/no-deprecated': 1,
347
- 'react/react-in-jsx-scope': 0,
359
+ 'react-hooks/exhaustive-deps': 1,
360
+ 'react-hooks/rules-of-hooks': 1,
348
361
  'react/display-name': [1, { ignoreTranspilerName: false }],
362
+ 'react/function-component-definition': 1,
363
+ 'react/jsx-curly-spacing': 1,
364
+ 'react/jsx-key': [1, { checkFragmentShorthand: true }],
349
365
  'react/jsx-no-bind': [
350
366
  1,
351
367
  {
352
- ignoreRefs: true,
353
- allowFunctions: true,
354
368
  allowArrowFunctions: true,
369
+ allowFunctions: true,
370
+ ignoreRefs: true,
355
371
  },
356
372
  ],
357
- 'react/no-string-refs': 1,
358
- 'react/no-find-dom-node': 1,
359
373
  'react/jsx-no-comment-textnodes': 1,
360
- 'react/jsx-curly-spacing': 1,
361
- 'react/jsx-no-undef': 1,
362
- 'react/jsx-uses-react': 1,
363
- 'react/jsx-uses-vars': 1,
364
- 'react/function-component-definition': 0,
365
374
  'react/jsx-no-duplicate-props': 1,
366
375
  'react/jsx-no-target-blank': 1,
376
+ 'react/jsx-no-undef': 1,
367
377
  'react/jsx-tag-spacing': [1, { beforeSelfClosing: 'always' }],
368
- 'react/jsx-key': [1, { checkFragmentShorthand: true }],
369
- 'react/prefer-es6-class': 1,
370
- 'react/prefer-stateless-function': 1,
371
- 'react/require-render-return': 1,
378
+ 'react/jsx-uses-react': 1,
379
+ 'react/jsx-uses-vars': 1,
372
380
  'react/no-danger': 1,
381
+ 'react/no-deprecated': 1,
373
382
  'react/no-did-mount-set-state': 1,
374
383
  'react/no-did-update-set-state': 1,
384
+ 'react/no-find-dom-node': 1,
375
385
  'react/no-is-mounted': 1,
376
- 'react-hooks/rules-of-hooks': 1,
377
- 'react-hooks/exhaustive-deps': 1,
386
+ 'react/no-string-refs': 1,
387
+ 'react/prefer-es6-class': 1,
388
+ 'react/prefer-stateless-function': 1,
389
+ 'react/react-in-jsx-scope': 1,
390
+ 'react/require-render-return': 1,
378
391
  'react/self-closing-comp': [
379
392
  'error',
380
393
  {
@@ -382,54 +395,51 @@ module.exports = {
382
395
  html: false,
383
396
  },
384
397
  ],
385
- 'prettier/prettier': [1, { parser: 'babel' }],
398
+ 'react/state-in-constructor': 1,
399
+ 'require-atomic-updates': 1,
400
+ 'rest-spread-spacing': 1,
401
+ semi: 1,
402
+ 'sort-imports': 1,
403
+ 'sort-keys-fix/sort-keys-fix': 1,
404
+ 'sort-vars': 1,
405
+ 'space-before-function-paren': [1, 'always'],
406
+ 'space-in-parens': [1, 'never'],
407
+ 'spaced-comment': [
408
+ 1,
409
+ 'always',
410
+ {
411
+ block: {
412
+ balanced: true,
413
+ exceptions: ['*'],
414
+ markers: ['!'],
415
+ },
416
+ line: {
417
+ exceptions: ['-', '+'],
418
+ markers: ['/'],
419
+ },
420
+ },
421
+ ],
422
+ strict: [1, 'never'],
423
+ 'unicode-bom': 1,
424
+ 'unicorn/filename-case': [
425
+ 1,
426
+ {
427
+ cases: {
428
+ camelCase: true,
429
+ pascalCase: true,
430
+ },
431
+ ignore: ['README.md'],
432
+ },
433
+ ],
434
+ 'unicorn/import-index': [1, { ignoreImports: true }],
435
+ 'valid-jsdoc': 1,
386
436
  },
387
- plugins: [
388
- 'prettier',
389
- 'css-modules',
390
- 'disable-autofix',
391
- '@babel',
392
- 'unicorn',
393
- 'sonarjs',
394
- 'only-warn',
395
- ],
396
- ignorePatterns: [
397
- '!.*',
398
- 'node_modules',
399
- 'vendor',
400
- 'dist',
401
- 'package-lock.json',
402
- 'LICENSE',
403
- '.vscode',
404
- '.github',
405
- 'tsconfig.json',
406
- ],
407
- root: true,
408
437
  settings: {
409
438
  'json/sort-package-json': 'pro',
410
439
  polyfills: ['Promise'],
411
440
  react: {
412
441
  pragma: 'h',
413
- version: 'preact',
414
- },
415
- },
416
- parser: '@babel/eslint-parser',
417
- parserOptions: {
418
- requireConfigFile: false,
419
- ecmaVersion: 'latest',
420
- sourceType: 'module',
421
- babelOptions: {
422
- presets: [
423
- [
424
- '@babel/preset-env',
425
- {
426
- targets: {
427
- node: 'current',
428
- },
429
- },
430
- ],
431
- '@babel/preset-react',
432
- ],
442
+ version: 'detect',
433
443
  },
434
444
  },
435
445
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mikey-pro/eslint-config",
3
- "version": "4.7.0",
3
+ "version": "4.8.2",
4
4
  "description": "Mikey Pro ESLint configuration",
5
5
  "main": "index.js",
6
6
  "dependencies": {
@@ -11,10 +11,10 @@
11
11
  "@babel/preset-env": "^7.16",
12
12
  "@html-eslint/eslint-plugin": "^0.13.1",
13
13
  "@html-eslint/parser": "^0.13.1",
14
- "@typescript-eslint/eslint-plugin": "^5.12.0",
15
- "@typescript-eslint/parser": "^5.12.0",
14
+ "@typescript-eslint/eslint-plugin": "^5.13.0",
15
+ "@typescript-eslint/parser": "^5.13.0",
16
16
  "@vue/babel-plugin-jsx": "^1.1.1",
17
- "eslint-config-prettier": "^8.3",
17
+ "eslint-config-prettier": "^8.4",
18
18
  "eslint-config-react-app": "^7.0.0",
19
19
  "eslint-import-resolver-typescript": "^2.5.0",
20
20
  "eslint-plugin-compat": "^4.0",
@@ -27,13 +27,14 @@
27
27
  "eslint-plugin-only-warn": "^1.0.3",
28
28
  "eslint-plugin-prettier": "^4.0",
29
29
  "eslint-plugin-promise": "^6.0.0",
30
- "eslint-plugin-sonarjs": "^0.11.0",
31
- "eslint-plugin-svelte3": "^3.4.0",
30
+ "eslint-plugin-sonarjs": "^0.12.0",
31
+ "eslint-plugin-sort-keys-fix": "^1.1.2",
32
+ "eslint-plugin-svelte3": "^3.4.1",
32
33
  "eslint-plugin-toml": "^0.3.0",
33
34
  "eslint-plugin-unicorn": "^41.0.0",
34
- "eslint-plugin-vue": "^8.4",
35
+ "eslint-plugin-vue": "^8.5",
35
36
  "eslint-plugin-yaml": "^0.5.0",
36
- "vue-eslint-parser": "^8.2"
37
+ "vue-eslint-parser": "^8.3"
37
38
  },
38
39
  "peerDependencies": {
39
40
  "eslint": ">=8.3.0"