@mikey-pro/eslint-config 4.8.0 → 4.8.3

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