@oxlint/migrate 1.11.0 → 1.11.2
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 +1 -0
- package/dist/bin/oxlint-migrate.mjs +5 -1
- package/dist/package.json.mjs +1 -1
- package/dist/src/constants.d.ts +1 -0
- package/dist/src/constants.mjs +63 -1
- package/dist/src/plugins_rules.mjs +7 -1
- package/dist/src/types.d.ts +1 -0
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -19,6 +19,7 @@ When no config file provided, the script searches for the default eslint config
|
|
|
19
19
|
| Options | Description |
|
|
20
20
|
| --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
21
21
|
| `--merge` | \* merge eslint configuration with an existing .oxlintrc.json configuration |
|
|
22
|
+
| `--type-aware` | Include type aware rules, which are supported with `oxlint --type-aware` |
|
|
22
23
|
| `--with-nursery` | Include oxlint rules which are currently under development |
|
|
23
24
|
| `--output-file <file>` | The oxlint configuration file where to eslint v9 rules will be written to, default: `.oxlintrc.json` |
|
|
24
25
|
| `--replace-eslint-comments` | Search in the project files for eslint comments and replaces them with oxlint. Some eslint comments are not supported and will be reported. |
|
|
@@ -31,13 +31,17 @@ program.name("oxlint-migrate").version(packageJson.version).argument("[eslint-co
|
|
|
31
31
|
).option(
|
|
32
32
|
"--replace-eslint-comments",
|
|
33
33
|
"Search in the project files for eslint comments and replaces them with oxlint. Some eslint comments are not supported and will be reported."
|
|
34
|
+
).option(
|
|
35
|
+
"--type-aware",
|
|
36
|
+
"Includes supported type-aware rules. Needs the same flag in `oxlint` to enable it."
|
|
34
37
|
).action(async (filePath) => {
|
|
35
38
|
const cliOptions = program.opts();
|
|
36
39
|
const oxlintFilePath = path.join(cwd, cliOptions.outputFile);
|
|
37
40
|
const options = {
|
|
38
41
|
reporter: console.warn,
|
|
39
42
|
merge: !!cliOptions.merge,
|
|
40
|
-
withNursery: !!cliOptions.withNursery
|
|
43
|
+
withNursery: !!cliOptions.withNursery,
|
|
44
|
+
typeAware: !!cliOptions.typeAware
|
|
41
45
|
};
|
|
42
46
|
if (cliOptions.replaceEslintComments) {
|
|
43
47
|
await walkAndReplaceProjectFiles(
|
package/dist/package.json.mjs
CHANGED
package/dist/src/constants.d.ts
CHANGED
package/dist/src/constants.mjs
CHANGED
|
@@ -35,7 +35,69 @@ const typescriptRulesExtendEslintRules = [
|
|
|
35
35
|
"no-use-before-define",
|
|
36
36
|
"no-useless-constructor"
|
|
37
37
|
];
|
|
38
|
+
const typescriptTypeAwareRules = [
|
|
39
|
+
"@typescript-eslint/await-thenable",
|
|
40
|
+
"@typescript-eslint/consistent-return",
|
|
41
|
+
"@typescript-eslint/consistent-type-exports",
|
|
42
|
+
"@typescript-eslint/dot-notation",
|
|
43
|
+
"@typescript-eslint/naming-convention",
|
|
44
|
+
"@typescript-eslint/no-array-delete",
|
|
45
|
+
"@typescript-eslint/no-base-to-string",
|
|
46
|
+
"@typescript-eslint/no-confusing-void-expression",
|
|
47
|
+
"@typescript-eslint/no-deprecated",
|
|
48
|
+
"@typescript-eslint/no-duplicate-type-constituents",
|
|
49
|
+
"@typescript-eslint/no-floating-promises",
|
|
50
|
+
"@typescript-eslint/no-for-in-array",
|
|
51
|
+
"@typescript-eslint/no-implied-eval",
|
|
52
|
+
"@typescript-eslint/no-meaningless-void-operator",
|
|
53
|
+
"@typescript-eslint/no-misused-promises",
|
|
54
|
+
"@typescript-eslint/no-misused-spread",
|
|
55
|
+
"@typescript-eslint/no-mixed-enums",
|
|
56
|
+
"@typescript-eslint/no-redundant-type-constituents",
|
|
57
|
+
"@typescript-eslint/no-unnecessary-boolean-literal-compare",
|
|
58
|
+
"@typescript-eslint/no-unnecessary-condition",
|
|
59
|
+
"@typescript-eslint/no-unnecessary-qualifier",
|
|
60
|
+
"@typescript-eslint/no-unnecessary-template-expression",
|
|
61
|
+
"@typescript-eslint/no-unnecessary-type-arguments",
|
|
62
|
+
"@typescript-eslint/no-unnecessary-type-assertion",
|
|
63
|
+
"@typescript-eslint/no-unnecessary-type-conversion",
|
|
64
|
+
"@typescript-eslint/no-unnecessary-type-parameters",
|
|
65
|
+
"@typescript-eslint/no-unsafe-argument",
|
|
66
|
+
"@typescript-eslint/no-unsafe-assignment",
|
|
67
|
+
"@typescript-eslint/no-unsafe-call",
|
|
68
|
+
"@typescript-eslint/no-unsafe-enum-comparison",
|
|
69
|
+
"@typescript-eslint/no-unsafe-member-access",
|
|
70
|
+
"@typescript-eslint/no-unsafe-return",
|
|
71
|
+
"@typescript-eslint/no-unsafe-type-assertion",
|
|
72
|
+
"@typescript-eslint/no-unsafe-unary-minus",
|
|
73
|
+
"@typescript-eslint/non-nullable-type-assertion-style",
|
|
74
|
+
"@typescript-eslint/only-throw-error",
|
|
75
|
+
"@typescript-eslint/prefer-destructuring",
|
|
76
|
+
"@typescript-eslint/prefer-find",
|
|
77
|
+
"@typescript-eslint/prefer-includes",
|
|
78
|
+
"@typescript-eslint/prefer-nullish-coalescing",
|
|
79
|
+
"@typescript-eslint/prefer-optional-chain",
|
|
80
|
+
"@typescript-eslint/prefer-promise-reject-errors",
|
|
81
|
+
"@typescript-eslint/prefer-readonly",
|
|
82
|
+
"@typescript-eslint/prefer-readonly-parameter-types",
|
|
83
|
+
"@typescript-eslint/prefer-reduce-type-parameter",
|
|
84
|
+
"@typescript-eslint/prefer-regexp-exec",
|
|
85
|
+
"@typescript-eslint/prefer-return-this-type",
|
|
86
|
+
"@typescript-eslint/prefer-string-starts-ends-with",
|
|
87
|
+
"@typescript-eslint/promise-function-async",
|
|
88
|
+
"@typescript-eslint/related-getter-setter-pairs",
|
|
89
|
+
"@typescript-eslint/require-array-sort-compare",
|
|
90
|
+
"@typescript-eslint/require-await",
|
|
91
|
+
"@typescript-eslint/restrict-plus-operands",
|
|
92
|
+
"@typescript-eslint/restrict-template-expressions",
|
|
93
|
+
"@typescript-eslint/return-await",
|
|
94
|
+
"@typescript-eslint/strict-boolean-expressions",
|
|
95
|
+
"@typescript-eslint/switch-exhaustiveness-check",
|
|
96
|
+
"@typescript-eslint/unbound-method",
|
|
97
|
+
"@typescript-eslint/use-unknown-in-catch-callback-variable"
|
|
98
|
+
];
|
|
38
99
|
export {
|
|
39
100
|
rulesPrefixesForPlugins,
|
|
40
|
-
typescriptRulesExtendEslintRules
|
|
101
|
+
typescriptRulesExtendEslintRules,
|
|
102
|
+
typescriptTypeAwareRules
|
|
41
103
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as rules from "./generated/rules.mjs";
|
|
2
2
|
import { nurseryRules } from "./generated/rules.mjs";
|
|
3
|
-
import { rulesPrefixesForPlugins, typescriptRulesExtendEslintRules } from "./constants.mjs";
|
|
3
|
+
import { typescriptTypeAwareRules, rulesPrefixesForPlugins, typescriptRulesExtendEslintRules } from "./constants.mjs";
|
|
4
4
|
const allRules = Object.values(rules).flat();
|
|
5
5
|
const isValueInSet = (value, validSet) => validSet.includes(value) || Array.isArray(value) && validSet.includes(value[0]);
|
|
6
6
|
const isActiveValue = (value) => isValueInSet(value, ["error", "warn", 1, 2]);
|
|
@@ -46,6 +46,12 @@ const transformRuleEntry = (eslintConfig, targetConfig, options) => {
|
|
|
46
46
|
options?.reporter !== void 0 && options.reporter(`unsupported rule, but in development: ${rule}`);
|
|
47
47
|
continue;
|
|
48
48
|
}
|
|
49
|
+
if (!options?.typeAware && typescriptTypeAwareRules.includes(rule)) {
|
|
50
|
+
options?.reporter !== void 0 && options.reporter(
|
|
51
|
+
`type-aware rule detected, but \`--type-aware\` is not enabled: ${rule}`
|
|
52
|
+
);
|
|
53
|
+
continue;
|
|
54
|
+
}
|
|
49
55
|
if (options?.merge) {
|
|
50
56
|
if (!(rule in targetConfig.rules)) {
|
|
51
57
|
targetConfig.rules[rule] = normalizeSeverityValue(config);
|
package/dist/src/types.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oxlint/migrate",
|
|
3
|
-
"version": "1.11.
|
|
3
|
+
"version": "1.11.2",
|
|
4
4
|
"description": "Generates a `.oxlintrc.json` from a existing eslint flat config",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"@eslint/eslintrc": "^3.3.1",
|
|
42
42
|
"@eslint/js": "^9.29.0",
|
|
43
43
|
"@logux/eslint-config": "^56.0.0",
|
|
44
|
-
"@oxc-node/core": "^0.0.
|
|
44
|
+
"@oxc-node/core": "^0.0.32",
|
|
45
45
|
"@stylistic/eslint-plugin": "^5.0.0",
|
|
46
46
|
"@stylistic/eslint-plugin-ts": "^4.4.1",
|
|
47
47
|
"@types/eslint-config-prettier": "^6.11.3",
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
"husky": "^9.1.7",
|
|
66
66
|
"jiti": "^2.4.2",
|
|
67
67
|
"lint-staged": "^16.1.2",
|
|
68
|
-
"oxlint": "^1.11.
|
|
68
|
+
"oxlint": "^1.11.2",
|
|
69
69
|
"prettier": "^3.6.1",
|
|
70
70
|
"typescript": "^5.8.3",
|
|
71
71
|
"typescript-eslint": "^8.35.0",
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
},
|
|
79
79
|
"dependencies": {
|
|
80
80
|
"commander": "^14.0.0",
|
|
81
|
-
"oxc-parser": "^0.
|
|
81
|
+
"oxc-parser": "^0.81.0",
|
|
82
82
|
"tinyglobby": "^0.2.14"
|
|
83
83
|
},
|
|
84
84
|
"peerDependencies": {
|