@oxlint/migrate 0.0.2 → 0.0.4
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 -1
- package/dist/bin/oxlint-migrate.mjs +23 -19
- package/dist/package.json.mjs +8 -0
- package/package.json +2 -5
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@ Generates a `.oxlintrc.json` from a existing eslint v9 configuration
|
|
|
8
8
|
|
|
9
9
|
`npx oxlint-migrate <optional-eslint-v9-config-path>`
|
|
10
10
|
|
|
11
|
-
When no config file provided,
|
|
11
|
+
When no config file provided, the script searches for the default eslint config filenames in the current directory.
|
|
12
12
|
|
|
13
13
|
### User Flow
|
|
14
14
|
|
|
@@ -4,23 +4,27 @@ import { getAutodetectedEslintConfigName } from "./autoDetectConfigFile.mjs";
|
|
|
4
4
|
import { existsSync, renameSync, writeFileSync } from "fs";
|
|
5
5
|
import main from "../src/index.mjs";
|
|
6
6
|
import path from "path";
|
|
7
|
-
|
|
8
|
-
program.
|
|
9
|
-
let
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
7
|
+
import packageJson from "../package.json.mjs";
|
|
8
|
+
program.name("oxlint-migrate").version(packageJson.version).argument("[eslint-config]", "The path to the eslint v9 config file").action(async (filePath) => {
|
|
9
|
+
let cwd = process.cwd();
|
|
10
|
+
if (filePath === void 0) {
|
|
11
|
+
filePath = getAutodetectedEslintConfigName(cwd);
|
|
12
|
+
if (filePath === void 0) {
|
|
13
|
+
program.error(`could not autodetect eslint config file`);
|
|
14
|
+
}
|
|
15
|
+
} else {
|
|
16
|
+
filePath = path.join(cwd, filePath);
|
|
17
|
+
}
|
|
18
|
+
if (!existsSync(filePath)) {
|
|
19
|
+
program.error(`eslint config file not found: ${filePath}`);
|
|
20
|
+
} else {
|
|
21
|
+
const eslintConfigs = await import(filePath);
|
|
22
|
+
const oxlintConfig = "default" in eslintConfigs ? await main(eslintConfigs.default, console.warn) : await main(eslintConfigs, console.warn);
|
|
23
|
+
const oxlintFilePath = path.join(cwd, ".oxlintrc.json");
|
|
24
|
+
if (existsSync(oxlintFilePath)) {
|
|
25
|
+
renameSync(oxlintFilePath, `${oxlintFilePath}.bak`);
|
|
26
|
+
}
|
|
27
|
+
writeFileSync(oxlintFilePath, JSON.stringify(oxlintConfig, null, 2));
|
|
24
28
|
}
|
|
25
|
-
|
|
26
|
-
|
|
29
|
+
});
|
|
30
|
+
program.parse();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oxlint/migrate",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.4",
|
|
4
4
|
"description": "Generates a `.oxlintrc.json` from a existing eslint v9 configuration",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"type-check": "tsc --noEmit",
|
|
18
18
|
"test": "vitest",
|
|
19
19
|
"build": "vite build",
|
|
20
|
-
"manual-test": "pnpm build; chmod +x dist/bin/oxlint-migrate.mjs; npx .
|
|
20
|
+
"manual-test": "pnpm build; chmod +x dist/bin/oxlint-migrate.mjs; npx ."
|
|
21
21
|
},
|
|
22
22
|
"files": [
|
|
23
23
|
"dist/*",
|
|
@@ -62,8 +62,5 @@
|
|
|
62
62
|
"commander": "^13.1.0",
|
|
63
63
|
"globals": "^15.15.0"
|
|
64
64
|
},
|
|
65
|
-
"peerDependencies": {
|
|
66
|
-
"eslint": "^9"
|
|
67
|
-
},
|
|
68
65
|
"packageManager": "pnpm@9.15.0"
|
|
69
66
|
}
|