@mikey-pro/eslint-config 7.4.0 → 7.5.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.
Files changed (3) hide show
  1. package/index.js +5 -346
  2. package/overrides.js +281 -0
  3. package/package.json +7 -6
package/index.js CHANGED
@@ -1,4 +1,5 @@
1
- const path = require('node:path');
1
+ const overrides = require('./overrides');
2
+ const rules = require('./rules');
2
3
 
3
4
  module.exports = {
4
5
  env: {
@@ -14,7 +15,7 @@ module.exports = {
14
15
  'plugin:compat/recommended',
15
16
  'plugin:css-modules/recommended',
16
17
  'plugin:import/recommended',
17
- 'plugin:prettier/all',
18
+ 'plugin:prettier/recommended',
18
19
  ],
19
20
  ignorePatterns: [
20
21
  '**/dist/**/*',
@@ -33,193 +34,7 @@ module.exports = {
33
34
  'LICENSE',
34
35
  'CNAME',
35
36
  ],
36
- overrides: [
37
- {
38
- files: ['*.ts', '*.tsx'],
39
- extends: [
40
- 'plugin:@typescript-eslint/all',
41
- 'plugin:@typescript-eslint/recommended-requiring-type-checking',
42
- 'plugin:import/typescript',
43
- ],
44
- parser: '@typescript-eslint/parser',
45
- parserOptions: {
46
- ecmaFeatures: {
47
- jsx: true,
48
- },
49
- ecmaVersion: 'latest',
50
- extraFileExtensions: ['.vue', '.svelte'],
51
- sourceType: 'module',
52
- project: 'tsconfig.json',
53
- tsconfigRootDir: path.join(__dirname, '../../..'),
54
- },
55
- plugins: ['@typescript-eslint'],
56
- rules: {
57
- '@typescript-eslint/unbound-method': 'off',
58
- '@typescript-eslint/naming-convention': 'off',
59
- 'prettier/prettier': ['warn', { parser: 'typescript' }],
60
- },
61
- settings: {
62
- 'import/parsers': {
63
- '@typescript-eslint/parser': ['.ts', '.tsx'],
64
- },
65
- 'import/resolver': {
66
- typescript: {
67
- alwaysTryTypes: true,
68
- },
69
- },
70
- },
71
- },
72
- {
73
- files: ['*.css'],
74
- rules: {
75
- 'prettier/prettier': ['warn', { parser: 'css' }],
76
- },
77
- },
78
- {
79
- files: ['*.scss'],
80
- rules: {
81
- 'prettier/prettier': ['warn', { parser: 'scss' }],
82
- },
83
- },
84
- {
85
- files: ['*.less'],
86
- rules: {
87
- 'prettier/prettier': ['warn', { parser: 'less' }],
88
- },
89
- },
90
- {
91
- extends: ['plugin:yml/standard'],
92
- files: ['*.yaml', '*.yml'],
93
- parser: 'yaml-eslint-parser',
94
- rules: {
95
- 'yml/quotes': ['warn', { prefer: 'double', avoidEscape: true }],
96
- 'prettier/prettier': ['warn', { parser: 'yaml', singleQuote: false }],
97
- },
98
- },
99
- {
100
- extends: ['plugin:toml/standard'],
101
- files: ['*.toml'],
102
- parser: 'toml-eslint-parser',
103
- rules: {
104
- 'prettier/prettier': 'off',
105
- },
106
- },
107
- {
108
- files: ['*.md'],
109
- parser: 'eslint-plugin-markdownlint/parser',
110
- extends: ['plugin:markdownlint/recommended'],
111
- rules: {
112
- 'markdownlint/md033': 'off',
113
- 'markdownlint/md041': 'off',
114
- 'prettier/prettier': ['warn', { parser: 'markdown' }],
115
- },
116
- },
117
- {
118
- files: ['package.json'],
119
- rules: {
120
- 'prettier/prettier': ['warn', { parser: 'json' }],
121
- },
122
- settings: {
123
- 'json/package-json-sort-order': [
124
- 'name',
125
- 'version',
126
- 'description',
127
- 'private',
128
- 'main',
129
- 'type',
130
- 'types',
131
- 'typings',
132
- 'browser',
133
- 'engines',
134
- 'scripts',
135
- 'husky',
136
- 'dependencies',
137
- 'devDependencies',
138
- 'peerDependencies',
139
- 'files',
140
- 'bin',
141
- 'productName',
142
- 'homepage',
143
- 'repository',
144
- 'bugs',
145
- 'license',
146
- 'keywords',
147
- 'author',
148
- 'contributors',
149
- 'funding',
150
- ],
151
- },
152
- },
153
- {
154
- files: ['*.md.json'],
155
- rules: {
156
- 'prettier/prettier': ['warn', { parser: 'json' }],
157
- },
158
- },
159
- {
160
- extends: ['plugin:@html-eslint/recommended'],
161
- files: ['*.html'],
162
- parser: '@html-eslint/parser',
163
- plugins: ['@html-eslint'],
164
- rules: {
165
- '@html-eslint/indent': 'off',
166
- '@html-eslint/no-extra-spacing-attrs': 'off',
167
- '@html-eslint/require-closing-tags': 'off',
168
- 'disable-autofix/@html-eslint/require-closing-tags': [
169
- 'warn',
170
- { selfClosing: 'always' },
171
- ],
172
- 'spaced-comment': 'off',
173
- 'prettier/prettier': ['warn', { parser: 'html' }],
174
- },
175
- },
176
- {
177
- extends: ['plugin:jsonc/recommended-with-jsonc'],
178
- files: ['*.jsonc', '*rc'],
179
- parser: 'jsonc-eslint-parser',
180
- rules: {
181
- 'prettier/prettier': ['warn', { parser: 'json' }],
182
- },
183
- },
184
- {
185
- extends: ['plugin:jsonc/recommended-with-json5'],
186
- files: ['*.json5'],
187
- parser: 'jsonc-eslint-parser',
188
- rules: {
189
- 'prettier/prettier': ['warn', { parser: 'json5' }],
190
- },
191
- },
192
- {
193
- files: ['*.test.js'],
194
- plugins: ['jest'],
195
- extends: ['plugin:jest/all'],
196
- env: {
197
- jest: true,
198
- },
199
- rules: {
200
- 'unicorn/no-array-callback-reference': 'off',
201
- 'jest/unbound-method': 'off',
202
- },
203
- },
204
- {
205
- files: ['*.test.ts'],
206
- parser: '@typescript-eslint/parser',
207
- plugins: ['@typescript-eslint', 'jest'],
208
- extends: ['plugin:jest/all'],
209
- env: {
210
- jest: true,
211
- },
212
- rules: {
213
- 'unicorn/no-array-callback-reference': 'off',
214
- 'jest/unbound-method': 'off',
215
- },
216
- },
217
- {
218
- files: ['*.cy.*'],
219
- plugins: ['cypress'],
220
- extends: ['plugin:cypress/recommended'],
221
- },
222
- ],
37
+ overrides: [...overrides],
223
38
  parser: '@babel/eslint-parser',
224
39
  parserOptions: {
225
40
  babelOptions: {
@@ -249,163 +64,7 @@ module.exports = {
249
64
  'import',
250
65
  ],
251
66
  root: true,
252
- rules: {
253
- camelcase: 'warn',
254
- 'class-methods-use-this': 'off',
255
- 'constructor-super': 'warn',
256
- 'dot-notation': 'warn',
257
- 'func-names': 'off',
258
- 'import/extensions': ['warn', 'never', { ignorePackages: true }],
259
- 'import/no-commonjs': 'off',
260
- 'import/default': 'off',
261
- 'import/named': 'off',
262
- 'import/namespace': 'off',
263
- 'import/no-named-as-default-member': 'off',
264
- 'import/no-unresolved': [
265
- 'warn',
266
- { amd: true, commonjs: true, ignore: ['^node:'] },
267
- ],
268
- 'import/order': [
269
- 'warn',
270
- {
271
- alphabetize: {
272
- order: 'asc',
273
- },
274
- 'newlines-between': 'always',
275
- },
276
- ],
277
- 'jsx-quotes': 'warn',
278
- 'keyword-spacing': 'warn',
279
- 'no-caller': 'warn',
280
- 'no-confusing-arrow': 'warn',
281
- 'no-console': 'off',
282
- 'no-const-assign': 'warn',
283
- 'no-delete-var': 'warn',
284
- 'no-dupe-class-members': 'warn',
285
- 'no-dupe-keys': 'warn',
286
- 'no-duplicate-imports': 'warn',
287
- 'no-else-return': 'warn',
288
- 'no-empty': 'off',
289
- 'no-empty-pattern': 'off',
290
- 'no-extra-parens': 'off',
291
- 'no-extra-bind': 'warn',
292
- 'no-extra-semi': 'warn',
293
- 'no-floating-decimal': 'warn',
294
- 'no-iterator': 'warn',
295
- 'no-lonely-if': 'warn',
296
- 'no-mixed-spaces-and-tabs': ['warn', 'smart-tabs'],
297
- 'no-multi-str': 'warn',
298
- 'no-new-wrappers': 'warn',
299
- 'no-process-exit': 'off',
300
- 'no-proto': 'warn',
301
- 'no-redeclare': 'warn',
302
- 'no-restricted-syntax': [
303
- 'warn',
304
- {
305
- message:
306
- '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.',
307
- selector: 'ForInStatement',
308
- },
309
- {
310
- message:
311
- 'Labels are a form of GOTO; using them makes code confusing and hard to maintain and understand.',
312
- selector: 'LabeledStatement',
313
- },
314
- {
315
- message:
316
- '`with` is disallowed in strict mode because it makes code impossible to predict and optimize.',
317
- selector: 'WithStatement',
318
- },
319
- ],
320
- 'no-shadow': 'off',
321
- 'no-shadow-restricted-names': 'warn',
322
- 'no-spaced-func': 'warn',
323
- 'no-this-before-super': 'warn',
324
- 'no-undef-init': 'warn',
325
- 'no-underscore-dangle': 'off',
326
- 'no-unneeded-ternary': 'warn',
327
- 'no-unused-vars': [
328
- 'warn',
329
- {
330
- args: 'after-used',
331
- ignoreRestSiblings: true,
332
- },
333
- ],
334
- 'no-useless-call': 'warn',
335
- 'no-useless-computed-key': 'warn',
336
- 'no-useless-concat': 'warn',
337
- 'no-useless-constructor': 'warn',
338
- 'no-useless-escape': 'warn',
339
- 'no-useless-rename': 'warn',
340
- 'no-useless-return': 'warn',
341
- 'no-var': 'warn',
342
- 'no-with': 'warn',
343
- 'object-curly-spacing': ['off', 'always'],
344
- 'object-shorthand': 'warn',
345
- 'prefer-arrow-callback': 'warn',
346
- 'prefer-destructuring': [
347
- 'warn',
348
- {
349
- array: false,
350
- object: true,
351
- },
352
- ],
353
- 'prefer-rest-params': 'warn',
354
- 'prefer-spread': 'warn',
355
- 'prefer-template': 'warn',
356
- 'prefer-const': 'off',
357
- 'disable-autofix/prefer-const': 'warn',
358
- 'prettier/prettier': ['warn', { parser: 'babel' }],
359
- 'quote-props': ['warn', 'as-needed'],
360
- quotes: [
361
- 'off',
362
- 'single',
363
- {
364
- allowTemplateLiterals: true,
365
- avoidEscape: true,
366
- },
367
- ],
368
- radix: 'warn',
369
- 'filenames/match-regex': 'off',
370
- 'require-atomic-updates': 'off',
371
- 'sort-imports': 'off',
372
- 'rest-spread-spacing': 'off',
373
- semi: 'off',
374
- 'sort-vars': 'warn',
375
- 'space-before-function-paren': [
376
- 'off',
377
- { anonymous: 'always', asyncArrow: 'always', named: 'never' },
378
- ],
379
- 'space-in-parens': ['off', 'never'],
380
- 'spaced-comment': [
381
- 'warn',
382
- 'always',
383
- {
384
- block: {
385
- balanced: true,
386
- exceptions: ['*'],
387
- markers: ['!'],
388
- },
389
- line: {
390
- exceptions: ['-', '+'],
391
- markers: ['/'],
392
- },
393
- },
394
- ],
395
- strict: ['warn', 'never'],
396
- 'unicode-bom': 'warn',
397
- 'unicorn/filename-case': [
398
- 'warn',
399
- {
400
- cases: {
401
- camelCase: true,
402
- pascalCase: true,
403
- },
404
- ignore: ['.*.md'],
405
- },
406
- ],
407
- 'unicorn/import-index': ['warn', { ignoreImports: true }],
408
- },
67
+ rules,
409
68
  settings: {
410
69
  'json/json-with-comments-files': [],
411
70
  polyfills: ['Promise'],
package/overrides.js ADDED
@@ -0,0 +1,281 @@
1
+ const path = require('node:path');
2
+
3
+ const ts = {
4
+ files: ['*.ts', '*.tsx'],
5
+ extends: [
6
+ 'plugin:@typescript-eslint/all',
7
+ 'plugin:@typescript-eslint/recommended-requiring-type-checking',
8
+ 'plugin:import/typescript',
9
+ ],
10
+ parser: '@typescript-eslint/parser',
11
+ parserOptions: {
12
+ ecmaFeatures: {
13
+ jsx: true,
14
+ },
15
+ ecmaVersion: 'latest',
16
+ extraFileExtensions: ['.vue', '.svelte'],
17
+ sourceType: 'module',
18
+ project: 'tsconfig.json',
19
+ tsconfigRootDir: path.join(__dirname, '../../..'),
20
+ },
21
+ plugins: ['@typescript-eslint'],
22
+ rules: {
23
+ '@typescript-eslint/class-methods-use-this': 'off',
24
+ '@typescript-eslint/consistent-type-imports': [
25
+ 'warn',
26
+ { fixStyle: 'inline-type-imports' },
27
+ ],
28
+ '@typescript-eslint/explicit-member-accessibility': [
29
+ 'warn',
30
+ {
31
+ accessibility: 'explicit',
32
+ overrides: {
33
+ accessors: 'explicit',
34
+ constructors: 'no-public',
35
+ methods: 'explicit',
36
+ properties: 'off',
37
+ parameterProperties: 'explicit',
38
+ },
39
+ },
40
+ ],
41
+ '@typescript-eslint/init-declarations': 'off',
42
+ '@typescript-eslint/max-params': 'off',
43
+ '@typescript-eslint/member-ordering': [
44
+ 'warn',
45
+ {
46
+ default: [
47
+ 'public-static-field',
48
+ 'public-static-method',
49
+ 'protected-static-field',
50
+ 'protected-static-method',
51
+ 'private-static-field',
52
+ 'private-static-method',
53
+ 'public-instance-field',
54
+ 'protected-instance-field',
55
+ 'private-instance-field',
56
+ 'public-constructor',
57
+ 'protected-constructor',
58
+ 'private-constructor',
59
+ 'public-instance-method',
60
+ 'protected-instance-method',
61
+ 'private-instance-method',
62
+ ],
63
+ },
64
+ ],
65
+ '@typescript-eslint/naming-convention': 'off',
66
+ '@typescript-eslint/no-extraneous-class': [
67
+ 'warn',
68
+ {
69
+ allowEmpty: true,
70
+ allowConstructorOnly: false,
71
+ allowStaticOnly: false,
72
+ allowWithDecorator: false,
73
+ },
74
+ ],
75
+ '@typescript-eslint/no-inferrable-types': 'off',
76
+ '@typescript-eslint/no-magic-numbers': 'off',
77
+ '@typescript-eslint/no-unnecessary-condition': 'off',
78
+ '@typescript-eslint/parameter-properties': 'off',
79
+ '@typescript-eslint/prefer-nullish-coalescing': 'off',
80
+ '@typescript-eslint/prefer-readonly': 'off',
81
+ '@typescript-eslint/prefer-readonly-parameter-types': 'off',
82
+ '@typescript-eslint/strict-boolean-expressions': 'off',
83
+ '@typescript-eslint/unbound-method': 'off',
84
+ '@typescript-eslint/use-unknown-in-catch-callback-variable': 'off',
85
+ 'prettier/prettier': ['warn', { parser: 'typescript' }],
86
+ },
87
+ settings: {
88
+ 'import/parsers': {
89
+ '@typescript-eslint/parser': ['.ts', '.tsx'],
90
+ },
91
+ 'import/resolver': {
92
+ typescript: {
93
+ alwaysTryTypes: true,
94
+ },
95
+ },
96
+ },
97
+ };
98
+
99
+ const css = {
100
+ files: ['*.css'],
101
+ rules: {
102
+ 'prettier/prettier': ['warn', { parser: 'css' }],
103
+ },
104
+ };
105
+
106
+ const scss = {
107
+ files: ['*.scss'],
108
+ rules: {
109
+ 'prettier/prettier': ['warn', { parser: 'scss' }],
110
+ },
111
+ };
112
+
113
+ const less = {
114
+ files: ['*.less'],
115
+ rules: {
116
+ 'prettier/prettier': ['warn', { parser: 'less' }],
117
+ },
118
+ };
119
+
120
+ const yaml = {
121
+ extends: ['plugin:yml/standard'],
122
+ files: ['*.yaml', '*.yml'],
123
+ parser: 'yaml-eslint-parser',
124
+ rules: {
125
+ 'yml/quotes': ['warn', { prefer: 'double', avoidEscape: true }],
126
+ 'prettier/prettier': ['warn', { parser: 'yaml', singleQuote: false }],
127
+ },
128
+ };
129
+
130
+ const toml = {
131
+ extends: ['plugin:toml/standard'],
132
+ files: ['*.toml'],
133
+ parser: 'toml-eslint-parser',
134
+ rules: {
135
+ 'prettier/prettier': 'off',
136
+ },
137
+ };
138
+
139
+ const md = {
140
+ files: ['*.md'],
141
+ parser: 'eslint-plugin-markdownlint/parser',
142
+ extends: ['plugin:markdownlint/recommended'],
143
+ rules: {
144
+ 'markdownlint/md033': 'off',
145
+ 'markdownlint/md041': 'off',
146
+ 'prettier/prettier': ['warn', { parser: 'markdown' }],
147
+ },
148
+ };
149
+
150
+ const packageJson = {
151
+ files: ['package.json'],
152
+ rules: {
153
+ 'prettier/prettier': ['warn', { parser: 'json' }],
154
+ },
155
+ settings: {
156
+ 'json/package-json-sort-order': [
157
+ 'name',
158
+ 'version',
159
+ 'description',
160
+ 'private',
161
+ 'main',
162
+ 'type',
163
+ 'types',
164
+ 'typings',
165
+ 'browser',
166
+ 'engines',
167
+ 'scripts',
168
+ 'husky',
169
+ 'dependencies',
170
+ 'devDependencies',
171
+ 'peerDependencies',
172
+ 'files',
173
+ 'bin',
174
+ 'productName',
175
+ 'homepage',
176
+ 'repository',
177
+ 'bugs',
178
+ 'license',
179
+ 'keywords',
180
+ 'author',
181
+ 'contributors',
182
+ 'funding',
183
+ ],
184
+ },
185
+ };
186
+
187
+ const mdJson = {
188
+ files: ['*.md.json'],
189
+ rules: {
190
+ 'prettier/prettier': ['warn', { parser: 'json' }],
191
+ },
192
+ };
193
+
194
+ const html = {
195
+ files: ['*.html'],
196
+ extends: ['plugin:@html-eslint/recommended'],
197
+ parser: '@html-eslint/parser',
198
+ plugins: ['@html-eslint'],
199
+ rules: {
200
+ '@html-eslint/element-newline': 'off',
201
+ '@html-eslint/indent': 'off',
202
+ '@html-eslint/no-extra-spacing-attrs': 'off',
203
+ '@html-eslint/require-closing-tags': 'off',
204
+ 'disable-autofix/@html-eslint/require-closing-tags': [
205
+ 'warn',
206
+ { selfClosing: 'always' },
207
+ ],
208
+ 'spaced-comment': 'off',
209
+ strict: 'off',
210
+ 'prettier/prettier': ['warn', { parser: 'html' }],
211
+ },
212
+ };
213
+
214
+ const jsonc = {
215
+ extends: ['plugin:jsonc/recommended-with-jsonc'],
216
+ files: ['*.jsonc', '*rc'],
217
+ parser: 'jsonc-eslint-parser',
218
+ rules: {
219
+ 'prettier/prettier': ['warn', { parser: 'json' }],
220
+ },
221
+ };
222
+
223
+ const json5 = {
224
+ extends: ['plugin:jsonc/recommended-with-json5'],
225
+ files: ['*.json5'],
226
+ parser: 'jsonc-eslint-parser',
227
+ rules: {
228
+ 'prettier/prettier': ['warn', { parser: 'json5' }],
229
+ },
230
+ };
231
+
232
+ const jestJs = {
233
+ files: ['*.test.js'],
234
+ plugins: ['jest'],
235
+ extends: ['plugin:jest/all'],
236
+ env: {
237
+ jest: true,
238
+ },
239
+ rules: {
240
+ 'unicorn/no-array-callback-reference': 'off',
241
+ 'jest/unbound-method': 'off',
242
+ },
243
+ };
244
+
245
+ const jestTs = {
246
+ files: ['*.test.ts'],
247
+ parser: '@typescript-eslint/parser',
248
+ plugins: ['@typescript-eslint', 'jest'],
249
+ extends: ['plugin:jest/all'],
250
+ env: {
251
+ jest: true,
252
+ },
253
+ rules: {
254
+ 'unicorn/no-array-callback-reference': 'off',
255
+ 'jest/unbound-method': 'off',
256
+ },
257
+ };
258
+
259
+ const cypress = {
260
+ files: ['*.cy.*'],
261
+ plugins: ['cypress'],
262
+ extends: ['plugin:cypress/recommended'],
263
+ };
264
+
265
+ module.exports = {
266
+ ts,
267
+ css,
268
+ scss,
269
+ less,
270
+ yaml,
271
+ toml,
272
+ md,
273
+ packageJson,
274
+ mdJson,
275
+ html,
276
+ jsonc,
277
+ json5,
278
+ jestJs,
279
+ jestTs,
280
+ cypress,
281
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mikey-pro/eslint-config",
3
- "version": "7.4.0",
3
+ "version": "7.5.0",
4
4
  "description": "Mikey Pro ESLint configuration",
5
5
  "main": "index.js",
6
6
  "dependencies": {
@@ -11,19 +11,19 @@
11
11
  "@cypress/eslint-plugin-json": "^3.2.3",
12
12
  "@html-eslint/eslint-plugin": "^0.24.1",
13
13
  "@html-eslint/parser": "^0.24.1",
14
- "@typescript-eslint/eslint-plugin": "^7.6.0",
15
- "@typescript-eslint/parser": "^7.6.0",
14
+ "@typescript-eslint/eslint-plugin": "^7.7.1",
15
+ "@typescript-eslint/parser": "^7.7.1",
16
16
  "eslint-config-prettier": "^9.1",
17
17
  "eslint-import-resolver-typescript": "^3.6.1",
18
18
  "eslint-plugin-compat": "^4.2",
19
19
  "eslint-plugin-css-modules": "^2.12",
20
- "eslint-plugin-cypress": "^2.15.1",
20
+ "eslint-plugin-cypress": "^3.0.2",
21
21
  "eslint-plugin-disable-autofix": "^4.3.0",
22
22
  "eslint-plugin-import": "^2.29.1",
23
- "eslint-plugin-jest": "^28.2.0",
23
+ "eslint-plugin-jest": "^28.3.0",
24
24
  "eslint-plugin-jsonc": "^2.15.1",
25
25
  "eslint-plugin-markdownlint": "^0.5.0",
26
- "eslint-plugin-n": "^17.2.0",
26
+ "eslint-plugin-n": "^17.3.1",
27
27
  "eslint-plugin-only-warn": "^1.1.0",
28
28
  "eslint-plugin-prettier": "^5.1",
29
29
  "eslint-plugin-promise": "^6.1.1",
@@ -36,6 +36,7 @@
36
36
  },
37
37
  "files": [
38
38
  "index.js",
39
+ "overrides.js",
39
40
  "README.md",
40
41
  "LICENSE"
41
42
  ],