@oxlint/migrate 0.15.12 → 0.15.13
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/README.md +4 -5
- package/dist/package.json.mjs +1 -1
- package/dist/src/cleanup.mjs +2 -1
- package/dist/src/generated/rules.mjs +10 -2
- package/dist/src/plugins_rules.d.ts +4 -0
- package/dist/src/plugins_rules.mjs +15 -0
- package/package.json +9 -4
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# oxlint
|
|
1
|
+
# @oxlint/migrate
|
|
2
2
|
|
|
3
3
|

|
|
4
4
|
[](https://www.npmjs.com/package/@oxlint/migrate)
|
|
@@ -11,16 +11,15 @@ Generates a `.oxlintrc.json` from a existing eslint flat config.
|
|
|
11
11
|
## Usage
|
|
12
12
|
|
|
13
13
|
```shell
|
|
14
|
-
|
|
15
|
-
npx oxlint-migrate <optional-eslint-flat-config-path>
|
|
14
|
+
npx @oxlint/migrate <optional-eslint-flat-config-path>
|
|
16
15
|
```
|
|
17
16
|
|
|
18
17
|
When no config file provided, the script searches for the default eslint config filenames in the current directory.
|
|
19
18
|
|
|
20
19
|
### User Flow
|
|
21
20
|
|
|
22
|
-
- Upgrade `oxlint` and
|
|
23
|
-
- Execute `npx oxlint
|
|
21
|
+
- Upgrade `oxlint` and `@oxlint/migrate` to the same version.
|
|
22
|
+
- Execute `npx @oxlint/migrate`
|
|
24
23
|
- (Optional): Disable supported rules via [eslint-plugin-oxlint](https://github.com/oxc-project/eslint-plugin-oxlint)
|
|
25
24
|
|
|
26
25
|
## Contributing
|
package/dist/package.json.mjs
CHANGED
package/dist/src/cleanup.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { removeGlobalsWithAreCoveredByEnv, transformBoolGlobalToString, ES_VERSIONS, cleanUpUselessOverridesEnv } from "./env_globals.mjs";
|
|
2
|
-
import { replaceTypescriptAliasRules, cleanUpUselessOverridesRules, cleanUpUselessOverridesPlugins } from "./plugins_rules.mjs";
|
|
2
|
+
import { replaceTypescriptAliasRules, replaceNodePluginName, cleanUpUselessOverridesRules, cleanUpUselessOverridesPlugins } from "./plugins_rules.mjs";
|
|
3
3
|
const isEqualDeep = (a, b) => {
|
|
4
4
|
if (a === b) {
|
|
5
5
|
return true;
|
|
@@ -73,6 +73,7 @@ const cleanUpOxlintConfig = (config) => {
|
|
|
73
73
|
removeGlobalsWithAreCoveredByEnv(config);
|
|
74
74
|
transformBoolGlobalToString(config);
|
|
75
75
|
replaceTypescriptAliasRules(config);
|
|
76
|
+
replaceNodePluginName(config);
|
|
76
77
|
if (config.globals !== void 0 && Object.keys(config.globals).length === 0) {
|
|
77
78
|
delete config.globals;
|
|
78
79
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
const rules = [
|
|
2
2
|
"array-callback-return",
|
|
3
3
|
"constructor-super",
|
|
4
|
+
"curly",
|
|
4
5
|
"default-case",
|
|
5
6
|
"default-case-last",
|
|
6
7
|
"default-param-last",
|
|
@@ -119,6 +120,7 @@ const rules = [
|
|
|
119
120
|
"no-var",
|
|
120
121
|
"no-void",
|
|
121
122
|
"no-with",
|
|
123
|
+
"operator-assignment",
|
|
122
124
|
"prefer-promise-reject-errors",
|
|
123
125
|
"prefer-exponentiation-operator",
|
|
124
126
|
"prefer-numeric-literals",
|
|
@@ -141,6 +143,8 @@ const rules = [
|
|
|
141
143
|
"import/default",
|
|
142
144
|
"import/export",
|
|
143
145
|
"import/first",
|
|
146
|
+
"import/no-absolute-path",
|
|
147
|
+
"import/no-mutable-exports",
|
|
144
148
|
"import/no-named-default",
|
|
145
149
|
"import/no-namespace",
|
|
146
150
|
"import/max-dependencies",
|
|
@@ -295,12 +299,14 @@ const rules = [
|
|
|
295
299
|
"oxc/no-const-enum",
|
|
296
300
|
"oxc/no-map-spread",
|
|
297
301
|
"oxc/no-optional-chaining",
|
|
302
|
+
"oxc/no-redundant-constructor-init",
|
|
298
303
|
"oxc/no-rest-spread-properties",
|
|
299
304
|
"oxc/number-arg-out-of-range",
|
|
300
305
|
"oxc/only-used-in-recursion",
|
|
301
306
|
"oxc/uninvoked-array-callback",
|
|
302
307
|
"promise/avoid-new",
|
|
303
308
|
"promise/catch-or-return",
|
|
309
|
+
"promise/no-nesting",
|
|
304
310
|
"promise/no-promise-in-callback",
|
|
305
311
|
"promise/no-callback-in-promise",
|
|
306
312
|
"promise/no-new-statics",
|
|
@@ -324,6 +330,7 @@ const rules = [
|
|
|
324
330
|
"react/jsx-no-undef",
|
|
325
331
|
"react/jsx-no-useless-fragment",
|
|
326
332
|
"react/jsx-props-no-spread-multi",
|
|
333
|
+
"react/no-namespace",
|
|
327
334
|
"react/no-array-index-key",
|
|
328
335
|
"react/no-children-prop",
|
|
329
336
|
"react/no-danger-with-children",
|
|
@@ -389,6 +396,7 @@ const rules = [
|
|
|
389
396
|
"@typescript-eslint/prefer-ts-expect-error",
|
|
390
397
|
"@typescript-eslint/triple-slash-reference",
|
|
391
398
|
"unicorn/catch-error-name",
|
|
399
|
+
"unicorn/consistent-date-clone",
|
|
392
400
|
"unicorn/consistent-empty-array-spread",
|
|
393
401
|
"unicorn/consistent-existence-index-check",
|
|
394
402
|
"unicorn/consistent-function-scoping",
|
|
@@ -503,6 +511,8 @@ const rules = [
|
|
|
503
511
|
"import-x/default",
|
|
504
512
|
"import-x/export",
|
|
505
513
|
"import-x/first",
|
|
514
|
+
"import-x/no-absolute-path",
|
|
515
|
+
"import-x/no-mutable-exports",
|
|
506
516
|
"import-x/no-named-default",
|
|
507
517
|
"import-x/no-namespace",
|
|
508
518
|
"import-x/max-dependencies",
|
|
@@ -557,7 +567,6 @@ const rules = [
|
|
|
557
567
|
const nurseryRules = [
|
|
558
568
|
"constructor-super",
|
|
559
569
|
"getter-return",
|
|
560
|
-
"no-restricted-imports",
|
|
561
570
|
"no-undef",
|
|
562
571
|
"no-unreachable",
|
|
563
572
|
"import/export",
|
|
@@ -567,7 +576,6 @@ const nurseryRules = [
|
|
|
567
576
|
"react-hooks/exhaustive-deps",
|
|
568
577
|
"react/require-render-return",
|
|
569
578
|
"@typescript-eslint/consistent-type-imports",
|
|
570
|
-
"@typescript-eslint/no-restricted-imports",
|
|
571
579
|
"import-x/export",
|
|
572
580
|
"import-x/named"
|
|
573
581
|
];
|
|
@@ -5,3 +5,7 @@ export declare const detectNeededRulesPlugins: (targetConfig: OxlintConfigOrOver
|
|
|
5
5
|
export declare const cleanUpUselessOverridesPlugins: (config: OxlintConfig) => void;
|
|
6
6
|
export declare const cleanUpUselessOverridesRules: (config: OxlintConfig) => void;
|
|
7
7
|
export declare const replaceTypescriptAliasRules: (config: OxlintConfigOrOverride) => void;
|
|
8
|
+
/**
|
|
9
|
+
* Oxlint support them only under the node plugin name
|
|
10
|
+
*/
|
|
11
|
+
export declare const replaceNodePluginName: (config: OxlintConfigOrOverride) => void;
|
|
@@ -104,10 +104,25 @@ const replaceTypescriptAliasRules = (config) => {
|
|
|
104
104
|
delete config.rules;
|
|
105
105
|
}
|
|
106
106
|
};
|
|
107
|
+
const replaceNodePluginName = (config) => {
|
|
108
|
+
if (config.rules === void 0) {
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
for (const rule of Object.keys(config.rules)) {
|
|
112
|
+
const prefix = "n/";
|
|
113
|
+
if (!rule.startsWith(prefix)) {
|
|
114
|
+
continue;
|
|
115
|
+
}
|
|
116
|
+
const nodeRule = `node/${rule.slice(prefix.length)}`;
|
|
117
|
+
config.rules[nodeRule] = config.rules[rule];
|
|
118
|
+
delete config.rules[rule];
|
|
119
|
+
}
|
|
120
|
+
};
|
|
107
121
|
export {
|
|
108
122
|
cleanUpUselessOverridesPlugins,
|
|
109
123
|
cleanUpUselessOverridesRules,
|
|
110
124
|
detectNeededRulesPlugins,
|
|
125
|
+
replaceNodePluginName,
|
|
111
126
|
replaceTypescriptAliasRules,
|
|
112
127
|
transformRuleEntry
|
|
113
128
|
};
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oxlint/migrate",
|
|
3
|
-
"version": "0.15.
|
|
3
|
+
"version": "0.15.13",
|
|
4
4
|
"description": "Generates a `.oxlintrc.json` from a existing eslint flat config",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
7
|
-
"oxlint
|
|
7
|
+
"@oxlint/migrate": "./dist/bin/oxlint-migrate.mjs"
|
|
8
8
|
},
|
|
9
9
|
"repository": {
|
|
10
10
|
"type": "git",
|
|
@@ -33,16 +33,21 @@
|
|
|
33
33
|
"license": "MIT",
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@antfu/eslint-config": "^4.2.0",
|
|
36
|
+
"@eslint/eslintrc": "^3.3.0",
|
|
36
37
|
"@eslint/js": "^9.20.0",
|
|
37
38
|
"@logux/eslint-config": "^55.0.0",
|
|
38
39
|
"@oxc-node/core": "^0.0.19",
|
|
40
|
+
"@stylistic/eslint-plugin": "^4.0.1",
|
|
39
41
|
"@stylistic/eslint-plugin-ts": "^4.0.0",
|
|
40
42
|
"@types/eslint-config-prettier": "^6.11.3",
|
|
41
43
|
"@types/node": "^22.13.4",
|
|
44
|
+
"@typescript-eslint/eslint-plugin": "^8.25.0",
|
|
45
|
+
"@typescript-eslint/parser": "^8.25.0",
|
|
42
46
|
"@vitest/coverage-v8": "^3.0.5",
|
|
43
47
|
"eslint": "^9.20.1",
|
|
44
48
|
"eslint-config-prettier": "^10.0.1",
|
|
45
49
|
"eslint-plugin-header": "^3.1.1",
|
|
50
|
+
"eslint-plugin-import": "^2.31.0",
|
|
46
51
|
"eslint-plugin-import-x": "^4.6.1",
|
|
47
52
|
"eslint-plugin-jsdoc": "^50.6.3",
|
|
48
53
|
"eslint-plugin-local": "^6.0.0",
|
|
@@ -51,7 +56,7 @@
|
|
|
51
56
|
"eslint-plugin-unicorn": "^57.0.0",
|
|
52
57
|
"husky": "^9.1.7",
|
|
53
58
|
"lint-staged": "^15.4.3",
|
|
54
|
-
"oxlint": "^0.15.
|
|
59
|
+
"oxlint": "^0.15.13",
|
|
55
60
|
"prettier": "^3.5.1",
|
|
56
61
|
"typescript": "^5.7.3",
|
|
57
62
|
"typescript-eslint": "^8.24.0",
|
|
@@ -66,5 +71,5 @@
|
|
|
66
71
|
"commander": "^13.1.0",
|
|
67
72
|
"globals": "^16.0.0"
|
|
68
73
|
},
|
|
69
|
-
"packageManager": "pnpm@10.
|
|
74
|
+
"packageManager": "pnpm@10.5.2"
|
|
70
75
|
}
|