@oxlint/migrate 1.39.0 → 1.41.0
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.
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { i as rules_exports, n as preFixForJsPlugins, r as nurseryRules, t as src_default } from "../src-
|
|
2
|
+
import { i as rules_exports, n as preFixForJsPlugins, r as nurseryRules, t as src_default } from "../src-BNblTDrB.mjs";
|
|
3
3
|
import { program } from "commander";
|
|
4
4
|
import { existsSync, readFileSync, renameSync, writeFileSync } from "node:fs";
|
|
5
5
|
import path from "node:path";
|
|
@@ -40,7 +40,7 @@ const loadESLintConfig = async (filePath) => {
|
|
|
40
40
|
|
|
41
41
|
//#endregion
|
|
42
42
|
//#region package.json
|
|
43
|
-
var version = "1.
|
|
43
|
+
var version = "1.41.0";
|
|
44
44
|
|
|
45
45
|
//#endregion
|
|
46
46
|
//#region src/walker/comments/replaceRuleDirectiveComment.ts
|
|
@@ -282,6 +282,11 @@ const getAllProjectFiles = () => {
|
|
|
282
282
|
//#region src/reporter.ts
|
|
283
283
|
var DefaultReporter = class {
|
|
284
284
|
reports = /* @__PURE__ */ new Set();
|
|
285
|
+
skippedRules = new Map([
|
|
286
|
+
["nursery", /* @__PURE__ */ new Set()],
|
|
287
|
+
["type-aware", /* @__PURE__ */ new Set()],
|
|
288
|
+
["unsupported", /* @__PURE__ */ new Set()]
|
|
289
|
+
]);
|
|
285
290
|
report(message) {
|
|
286
291
|
this.reports.add(message);
|
|
287
292
|
}
|
|
@@ -291,6 +296,21 @@ var DefaultReporter = class {
|
|
|
291
296
|
getReports() {
|
|
292
297
|
return Array.from(this.reports);
|
|
293
298
|
}
|
|
299
|
+
markSkipped(rule, category) {
|
|
300
|
+
this.skippedRules.get(category)?.add(rule);
|
|
301
|
+
}
|
|
302
|
+
removeSkipped(rule, category) {
|
|
303
|
+
this.skippedRules.get(category)?.delete(rule);
|
|
304
|
+
}
|
|
305
|
+
getSkippedRulesByCategory() {
|
|
306
|
+
const result = {
|
|
307
|
+
nursery: [],
|
|
308
|
+
"type-aware": [],
|
|
309
|
+
unsupported: []
|
|
310
|
+
};
|
|
311
|
+
for (const [category, rules] of this.skippedRules) result[category] = Array.from(rules);
|
|
312
|
+
return result;
|
|
313
|
+
}
|
|
294
314
|
};
|
|
295
315
|
|
|
296
316
|
//#endregion
|
package/dist/src/index.d.mts
CHANGED
|
@@ -26,10 +26,15 @@ type OxlintConfig = {
|
|
|
26
26
|
overrides?: OxlintConfigOverride[];
|
|
27
27
|
ignorePatterns?: OxlintConfigIgnorePatterns;
|
|
28
28
|
};
|
|
29
|
+
type RuleSkippedCategory = 'nursery' | 'type-aware' | 'unsupported';
|
|
30
|
+
type SkippedCategoryGroup = Record<RuleSkippedCategory, string[]>;
|
|
29
31
|
type Reporter = {
|
|
30
32
|
report(message: string): void;
|
|
31
33
|
remove(message: string): void;
|
|
32
34
|
getReports(): string[];
|
|
35
|
+
markSkipped(rule: string, category: RuleSkippedCategory): void;
|
|
36
|
+
removeSkipped(rule: string, category: RuleSkippedCategory): void;
|
|
37
|
+
getSkippedRulesByCategory(): SkippedCategoryGroup;
|
|
33
38
|
};
|
|
34
39
|
type Options = {
|
|
35
40
|
reporter?: Reporter;
|
package/dist/src/index.mjs
CHANGED
|
@@ -42,6 +42,7 @@ const OTHER_SUPPORTED_ENVS = [
|
|
|
42
42
|
"applescript",
|
|
43
43
|
"astro",
|
|
44
44
|
"atomtest",
|
|
45
|
+
"audioworklet",
|
|
45
46
|
"commonjs",
|
|
46
47
|
"embertest",
|
|
47
48
|
"greasemonkey",
|
|
@@ -428,7 +429,6 @@ const styleRules = [
|
|
|
428
429
|
"@typescript-eslint/prefer-for-of",
|
|
429
430
|
"@typescript-eslint/prefer-function-type",
|
|
430
431
|
"@typescript-eslint/prefer-namespace-keyword",
|
|
431
|
-
"@typescript-eslint/prefer-optional-chain",
|
|
432
432
|
"@typescript-eslint/prefer-reduce-type-parameter",
|
|
433
433
|
"@typescript-eslint/prefer-return-this-type",
|
|
434
434
|
"unicorn/catch-error-name",
|
|
@@ -897,6 +897,7 @@ const nurseryRules = [
|
|
|
897
897
|
"jsx-a11y/no-static-element-interactions",
|
|
898
898
|
"promise/no-return-in-finally",
|
|
899
899
|
"react/require-render-return",
|
|
900
|
+
"@typescript-eslint/prefer-optional-chain",
|
|
900
901
|
"import-x/export",
|
|
901
902
|
"import-x/named"
|
|
902
903
|
];
|
|
@@ -1107,10 +1108,12 @@ const transformRuleEntry = (eslintConfig, targetConfig, options) => {
|
|
|
1107
1108
|
if (allRules.includes(rule)) {
|
|
1108
1109
|
if (!options?.withNursery && nurseryRules.includes(rule)) {
|
|
1109
1110
|
options?.reporter?.report(`unsupported rule, but available as a nursery rule: ${rule}`);
|
|
1111
|
+
options?.reporter?.markSkipped(rule, "nursery");
|
|
1110
1112
|
continue;
|
|
1111
1113
|
}
|
|
1112
1114
|
if (!options?.typeAware && typescriptTypeAwareRules.includes(rule)) {
|
|
1113
1115
|
options?.reporter?.report(`type-aware rule detected, but \`--type-aware\` is not enabled: ${rule}`);
|
|
1116
|
+
options?.reporter?.markSkipped(rule, "type-aware");
|
|
1114
1117
|
continue;
|
|
1115
1118
|
}
|
|
1116
1119
|
if (options?.merge) {
|
|
@@ -1121,17 +1124,24 @@ const transformRuleEntry = (eslintConfig, targetConfig, options) => {
|
|
|
1121
1124
|
if (isOffValue(normalizedConfig)) {
|
|
1122
1125
|
if (eslintConfig.files === void 0) delete targetConfig.rules[rule];
|
|
1123
1126
|
else if (!isIgnoredPluginRule(rule)) targetConfig.rules[rule] = normalizedConfig;
|
|
1124
|
-
if (eslintConfig.files === void 0)
|
|
1127
|
+
if (eslintConfig.files === void 0) {
|
|
1128
|
+
options.reporter?.remove(unsupportedRuleMessage);
|
|
1129
|
+
options?.reporter?.removeSkipped(rule, "unsupported");
|
|
1130
|
+
}
|
|
1125
1131
|
continue;
|
|
1126
1132
|
}
|
|
1127
1133
|
if (enableJsPluginRule(targetConfig, rule, normalizedConfig)) continue;
|
|
1128
1134
|
}
|
|
1129
1135
|
if (!isActiveValue(normalizedConfig)) {
|
|
1130
1136
|
if (isOffValue(normalizedConfig)) delete targetConfig.rules[rule];
|
|
1131
|
-
if (eslintConfig.files === void 0)
|
|
1137
|
+
if (eslintConfig.files === void 0) {
|
|
1138
|
+
options?.reporter?.remove(unsupportedRuleMessage);
|
|
1139
|
+
options?.reporter?.removeSkipped(rule, "unsupported");
|
|
1140
|
+
}
|
|
1132
1141
|
continue;
|
|
1133
1142
|
}
|
|
1134
1143
|
options?.reporter?.report(unsupportedRuleMessage);
|
|
1144
|
+
options?.reporter?.markSkipped(rule, "unsupported");
|
|
1135
1145
|
}
|
|
1136
1146
|
}
|
|
1137
1147
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oxlint/migrate",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.41.0",
|
|
4
4
|
"description": "Generates a `.oxlintrc.json` from a existing eslint flat config",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"eslint",
|
|
@@ -37,12 +37,12 @@
|
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"commander": "^14.0.0",
|
|
40
|
-
"globals": "^
|
|
41
|
-
"oxc-parser": "^0.
|
|
40
|
+
"globals": "^17.0.0",
|
|
41
|
+
"oxc-parser": "^0.110.0",
|
|
42
42
|
"tinyglobby": "^0.2.14"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"@antfu/eslint-config": "^
|
|
45
|
+
"@antfu/eslint-config": "^7.0.0",
|
|
46
46
|
"@eslint/js": "^9.29.0",
|
|
47
47
|
"@logux/eslint-config": "^57.0.0",
|
|
48
48
|
"@oxc-node/core": "^0.0.35",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"eslint-plugin-header": "^3.1.1",
|
|
60
60
|
"eslint-plugin-import": "^2.32.0",
|
|
61
61
|
"eslint-plugin-import-x": "^4.16.0",
|
|
62
|
-
"eslint-plugin-jsdoc": "^
|
|
62
|
+
"eslint-plugin-jsdoc": "^62.0.0",
|
|
63
63
|
"eslint-plugin-local": "^6.0.0",
|
|
64
64
|
"eslint-plugin-mocha": "^11.2.0",
|
|
65
65
|
"eslint-plugin-oxlint": "^1.3.0",
|
|
@@ -74,8 +74,8 @@
|
|
|
74
74
|
"jiti": "^2.4.2",
|
|
75
75
|
"lint-staged": "^16.1.2",
|
|
76
76
|
"next": "^16.0.0",
|
|
77
|
-
"oxfmt": "^0.
|
|
78
|
-
"oxlint": "^1.
|
|
77
|
+
"oxfmt": "^0.25.0",
|
|
78
|
+
"oxlint": "^1.41.0",
|
|
79
79
|
"oxlint-tsgolint": "^0.8.3",
|
|
80
80
|
"tsdown": "^0.19.0",
|
|
81
81
|
"typescript-eslint": "^8.35.0",
|
|
@@ -87,5 +87,5 @@
|
|
|
87
87
|
"lint-staged": {
|
|
88
88
|
"*": "oxfmt --no-error-on-unmatched-pattern"
|
|
89
89
|
},
|
|
90
|
-
"packageManager": "pnpm@10.
|
|
90
|
+
"packageManager": "pnpm@10.28.0"
|
|
91
91
|
}
|