@mikey-pro/eslint-config 10.3.4 → 10.3.8

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 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
- '**/*.spec.{js,ts}',
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
  ],
@@ -140,10 +150,20 @@ export const baseConfig = {
140
150
  ],
141
151
  'import-x/no-useless-path-segments': 'error',
142
152
  'import-x/no-webpack-loader-syntax': 'error',
153
+ // Must agree with simple-import-sort/imports (node: builtins, packages,
154
+ // then aliases like @/, then relative with parent/sibling/index merged).
155
+ // simple-import-sort owns ordering within a group (no alphabetize here:
156
+ // it would put '.' before '../x', the opposite of simple-import-sort), and
157
+ // scoped packages (@scope/pkg) sort among externals, so no '@*' pathGroup.
143
158
  'import-x/order': [
144
159
  'error',
145
160
  {
146
- alphabetize: { order: 'asc' },
161
+ groups: [
162
+ 'builtin',
163
+ 'external',
164
+ 'internal',
165
+ ['parent', 'sibling', 'index'],
166
+ ],
147
167
  'newlines-between': 'always',
148
168
  pathGroups: [
149
169
  {
@@ -151,15 +171,9 @@ export const baseConfig = {
151
171
  pattern: 'node:*',
152
172
  position: 'before',
153
173
  },
154
- {
155
- group: 'external',
156
- pattern: '@*',
157
- position: 'after',
158
- },
159
174
  {
160
175
  group: 'internal',
161
- pattern: '@/**',
162
- position: 'after',
176
+ pattern: '{@,~}/**',
163
177
  },
164
178
  ],
165
179
  pathGroupsExcludedImportTypes: ['builtin'],
@@ -381,7 +395,8 @@ export const baseConfig = {
381
395
  'sort-imports': 'off',
382
396
 
383
397
  'sort-vars': 'warn',
384
- 'spaced-comment': ['warn', 'always'],
398
+ // markers: ['/'] exempts TypeScript triple-slash directives (`/// <reference />`)
399
+ 'spaced-comment': ['warn', 'always', { markers: ['/'] }],
385
400
  strict: ['error', 'never'],
386
401
  'symbol-description': 'error',
387
402
 
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: ['**/*.test.js', '**/__tests__/**/*.js'],
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: ['**/*.test.ts', '**/__tests__/**/*.ts'],
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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mikey-pro/eslint-config",
3
- "version": "10.3.4",
3
+ "version": "10.3.8",
4
4
  "description": "Mikey Pro ESLint configuration - Ultimate coding style guide for excellence",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",