@oxlint/migrate 1.1.0 → 1.3.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.
|
@@ -24,32 +24,36 @@ program.name("oxlint-migrate").version(packageJson.version).argument("[eslint-co
|
|
|
24
24
|
const oxlintFilePath = path.join(cwd, cliOptions.outputFile);
|
|
25
25
|
if (filePath === void 0) {
|
|
26
26
|
filePath = getAutodetectedEslintConfigName(cwd);
|
|
27
|
-
if (filePath === void 0) {
|
|
28
|
-
program.error(`could not autodetect eslint config file`);
|
|
29
|
-
}
|
|
30
27
|
} else {
|
|
31
28
|
filePath = path.join(cwd, filePath);
|
|
32
29
|
}
|
|
30
|
+
if (filePath === void 0) {
|
|
31
|
+
program.error(`could not autodetect eslint config file`);
|
|
32
|
+
}
|
|
33
|
+
if (filePath.endsWith("json")) {
|
|
34
|
+
program.error(
|
|
35
|
+
`json format is not supported. @oxlint/migrate only supports the eslint flat configuration`
|
|
36
|
+
);
|
|
37
|
+
}
|
|
33
38
|
if (!existsSync(filePath)) {
|
|
34
39
|
program.error(`eslint config file not found: ${filePath}`);
|
|
35
|
-
} else {
|
|
36
|
-
const eslintConfigs = await import(pathToFileURL(filePath).toString());
|
|
37
|
-
const options = {
|
|
38
|
-
reporter: console.warn,
|
|
39
|
-
merge: !!cliOptions.merge,
|
|
40
|
-
withNursery: !!cliOptions.withNursery
|
|
41
|
-
};
|
|
42
|
-
let config;
|
|
43
|
-
if (options.merge && existsSync(oxlintFilePath)) {
|
|
44
|
-
config = JSON.parse(
|
|
45
|
-
readFileSync(oxlintFilePath, { encoding: "utf8", flag: "r" })
|
|
46
|
-
);
|
|
47
|
-
}
|
|
48
|
-
const oxlintConfig = "default" in eslintConfigs ? await main(eslintConfigs.default, config, options) : await main(eslintConfigs, config, options);
|
|
49
|
-
if (existsSync(oxlintFilePath)) {
|
|
50
|
-
renameSync(oxlintFilePath, `${oxlintFilePath}.bak`);
|
|
51
|
-
}
|
|
52
|
-
writeFileSync(oxlintFilePath, JSON.stringify(oxlintConfig, null, 2));
|
|
53
40
|
}
|
|
41
|
+
const eslintConfigs = await import(pathToFileURL(filePath).toString());
|
|
42
|
+
const options = {
|
|
43
|
+
reporter: console.warn,
|
|
44
|
+
merge: !!cliOptions.merge,
|
|
45
|
+
withNursery: !!cliOptions.withNursery
|
|
46
|
+
};
|
|
47
|
+
let config;
|
|
48
|
+
if (options.merge && existsSync(oxlintFilePath)) {
|
|
49
|
+
config = JSON.parse(
|
|
50
|
+
readFileSync(oxlintFilePath, { encoding: "utf8", flag: "r" })
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
const oxlintConfig = "default" in eslintConfigs ? await main(eslintConfigs.default, config, options) : await main(eslintConfigs, config, options);
|
|
54
|
+
if (existsSync(oxlintFilePath)) {
|
|
55
|
+
renameSync(oxlintFilePath, `${oxlintFilePath}.bak`);
|
|
56
|
+
}
|
|
57
|
+
writeFileSync(oxlintFilePath, JSON.stringify(oxlintConfig, null, 2));
|
|
54
58
|
});
|
|
55
59
|
program.parse();
|
package/dist/package.json.mjs
CHANGED
|
@@ -331,6 +331,7 @@ const restrictionRules = [
|
|
|
331
331
|
"no-var",
|
|
332
332
|
"no-void",
|
|
333
333
|
"unicode-bom",
|
|
334
|
+
"import/extensions",
|
|
334
335
|
"import/no-amd",
|
|
335
336
|
"import/no-commonjs",
|
|
336
337
|
"import/no-cycle",
|
|
@@ -375,6 +376,7 @@ const restrictionRules = [
|
|
|
375
376
|
"@typescript-eslint/no-restricted-imports",
|
|
376
377
|
"@typescript-eslint/no-empty-function",
|
|
377
378
|
"@typescript-eslint/no-unused-expressions",
|
|
379
|
+
"import-x/extensions",
|
|
378
380
|
"import-x/no-amd",
|
|
379
381
|
"import-x/no-commonjs",
|
|
380
382
|
"import-x/no-cycle",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oxlint/migrate",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "Generates a `.oxlintrc.json` from a existing eslint flat config",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"@stylistic/eslint-plugin": "^4.0.1",
|
|
46
46
|
"@stylistic/eslint-plugin-ts": "^4.0.0",
|
|
47
47
|
"@types/eslint-config-prettier": "^6.11.3",
|
|
48
|
-
"@types/node": "^
|
|
48
|
+
"@types/node": "^24.0.0",
|
|
49
49
|
"@typescript-eslint/eslint-plugin": "^8.25.0",
|
|
50
50
|
"@typescript-eslint/parser": "^8.25.0",
|
|
51
51
|
"@vitest/coverage-v8": "^3.0.5",
|
|
@@ -54,14 +54,14 @@
|
|
|
54
54
|
"eslint-plugin-header": "^3.1.1",
|
|
55
55
|
"eslint-plugin-import": "^2.31.0",
|
|
56
56
|
"eslint-plugin-import-x": "^4.6.1",
|
|
57
|
-
"eslint-plugin-jsdoc": "^
|
|
57
|
+
"eslint-plugin-jsdoc": "^51.0.0",
|
|
58
58
|
"eslint-plugin-local": "^6.0.0",
|
|
59
|
-
"eslint-plugin-oxlint": "^0.
|
|
59
|
+
"eslint-plugin-oxlint": "^1.0.0",
|
|
60
60
|
"eslint-plugin-regexp": "^2.7.0",
|
|
61
61
|
"eslint-plugin-unicorn": "^59.0.0",
|
|
62
62
|
"husky": "^9.1.7",
|
|
63
63
|
"lint-staged": "^16.0.0",
|
|
64
|
-
"oxlint": "^1.
|
|
64
|
+
"oxlint": "^1.3.0",
|
|
65
65
|
"prettier": "^3.5.1",
|
|
66
66
|
"typescript": "^5.7.3",
|
|
67
67
|
"typescript-eslint": "^8.24.0",
|