@mikey-pro/eslint-config 10.3.4 → 10.3.7
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/base-config.js +15 -4
- package/overrides.js +46 -4
- package/package.json +1 -1
package/base-config.js
CHANGED
|
@@ -63,7 +63,7 @@ export const globalPlugins = {
|
|
|
63
63
|
};
|
|
64
64
|
|
|
65
65
|
export const baseConfig = {
|
|
66
|
-
files: ['**/*.{js,jsx,ts,tsx,mjs,cjs}'],
|
|
66
|
+
files: ['**/*.{js,jsx,ts,tsx,mjs,cjs,mts,cts}'],
|
|
67
67
|
languageOptions: {
|
|
68
68
|
ecmaVersion: 'latest',
|
|
69
69
|
globals: {
|
|
@@ -117,9 +117,19 @@ export const baseConfig = {
|
|
|
117
117
|
'error',
|
|
118
118
|
{
|
|
119
119
|
devDependencies: [
|
|
120
|
-
'**/*.test.{js,ts}',
|
|
121
|
-
'
|
|
120
|
+
'**/*.{test,spec}.{js,jsx,mjs,cjs,ts,tsx,mts,cts}',
|
|
121
|
+
'**/__tests__/**',
|
|
122
|
+
'**/__mocks__/**',
|
|
122
123
|
'**/test/**',
|
|
124
|
+
'**/tests/**',
|
|
125
|
+
'**/{test,vitest,jest}.setup.*',
|
|
126
|
+
'**/setupTests.*',
|
|
127
|
+
'**/testSetup.*',
|
|
128
|
+
'**/vitest.config.*',
|
|
129
|
+
'**/vite.config.*',
|
|
130
|
+
'**/jest.config.*',
|
|
131
|
+
'**/playwright.config.*',
|
|
132
|
+
'**/cypress.config.*',
|
|
123
133
|
],
|
|
124
134
|
},
|
|
125
135
|
],
|
|
@@ -381,7 +391,8 @@ export const baseConfig = {
|
|
|
381
391
|
'sort-imports': 'off',
|
|
382
392
|
|
|
383
393
|
'sort-vars': 'warn',
|
|
384
|
-
|
|
394
|
+
// markers: ['/'] exempts TypeScript triple-slash directives (`/// <reference />`)
|
|
395
|
+
'spaced-comment': ['warn', 'always', { markers: ['/'] }],
|
|
385
396
|
strict: ['error', 'never'],
|
|
386
397
|
'symbol-description': 'error',
|
|
387
398
|
|
package/overrides.js
CHANGED
|
@@ -17,7 +17,7 @@ import * as yamlParser from 'yaml-eslint-parser';
|
|
|
17
17
|
|
|
18
18
|
// TypeScript configuration
|
|
19
19
|
export const ts = {
|
|
20
|
-
files: ['**/*.ts', '**/*.tsx'],
|
|
20
|
+
files: ['**/*.ts', '**/*.tsx', '**/*.mts', '**/*.cts'],
|
|
21
21
|
languageOptions: {
|
|
22
22
|
ecmaVersion: 'latest',
|
|
23
23
|
parser: tsParser,
|
|
@@ -195,10 +195,20 @@ export const ts = {
|
|
|
195
195
|
'@typescript-eslint/switch-exhaustiveness-check': 'error',
|
|
196
196
|
'@typescript-eslint/unbound-method': 'off',
|
|
197
197
|
'@typescript-eslint/use-unknown-in-catch-callback-variable': 'off',
|
|
198
|
+
// Override base config's babel parser for TypeScript files
|
|
199
|
+
'prettier/prettier': [
|
|
200
|
+
'warn',
|
|
201
|
+
{
|
|
202
|
+
endOfLine: 'lf',
|
|
203
|
+
parser: 'typescript',
|
|
204
|
+
singleQuote: true,
|
|
205
|
+
trailingComma: 'all',
|
|
206
|
+
},
|
|
207
|
+
],
|
|
198
208
|
},
|
|
199
209
|
settings: {
|
|
200
210
|
'import-x/parsers': {
|
|
201
|
-
'@typescript-eslint/parser': ['.ts', '.tsx', '.d.ts'],
|
|
211
|
+
'@typescript-eslint/parser': ['.ts', '.tsx', '.mts', '.cts', '.d.ts'],
|
|
202
212
|
},
|
|
203
213
|
'import-x/resolver': {
|
|
204
214
|
typescript: { alwaysTryTypes: true },
|
|
@@ -389,7 +399,11 @@ export const json5 = {
|
|
|
389
399
|
|
|
390
400
|
// Jest JavaScript files
|
|
391
401
|
export const jestJs = {
|
|
392
|
-
files: [
|
|
402
|
+
files: [
|
|
403
|
+
'**/*.{test,spec}.{js,jsx,mjs,cjs}',
|
|
404
|
+
'**/__tests__/**/*.{js,jsx,mjs,cjs}',
|
|
405
|
+
'**/__mocks__/**/*.{js,jsx,mjs,cjs}',
|
|
406
|
+
],
|
|
393
407
|
languageOptions: {
|
|
394
408
|
globals: { jest: true },
|
|
395
409
|
},
|
|
@@ -432,14 +446,36 @@ export const jestJs = {
|
|
|
432
446
|
'unicorn/no-array-callback-reference': 'off',
|
|
433
447
|
'unicorn/prevent-abbreviations': ['warn', { ignore: [/e2e/] }],
|
|
434
448
|
},
|
|
449
|
+
settings: {
|
|
450
|
+
jest: {
|
|
451
|
+
// Recognize Vitest's import { describe, it, expect } from 'vitest' as test globals
|
|
452
|
+
globalPackage: 'vitest',
|
|
453
|
+
},
|
|
454
|
+
},
|
|
435
455
|
};
|
|
436
456
|
|
|
437
457
|
// Jest TypeScript files
|
|
438
458
|
export const jestTs = {
|
|
439
|
-
files: [
|
|
459
|
+
files: [
|
|
460
|
+
'**/*.{test,spec}.{ts,tsx,mts,cts}',
|
|
461
|
+
'**/__tests__/**/*.{ts,tsx,mts,cts}',
|
|
462
|
+
'**/__mocks__/**/*.{ts,tsx,mts,cts}',
|
|
463
|
+
],
|
|
440
464
|
languageOptions: {
|
|
441
465
|
globals: { jest: true },
|
|
442
466
|
parser: tsParser,
|
|
467
|
+
// Preserve the `ts` override's JSX + type-aware parserOptions (overrides.js:20-29).
|
|
468
|
+
// Flat config merges languageOptions per matching block in array order; this
|
|
469
|
+
// block matches after `ts`, and without an explicit parserOptions here a naive
|
|
470
|
+
// merge could drop JSX support for `.test.tsx`/`.spec.tsx` files. ESLint 10's
|
|
471
|
+
// languageOptions merge actually preserves keys the later block omits, but this
|
|
472
|
+
// is pinned explicitly so the behavior doesn't silently depend on merge internals.
|
|
473
|
+
parserOptions: {
|
|
474
|
+
ecmaFeatures: { jsx: true },
|
|
475
|
+
extraFileExtensions: ['.vue', '.svelte'],
|
|
476
|
+
project: true,
|
|
477
|
+
tsconfigRootDir: process.cwd(),
|
|
478
|
+
},
|
|
443
479
|
},
|
|
444
480
|
rules: {
|
|
445
481
|
...jest.configs['flat/all'].rules,
|
|
@@ -476,6 +512,12 @@ export const jestTs = {
|
|
|
476
512
|
'unicorn/no-array-callback-reference': 'off',
|
|
477
513
|
'unicorn/prevent-abbreviations': ['warn', { ignore: [/e2e/] }],
|
|
478
514
|
},
|
|
515
|
+
settings: {
|
|
516
|
+
jest: {
|
|
517
|
+
// Recognize Vitest's import { describe, it, expect } from 'vitest' as test globals
|
|
518
|
+
globalPackage: 'vitest',
|
|
519
|
+
},
|
|
520
|
+
},
|
|
479
521
|
};
|
|
480
522
|
|
|
481
523
|
// Cypress files
|