eslint-config-decent 4.2.4 → 4.2.6
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/dist/oxlint.cjs +0 -14
- package/dist/oxlint.d.cts +3 -24
- package/dist/oxlint.d.mts +3 -24
- package/dist/oxlint.d.ts +3 -24
- package/dist/oxlint.mjs +0 -14
- package/package.json +2 -1
- package/src/oxlint.ts +28 -92
package/dist/oxlint.cjs
CHANGED
|
@@ -234,18 +234,6 @@ const importRules = {
|
|
|
234
234
|
"import/first": "error",
|
|
235
235
|
"import/no-duplicates": "error"
|
|
236
236
|
};
|
|
237
|
-
const importCompatRules = {
|
|
238
|
-
"import-compat/newline-after-import": "error",
|
|
239
|
-
"import-compat/order": [
|
|
240
|
-
"error",
|
|
241
|
-
{
|
|
242
|
-
"newlines-between": "always",
|
|
243
|
-
alphabetize: { order: "asc", caseInsensitive: true },
|
|
244
|
-
pathGroupsExcludedImportTypes: ["builtin"],
|
|
245
|
-
groups: ["builtin", "external", "internal", "parent", "sibling", "index"]
|
|
246
|
-
}
|
|
247
|
-
]
|
|
248
|
-
};
|
|
249
237
|
const unicornRules = {
|
|
250
238
|
"unicorn/no-array-method-this-argument": "error",
|
|
251
239
|
"unicorn/prefer-array-find": "error",
|
|
@@ -544,7 +532,6 @@ function oxlintConfig(options) {
|
|
|
544
532
|
"eslint-plugin-security",
|
|
545
533
|
// -compat JS plugins for gap rules in partially-supported native plugins
|
|
546
534
|
{ name: "eslint-compat", specifier: "oxlint-plugin-eslint" },
|
|
547
|
-
{ name: "import-compat", specifier: "eslint-plugin-import-x" },
|
|
548
535
|
{ name: "unicorn-compat", specifier: "eslint-plugin-unicorn" },
|
|
549
536
|
{ name: "jsdoc-compat", specifier: "eslint-plugin-jsdoc" },
|
|
550
537
|
{ name: "stylistic-compat", specifier: "@stylistic/eslint-plugin" },
|
|
@@ -562,7 +549,6 @@ function oxlintConfig(options) {
|
|
|
562
549
|
...eslintCompatRules,
|
|
563
550
|
...typescriptRules,
|
|
564
551
|
...importRules,
|
|
565
|
-
...importCompatRules,
|
|
566
552
|
...unicornRules,
|
|
567
553
|
...unicornCompatRules,
|
|
568
554
|
...promiseRules,
|
package/dist/oxlint.d.cts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { OxlintConfig } from 'oxlint';
|
|
2
|
+
|
|
1
3
|
interface OxlintConfigOptions {
|
|
2
4
|
enableReact?: boolean;
|
|
3
5
|
enableVitest?: boolean;
|
|
@@ -6,30 +8,7 @@ interface OxlintConfigOptions {
|
|
|
6
8
|
nextJsRootDir?: string;
|
|
7
9
|
reactVersion?: string;
|
|
8
10
|
}
|
|
9
|
-
type RuleSeverity = 'error' | 'off' | 'warn';
|
|
10
|
-
type RuleEntry = RuleSeverity | [RuleSeverity, ...unknown[]];
|
|
11
|
-
type JsPlugin = string | {
|
|
12
|
-
name: string;
|
|
13
|
-
specifier: string;
|
|
14
|
-
};
|
|
15
|
-
interface OxlintOverride {
|
|
16
|
-
files: string[];
|
|
17
|
-
rules?: Record<string, RuleEntry>;
|
|
18
|
-
jsPlugins?: JsPlugin[];
|
|
19
|
-
}
|
|
20
|
-
interface OxlintConfig {
|
|
21
|
-
plugins: string[];
|
|
22
|
-
jsPlugins?: JsPlugin[];
|
|
23
|
-
rules: Record<string, RuleEntry>;
|
|
24
|
-
options?: {
|
|
25
|
-
typeAware?: boolean;
|
|
26
|
-
};
|
|
27
|
-
settings?: Record<string, unknown>;
|
|
28
|
-
overrides?: OxlintOverride[];
|
|
29
|
-
ignorePatterns?: string[];
|
|
30
|
-
env?: Record<string, boolean>;
|
|
31
|
-
}
|
|
32
11
|
declare function oxlintConfig(options?: OxlintConfigOptions): OxlintConfig;
|
|
33
12
|
|
|
34
13
|
export { oxlintConfig };
|
|
35
|
-
export type {
|
|
14
|
+
export type { OxlintConfigOptions };
|
package/dist/oxlint.d.mts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { OxlintConfig } from 'oxlint';
|
|
2
|
+
|
|
1
3
|
interface OxlintConfigOptions {
|
|
2
4
|
enableReact?: boolean;
|
|
3
5
|
enableVitest?: boolean;
|
|
@@ -6,30 +8,7 @@ interface OxlintConfigOptions {
|
|
|
6
8
|
nextJsRootDir?: string;
|
|
7
9
|
reactVersion?: string;
|
|
8
10
|
}
|
|
9
|
-
type RuleSeverity = 'error' | 'off' | 'warn';
|
|
10
|
-
type RuleEntry = RuleSeverity | [RuleSeverity, ...unknown[]];
|
|
11
|
-
type JsPlugin = string | {
|
|
12
|
-
name: string;
|
|
13
|
-
specifier: string;
|
|
14
|
-
};
|
|
15
|
-
interface OxlintOverride {
|
|
16
|
-
files: string[];
|
|
17
|
-
rules?: Record<string, RuleEntry>;
|
|
18
|
-
jsPlugins?: JsPlugin[];
|
|
19
|
-
}
|
|
20
|
-
interface OxlintConfig {
|
|
21
|
-
plugins: string[];
|
|
22
|
-
jsPlugins?: JsPlugin[];
|
|
23
|
-
rules: Record<string, RuleEntry>;
|
|
24
|
-
options?: {
|
|
25
|
-
typeAware?: boolean;
|
|
26
|
-
};
|
|
27
|
-
settings?: Record<string, unknown>;
|
|
28
|
-
overrides?: OxlintOverride[];
|
|
29
|
-
ignorePatterns?: string[];
|
|
30
|
-
env?: Record<string, boolean>;
|
|
31
|
-
}
|
|
32
11
|
declare function oxlintConfig(options?: OxlintConfigOptions): OxlintConfig;
|
|
33
12
|
|
|
34
13
|
export { oxlintConfig };
|
|
35
|
-
export type {
|
|
14
|
+
export type { OxlintConfigOptions };
|
package/dist/oxlint.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { OxlintConfig } from 'oxlint';
|
|
2
|
+
|
|
1
3
|
interface OxlintConfigOptions {
|
|
2
4
|
enableReact?: boolean;
|
|
3
5
|
enableVitest?: boolean;
|
|
@@ -6,30 +8,7 @@ interface OxlintConfigOptions {
|
|
|
6
8
|
nextJsRootDir?: string;
|
|
7
9
|
reactVersion?: string;
|
|
8
10
|
}
|
|
9
|
-
type RuleSeverity = 'error' | 'off' | 'warn';
|
|
10
|
-
type RuleEntry = RuleSeverity | [RuleSeverity, ...unknown[]];
|
|
11
|
-
type JsPlugin = string | {
|
|
12
|
-
name: string;
|
|
13
|
-
specifier: string;
|
|
14
|
-
};
|
|
15
|
-
interface OxlintOverride {
|
|
16
|
-
files: string[];
|
|
17
|
-
rules?: Record<string, RuleEntry>;
|
|
18
|
-
jsPlugins?: JsPlugin[];
|
|
19
|
-
}
|
|
20
|
-
interface OxlintConfig {
|
|
21
|
-
plugins: string[];
|
|
22
|
-
jsPlugins?: JsPlugin[];
|
|
23
|
-
rules: Record<string, RuleEntry>;
|
|
24
|
-
options?: {
|
|
25
|
-
typeAware?: boolean;
|
|
26
|
-
};
|
|
27
|
-
settings?: Record<string, unknown>;
|
|
28
|
-
overrides?: OxlintOverride[];
|
|
29
|
-
ignorePatterns?: string[];
|
|
30
|
-
env?: Record<string, boolean>;
|
|
31
|
-
}
|
|
32
11
|
declare function oxlintConfig(options?: OxlintConfigOptions): OxlintConfig;
|
|
33
12
|
|
|
34
13
|
export { oxlintConfig };
|
|
35
|
-
export type {
|
|
14
|
+
export type { OxlintConfigOptions };
|
package/dist/oxlint.mjs
CHANGED
|
@@ -232,18 +232,6 @@ const importRules = {
|
|
|
232
232
|
"import/first": "error",
|
|
233
233
|
"import/no-duplicates": "error"
|
|
234
234
|
};
|
|
235
|
-
const importCompatRules = {
|
|
236
|
-
"import-compat/newline-after-import": "error",
|
|
237
|
-
"import-compat/order": [
|
|
238
|
-
"error",
|
|
239
|
-
{
|
|
240
|
-
"newlines-between": "always",
|
|
241
|
-
alphabetize: { order: "asc", caseInsensitive: true },
|
|
242
|
-
pathGroupsExcludedImportTypes: ["builtin"],
|
|
243
|
-
groups: ["builtin", "external", "internal", "parent", "sibling", "index"]
|
|
244
|
-
}
|
|
245
|
-
]
|
|
246
|
-
};
|
|
247
235
|
const unicornRules = {
|
|
248
236
|
"unicorn/no-array-method-this-argument": "error",
|
|
249
237
|
"unicorn/prefer-array-find": "error",
|
|
@@ -542,7 +530,6 @@ function oxlintConfig(options) {
|
|
|
542
530
|
"eslint-plugin-security",
|
|
543
531
|
// -compat JS plugins for gap rules in partially-supported native plugins
|
|
544
532
|
{ name: "eslint-compat", specifier: "oxlint-plugin-eslint" },
|
|
545
|
-
{ name: "import-compat", specifier: "eslint-plugin-import-x" },
|
|
546
533
|
{ name: "unicorn-compat", specifier: "eslint-plugin-unicorn" },
|
|
547
534
|
{ name: "jsdoc-compat", specifier: "eslint-plugin-jsdoc" },
|
|
548
535
|
{ name: "stylistic-compat", specifier: "@stylistic/eslint-plugin" },
|
|
@@ -560,7 +547,6 @@ function oxlintConfig(options) {
|
|
|
560
547
|
...eslintCompatRules,
|
|
561
548
|
...typescriptRules,
|
|
562
549
|
...importRules,
|
|
563
|
-
...importCompatRules,
|
|
564
550
|
...unicornRules,
|
|
565
551
|
...unicornCompatRules,
|
|
566
552
|
...promiseRules,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-config-decent",
|
|
3
|
-
"version": "4.2.
|
|
3
|
+
"version": "4.2.6",
|
|
4
4
|
"description": "A decent ESLint configuration",
|
|
5
5
|
"main": "./dist/index.cjs",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -127,6 +127,7 @@
|
|
|
127
127
|
"lint-staged": "16.3.3",
|
|
128
128
|
"markdownlint-cli": "0.48.0",
|
|
129
129
|
"npm-run-all2": "8.0.4",
|
|
130
|
+
"oxlint": "1.53.0",
|
|
130
131
|
"pinst": "3.0.0",
|
|
131
132
|
"prettier": "3.8.1",
|
|
132
133
|
"semantic-release": "25.0.3",
|
package/src/oxlint.ts
CHANGED
|
@@ -1,12 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
// Generates an oxlint-compatible config mirroring eslint-config-decent rules.
|
|
3
|
-
//
|
|
4
|
-
// Prefix mappings: @typescript-eslint/ → typescript/, react-hooks/ → react/, @next/next/ → nextjs/
|
|
5
|
-
//
|
|
6
|
-
// Native plugins handle rules oxlint implements in Rust.
|
|
7
|
-
// -compat JS plugins handle gap rules not yet natively supported (ESLint plugin running in oxlint's JS runtime).
|
|
8
|
-
// Standalone JS plugins handle plugins with no native support (security, testing-library).
|
|
9
|
-
// Stylistic rules (@stylistic/*) and custom decent-extension rules are excluded (ESLint-only).
|
|
1
|
+
import { type DummyRule, type ExternalPluginEntry, type OxlintConfig, type OxlintOverride } from 'oxlint';
|
|
10
2
|
|
|
11
3
|
export interface OxlintConfigOptions {
|
|
12
4
|
enableReact?: boolean;
|
|
@@ -17,40 +9,13 @@ export interface OxlintConfigOptions {
|
|
|
17
9
|
reactVersion?: string;
|
|
18
10
|
}
|
|
19
11
|
|
|
20
|
-
type RuleSeverity = 'error' | 'off' | 'warn';
|
|
21
|
-
type RuleEntry = RuleSeverity | [RuleSeverity, ...unknown[]];
|
|
22
|
-
|
|
23
|
-
type JsPlugin = string | { name: string; specifier: string };
|
|
24
|
-
|
|
25
|
-
export interface OxlintOverride {
|
|
26
|
-
files: string[];
|
|
27
|
-
rules?: Record<string, RuleEntry>;
|
|
28
|
-
jsPlugins?: JsPlugin[];
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export interface OxlintConfig {
|
|
32
|
-
plugins: string[];
|
|
33
|
-
jsPlugins?: JsPlugin[];
|
|
34
|
-
rules: Record<string, RuleEntry>;
|
|
35
|
-
options?: {
|
|
36
|
-
typeAware?: boolean;
|
|
37
|
-
};
|
|
38
|
-
settings?: Record<string, unknown>;
|
|
39
|
-
overrides?: OxlintOverride[];
|
|
40
|
-
ignorePatterns?: string[];
|
|
41
|
-
env?: Record<string, boolean>;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
// ─── File glob constants ───────────────────────────────────────────────────
|
|
45
|
-
|
|
46
12
|
// Matches ESLint vitest config: **/*.{spec,test}.ts?(x)
|
|
47
13
|
const VITEST_FILE_GLOBS = ['**/__tests__/**/*.ts', '**/__tests__/**/*.tsx', '**/*.spec.ts', '**/*.spec.tsx', '**/*.test.ts', '**/*.test.tsx'];
|
|
48
14
|
|
|
49
15
|
// Matches ESLint testing-library + test TS relaxation config: **/*.{spec,test,tests}.ts?(x)
|
|
50
16
|
const TEST_FILE_GLOBS = [...VITEST_FILE_GLOBS, '**/*.tests.ts', '**/*.tests.tsx'];
|
|
51
17
|
|
|
52
|
-
|
|
53
|
-
const eslintBaseRules: Record<string, RuleEntry> = {
|
|
18
|
+
const eslintBaseRules: Record<string, DummyRule> = {
|
|
54
19
|
'eslint/array-callback-return': ['error', { allowImplicit: true }],
|
|
55
20
|
'eslint/block-scoped-var': 'error',
|
|
56
21
|
'eslint/default-case': ['error', { commentPattern: '^no default$' }],
|
|
@@ -128,7 +93,7 @@ const eslintBaseRules: Record<string, RuleEntry> = {
|
|
|
128
93
|
};
|
|
129
94
|
|
|
130
95
|
// CJS/ESM rules that also apply to TS files via typescript extensions
|
|
131
|
-
const eslintCjsEsmRules: Record<string,
|
|
96
|
+
const eslintCjsEsmRules: Record<string, DummyRule> = {
|
|
132
97
|
'eslint/curly': ['error', 'multi-line'],
|
|
133
98
|
'eslint/dot-notation': ['error', { allowKeywords: true }],
|
|
134
99
|
'eslint/getter-return': ['error', { allowImplicit: true }],
|
|
@@ -144,7 +109,7 @@ const eslintCjsEsmRules: Record<string, RuleEntry> = {
|
|
|
144
109
|
};
|
|
145
110
|
|
|
146
111
|
// Gap core ESLint rules not yet natively supported — covered via eslint-compat JS plugin (oxlint-plugin-eslint)
|
|
147
|
-
const eslintCompatRules: Record<string,
|
|
112
|
+
const eslintCompatRules: Record<string, DummyRule> = {
|
|
148
113
|
'eslint-compat/object-shorthand': ['error', 'always', { ignoreConstructors: false, avoidQuotes: true, avoidExplicitReturnArrows: true }],
|
|
149
114
|
'eslint-compat/one-var': ['error', 'never'],
|
|
150
115
|
'eslint-compat/no-octal-escape': 'error',
|
|
@@ -160,8 +125,7 @@ const eslintCompatRules: Record<string, RuleEntry> = {
|
|
|
160
125
|
'eslint-compat/no-unreachable-loop': ['error', { ignore: [] }],
|
|
161
126
|
};
|
|
162
127
|
|
|
163
|
-
|
|
164
|
-
const typescriptRules: Record<string, RuleEntry> = {
|
|
128
|
+
const typescriptRules: Record<string, DummyRule> = {
|
|
165
129
|
// Disable base ESLint rules that TS extends
|
|
166
130
|
'eslint/no-loss-of-precision': 'off',
|
|
167
131
|
'eslint/no-unused-expressions': 'off',
|
|
@@ -285,29 +249,13 @@ const typescriptRules: Record<string, RuleEntry> = {
|
|
|
285
249
|
'typescript/use-unknown-in-catch-callback-variable': 'off',
|
|
286
250
|
};
|
|
287
251
|
|
|
288
|
-
|
|
289
|
-
const importRules: Record<string, RuleEntry> = {
|
|
252
|
+
const importRules: Record<string, DummyRule> = {
|
|
290
253
|
'import/consistent-type-specifier-style': ['error', 'prefer-inline'],
|
|
291
254
|
'import/first': 'error',
|
|
292
255
|
'import/no-duplicates': 'error',
|
|
293
256
|
};
|
|
294
257
|
|
|
295
|
-
|
|
296
|
-
const importCompatRules: Record<string, RuleEntry> = {
|
|
297
|
-
'import-compat/newline-after-import': 'error',
|
|
298
|
-
'import-compat/order': [
|
|
299
|
-
'error',
|
|
300
|
-
{
|
|
301
|
-
'newlines-between': 'always',
|
|
302
|
-
alphabetize: { order: 'asc', caseInsensitive: true },
|
|
303
|
-
pathGroupsExcludedImportTypes: ['builtin'],
|
|
304
|
-
groups: ['builtin', 'external', 'internal', 'parent', 'sibling', 'index'],
|
|
305
|
-
},
|
|
306
|
-
],
|
|
307
|
-
};
|
|
308
|
-
|
|
309
|
-
// ─── Unicorn rules (src/unicorn.ts) ────────────────────────────────────────
|
|
310
|
-
const unicornRules: Record<string, RuleEntry> = {
|
|
258
|
+
const unicornRules: Record<string, DummyRule> = {
|
|
311
259
|
'unicorn/no-array-method-this-argument': 'error',
|
|
312
260
|
'unicorn/prefer-array-find': 'error',
|
|
313
261
|
'unicorn/prefer-node-protocol': 'error',
|
|
@@ -316,21 +264,19 @@ const unicornRules: Record<string, RuleEntry> = {
|
|
|
316
264
|
};
|
|
317
265
|
|
|
318
266
|
// Gap rules not yet natively supported — covered via unicorn-compat JS plugin
|
|
319
|
-
const unicornCompatRules: Record<string,
|
|
267
|
+
const unicornCompatRules: Record<string, DummyRule> = {
|
|
320
268
|
'unicorn-compat/better-regex': 'error',
|
|
321
269
|
'unicorn-compat/custom-error-definition': 'error',
|
|
322
270
|
'unicorn-compat/no-for-loop': 'error',
|
|
323
271
|
};
|
|
324
272
|
|
|
325
|
-
|
|
326
|
-
const promiseRules: Record<string, RuleEntry> = {
|
|
273
|
+
const promiseRules: Record<string, DummyRule> = {
|
|
327
274
|
'promise/always-return': 'error',
|
|
328
275
|
'promise/catch-or-return': ['error', { allowThen: true }],
|
|
329
276
|
'promise/param-names': 'error',
|
|
330
277
|
};
|
|
331
278
|
|
|
332
|
-
|
|
333
|
-
const jsdocRules: Record<string, RuleEntry> = {
|
|
279
|
+
const jsdocRules: Record<string, DummyRule> = {
|
|
334
280
|
// Explicitly configured
|
|
335
281
|
'jsdoc/check-param-names': 'off',
|
|
336
282
|
'jsdoc/check-tag-names': 'error',
|
|
@@ -361,7 +307,7 @@ const jsdocRules: Record<string, RuleEntry> = {
|
|
|
361
307
|
};
|
|
362
308
|
|
|
363
309
|
// Gap rules not yet natively supported — covered via jsdoc-compat JS plugin
|
|
364
|
-
const jsdocCompatRules: Record<string,
|
|
310
|
+
const jsdocCompatRules: Record<string, DummyRule> = {
|
|
365
311
|
'jsdoc-compat/check-alignment': 'error',
|
|
366
312
|
'jsdoc-compat/check-indentation': 'error',
|
|
367
313
|
'jsdoc-compat/check-types': 'error',
|
|
@@ -369,10 +315,9 @@ const jsdocCompatRules: Record<string, RuleEntry> = {
|
|
|
369
315
|
'jsdoc-compat/valid-types': 'error',
|
|
370
316
|
};
|
|
371
317
|
|
|
372
|
-
// ─── Stylistic rules (src/stylistic.ts) ─────────────────────────────────────
|
|
373
318
|
// Most stylistic rules are formatting-only (handled by oxfmt/Prettier). The one structural
|
|
374
319
|
// rule that formatters don't handle is padding-line-between-statements.
|
|
375
|
-
const stylisticCompatRules: Record<string,
|
|
320
|
+
const stylisticCompatRules: Record<string, DummyRule> = {
|
|
376
321
|
'stylistic-compat/padding-line-between-statements': [
|
|
377
322
|
'error',
|
|
378
323
|
{
|
|
@@ -413,8 +358,7 @@ const stylisticCompatRules: Record<string, RuleEntry> = {
|
|
|
413
358
|
],
|
|
414
359
|
};
|
|
415
360
|
|
|
416
|
-
|
|
417
|
-
const securityRules: Record<string, RuleEntry> = {
|
|
361
|
+
const securityRules: Record<string, DummyRule> = {
|
|
418
362
|
'security/detect-buffer-noassert': 'error',
|
|
419
363
|
'security/detect-child-process': 'error',
|
|
420
364
|
'security/detect-disable-mustache-escape': 'error',
|
|
@@ -430,8 +374,7 @@ const securityRules: Record<string, RuleEntry> = {
|
|
|
430
374
|
'security/detect-unsafe-regex': 'error',
|
|
431
375
|
};
|
|
432
376
|
|
|
433
|
-
|
|
434
|
-
const reactRules: Record<string, RuleEntry> = {
|
|
377
|
+
const reactRules: Record<string, DummyRule> = {
|
|
435
378
|
// From react.configs.recommended
|
|
436
379
|
'react/jsx-key': 'error',
|
|
437
380
|
'react/jsx-no-comment-textnodes': 'error',
|
|
@@ -470,7 +413,7 @@ const reactRules: Record<string, RuleEntry> = {
|
|
|
470
413
|
};
|
|
471
414
|
|
|
472
415
|
// Gap rules not yet natively supported — covered via react-compat JS plugin
|
|
473
|
-
const reactCompatRules: Record<string,
|
|
416
|
+
const reactCompatRules: Record<string, DummyRule> = {
|
|
474
417
|
'react-compat/default-props-match-prop-types': 'error',
|
|
475
418
|
'react-compat/forbid-foreign-prop-types': ['error', { allowInPropTypes: true }],
|
|
476
419
|
'react-compat/jsx-no-leaked-render': ['error', { validStrategies: ['ternary'] }],
|
|
@@ -488,8 +431,7 @@ const reactCompatRules: Record<string, RuleEntry> = {
|
|
|
488
431
|
// Formatting rules excluded: jsx-closing-bracket-location, jsx-props-no-multi-spaces
|
|
489
432
|
};
|
|
490
433
|
|
|
491
|
-
|
|
492
|
-
const jsxA11yRules: Record<string, RuleEntry> = {
|
|
434
|
+
const jsxA11yRules: Record<string, DummyRule> = {
|
|
493
435
|
'jsx-a11y/alt-text': 'error',
|
|
494
436
|
'jsx-a11y/anchor-has-content': 'error',
|
|
495
437
|
'jsx-a11y/anchor-is-valid': 'error',
|
|
@@ -521,8 +463,7 @@ const jsxA11yRules: Record<string, RuleEntry> = {
|
|
|
521
463
|
'jsx-a11y/tabindex-no-positive': 'error',
|
|
522
464
|
};
|
|
523
465
|
|
|
524
|
-
|
|
525
|
-
const nextjsRules: Record<string, RuleEntry> = {
|
|
466
|
+
const nextjsRules: Record<string, DummyRule> = {
|
|
526
467
|
'nextjs/google-font-display': 'error',
|
|
527
468
|
'nextjs/google-font-preconnect': 'error',
|
|
528
469
|
'nextjs/inline-script-id': 'error',
|
|
@@ -546,8 +487,7 @@ const nextjsRules: Record<string, RuleEntry> = {
|
|
|
546
487
|
'nextjs/no-unwanted-polyfillio': 'error',
|
|
547
488
|
};
|
|
548
489
|
|
|
549
|
-
|
|
550
|
-
const vitestRules: Record<string, RuleEntry> = {
|
|
490
|
+
const vitestRules: Record<string, DummyRule> = {
|
|
551
491
|
// From vitest.configs.recommended
|
|
552
492
|
'vitest/expect-expect': 'error',
|
|
553
493
|
'vitest/no-identical-title': 'error',
|
|
@@ -578,7 +518,7 @@ const vitestRules: Record<string, RuleEntry> = {
|
|
|
578
518
|
};
|
|
579
519
|
|
|
580
520
|
// Gap rules not yet natively supported — covered via vitest-compat JS plugin
|
|
581
|
-
const vitestCompatRules: Record<string,
|
|
521
|
+
const vitestCompatRules: Record<string, DummyRule> = {
|
|
582
522
|
'vitest-compat/padding-around-after-all-blocks': 'error',
|
|
583
523
|
'vitest-compat/padding-around-after-each-blocks': 'error',
|
|
584
524
|
'vitest-compat/padding-around-describe-blocks': 'error',
|
|
@@ -586,9 +526,8 @@ const vitestCompatRules: Record<string, RuleEntry> = {
|
|
|
586
526
|
'vitest-compat/prefer-vi-mocked': 'error',
|
|
587
527
|
};
|
|
588
528
|
|
|
589
|
-
// ─── Testing Library rules (all via JS plugin, no native equivalents) ───────
|
|
590
529
|
// From testingLibrary.configs['flat/react'].rules + overrides
|
|
591
|
-
const testingLibraryRules: Record<string,
|
|
530
|
+
const testingLibraryRules: Record<string, DummyRule> = {
|
|
592
531
|
'testing-library/await-async-events': ['error', { eventModule: 'userEvent' }],
|
|
593
532
|
'testing-library/await-async-queries': 'error',
|
|
594
533
|
'testing-library/await-async-utils': 'error',
|
|
@@ -616,14 +555,13 @@ const testingLibraryRules: Record<string, RuleEntry> = {
|
|
|
616
555
|
'testing-library/render-result-naming-convention': 'error',
|
|
617
556
|
};
|
|
618
557
|
|
|
619
|
-
// ─── Main config builder ───────────────────────────────────────────────────
|
|
620
558
|
export function oxlintConfig(options?: OxlintConfigOptions): OxlintConfig {
|
|
621
559
|
const enableReact = options?.enableReact ?? true;
|
|
622
560
|
const enableVitest = options?.enableVitest ?? true;
|
|
623
561
|
const enableNextJs = options?.enableNextJs ?? false;
|
|
624
562
|
const enableTestingLibrary = options?.enableTestingLibrary ?? true;
|
|
625
563
|
|
|
626
|
-
const plugins:
|
|
564
|
+
const plugins: OxlintConfig['plugins'] = [
|
|
627
565
|
'eslint',
|
|
628
566
|
'typescript',
|
|
629
567
|
'unicorn',
|
|
@@ -632,17 +570,16 @@ export function oxlintConfig(options?: OxlintConfigOptions): OxlintConfig {
|
|
|
632
570
|
'promise',
|
|
633
571
|
'jsdoc',
|
|
634
572
|
'node',
|
|
635
|
-
...(enableReact ? ['react', 'jsx-a11y'] : []),
|
|
636
|
-
...(enableNextJs ? ['nextjs'] : []),
|
|
637
|
-
...(enableVitest ? ['vitest'] : []),
|
|
573
|
+
...(enableReact ? (['react', 'jsx-a11y'] as const) : []),
|
|
574
|
+
...(enableNextJs ? (['nextjs'] as const) : []),
|
|
575
|
+
...(enableVitest ? (['vitest'] as const) : []),
|
|
638
576
|
];
|
|
639
577
|
|
|
640
|
-
const jsPlugins:
|
|
578
|
+
const jsPlugins: ExternalPluginEntry[] = [
|
|
641
579
|
// Standalone JS plugins (no native equivalents)
|
|
642
580
|
'eslint-plugin-security',
|
|
643
581
|
// -compat JS plugins for gap rules in partially-supported native plugins
|
|
644
582
|
{ name: 'eslint-compat', specifier: 'oxlint-plugin-eslint' },
|
|
645
|
-
{ name: 'import-compat', specifier: 'eslint-plugin-import-x' },
|
|
646
583
|
{ name: 'unicorn-compat', specifier: 'eslint-plugin-unicorn' },
|
|
647
584
|
{ name: 'jsdoc-compat', specifier: 'eslint-plugin-jsdoc' },
|
|
648
585
|
{ name: 'stylistic-compat', specifier: '@stylistic/eslint-plugin' },
|
|
@@ -656,13 +593,12 @@ export function oxlintConfig(options?: OxlintConfigOptions): OxlintConfig {
|
|
|
656
593
|
...(enableNextJs && options?.nextJsRootDir ? { next: { rootDir: options.nextJsRootDir } } : {}),
|
|
657
594
|
};
|
|
658
595
|
|
|
659
|
-
const rules: Record<string,
|
|
596
|
+
const rules: Record<string, DummyRule> = {
|
|
660
597
|
...eslintBaseRules,
|
|
661
598
|
...eslintCjsEsmRules,
|
|
662
599
|
...eslintCompatRules,
|
|
663
600
|
...typescriptRules,
|
|
664
601
|
...importRules,
|
|
665
|
-
...importCompatRules,
|
|
666
602
|
...unicornRules,
|
|
667
603
|
...unicornCompatRules,
|
|
668
604
|
...promiseRules,
|
|
@@ -685,7 +621,7 @@ export function oxlintConfig(options?: OxlintConfigOptions): OxlintConfig {
|
|
|
685
621
|
files: ['**/components/**/*.tsx'],
|
|
686
622
|
rules: {
|
|
687
623
|
'import/no-default-export': 'error' as const,
|
|
688
|
-
'unicorn/filename-case': ['error', { case: 'pascalCase' }] as
|
|
624
|
+
'unicorn/filename-case': ['error', { case: 'pascalCase' }] as DummyRule,
|
|
689
625
|
},
|
|
690
626
|
},
|
|
691
627
|
]
|
|
@@ -702,7 +638,7 @@ export function oxlintConfig(options?: OxlintConfigOptions): OxlintConfig {
|
|
|
702
638
|
? [
|
|
703
639
|
{
|
|
704
640
|
files: TEST_FILE_GLOBS,
|
|
705
|
-
jsPlugins: ['eslint-plugin-testing-library'] as
|
|
641
|
+
jsPlugins: ['eslint-plugin-testing-library'] as ExternalPluginEntry[],
|
|
706
642
|
rules: testingLibraryRules,
|
|
707
643
|
},
|
|
708
644
|
]
|