@oxlint/migrate 1.42.0 → 1.46.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.
- package/README.md +13 -23
- package/dist/bin/oxlint-migrate.mjs +137 -32
- package/dist/{src-BiX8O61Z.mjs → settings-C8UlaScv.mjs} +628 -559
- package/dist/src/index.d.mts +2673 -6
- package/dist/src/index.mjs +58 -2
- package/package.json +10 -13
package/dist/src/index.mjs
CHANGED
|
@@ -1,3 +1,59 @@
|
|
|
1
|
-
import { t as
|
|
1
|
+
import { c as cleanUpOxlintConfig, d as transformRuleEntry, h as transformEnvAndGlobals, i as fixForJsPlugins, l as detectNeededRulesPlugins, m as detectEnvironmentByGlobals, n as warnSettingsInOverride, o as detectSameOverride, r as processConfigFiles, s as transformIgnorePatterns, t as transformSettings } from "../settings-C8UlaScv.mjs";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
//#region src/index.ts
|
|
4
|
+
const buildConfig = (configs, oxlintConfig, options) => {
|
|
5
|
+
if (oxlintConfig === void 0) if (options?.merge) oxlintConfig = {
|
|
6
|
+
plugins: [
|
|
7
|
+
"oxc",
|
|
8
|
+
"typescript",
|
|
9
|
+
"unicorn",
|
|
10
|
+
"react"
|
|
11
|
+
],
|
|
12
|
+
categories: { correctness: "warn" }
|
|
13
|
+
};
|
|
14
|
+
else oxlintConfig = {
|
|
15
|
+
$schema: "./node_modules/oxlint/configuration_schema.json",
|
|
16
|
+
plugins: [],
|
|
17
|
+
categories: { correctness: "off" }
|
|
18
|
+
};
|
|
19
|
+
if (oxlintConfig.$schema === void 0 && options?.merge) oxlintConfig.$schema = "./node_modules/oxlint/configuration_schema.json";
|
|
20
|
+
if (oxlintConfig.env?.builtin === void 0) {
|
|
21
|
+
if (oxlintConfig.env === void 0) oxlintConfig.env = {};
|
|
22
|
+
oxlintConfig.env.builtin = true;
|
|
23
|
+
}
|
|
24
|
+
const overrides = options?.merge ? oxlintConfig.overrides ?? [] : [];
|
|
25
|
+
for (const config of configs) {
|
|
26
|
+
if (config.name?.startsWith("oxlint/")) continue;
|
|
27
|
+
let targetConfig;
|
|
28
|
+
if (config.files === void 0) targetConfig = oxlintConfig;
|
|
29
|
+
else {
|
|
30
|
+
const validFiles = processConfigFiles(config.files, options?.reporter);
|
|
31
|
+
if (validFiles.length === 0) continue;
|
|
32
|
+
targetConfig = { files: validFiles };
|
|
33
|
+
const [push, result] = detectSameOverride(oxlintConfig, targetConfig);
|
|
34
|
+
if (push) overrides.push(result);
|
|
35
|
+
}
|
|
36
|
+
transformIgnorePatterns(config, targetConfig, options);
|
|
37
|
+
transformRuleEntry(config, targetConfig, config.files !== void 0 ? oxlintConfig : void 0, options);
|
|
38
|
+
transformEnvAndGlobals(config, targetConfig, options);
|
|
39
|
+
if (config.files === void 0) transformSettings(config, oxlintConfig, options);
|
|
40
|
+
else warnSettingsInOverride(config, options);
|
|
41
|
+
if ("files" in targetConfig) {
|
|
42
|
+
detectNeededRulesPlugins(targetConfig);
|
|
43
|
+
detectEnvironmentByGlobals(targetConfig);
|
|
44
|
+
cleanUpOxlintConfig(targetConfig);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
oxlintConfig.overrides = overrides;
|
|
48
|
+
detectNeededRulesPlugins(oxlintConfig);
|
|
49
|
+
detectEnvironmentByGlobals(oxlintConfig);
|
|
50
|
+
cleanUpOxlintConfig(oxlintConfig);
|
|
51
|
+
return oxlintConfig;
|
|
52
|
+
};
|
|
53
|
+
const main = async (configs, oxlintConfig, options) => {
|
|
54
|
+
const resolved = await Promise.resolve(fixForJsPlugins(configs));
|
|
55
|
+
return buildConfig(Array.isArray(resolved) ? resolved : [resolved], oxlintConfig, options);
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
//#endregion
|
|
59
|
+
export { main as default };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oxlint/migrate",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.46.0",
|
|
4
4
|
"description": "Generates a `.oxlintrc.json` from a existing eslint flat config",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"eslint",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
},
|
|
29
29
|
"scripts": {
|
|
30
30
|
"prepare": "husky",
|
|
31
|
-
"generate": "node --import @oxc-node/core/register ./scripts/generate.ts",
|
|
31
|
+
"generate": "node --import @oxc-node/core/register ./scripts/generate-vitest-rules.ts && node --import @oxc-node/core/register ./scripts/generate.ts && pnpm format",
|
|
32
32
|
"format": "oxfmt",
|
|
33
33
|
"lint": "oxlint --type-aware --type-check",
|
|
34
34
|
"test": "vitest",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"commander": "^14.0.0",
|
|
40
40
|
"globals": "^17.0.0",
|
|
41
|
-
"oxc-parser": "^0.
|
|
41
|
+
"oxc-parser": "^0.112.0",
|
|
42
42
|
"tinyglobby": "^0.2.14"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
@@ -60,6 +60,7 @@
|
|
|
60
60
|
"eslint-plugin-import": "^2.32.0",
|
|
61
61
|
"eslint-plugin-import-x": "^4.16.0",
|
|
62
62
|
"eslint-plugin-jsdoc": "^62.0.0",
|
|
63
|
+
"eslint-plugin-jsx-a11y": "^6.10.2",
|
|
63
64
|
"eslint-plugin-local": "^6.0.0",
|
|
64
65
|
"eslint-plugin-mocha": "^11.2.0",
|
|
65
66
|
"eslint-plugin-oxlint": "^1.3.0",
|
|
@@ -67,26 +68,22 @@
|
|
|
67
68
|
"eslint-plugin-react": "^7.37.5",
|
|
68
69
|
"eslint-plugin-react-hooks": "^7.0.1",
|
|
69
70
|
"eslint-plugin-react-perf": "^3.3.3",
|
|
70
|
-
"eslint-plugin-react-refresh": "^0.
|
|
71
|
+
"eslint-plugin-react-refresh": "^0.5.0",
|
|
71
72
|
"eslint-plugin-regexp": "^3.0.0",
|
|
72
73
|
"eslint-plugin-tsdoc": "^0.5.0",
|
|
73
74
|
"eslint-plugin-unicorn": "^62.0.0",
|
|
74
75
|
"husky": "^9.1.7",
|
|
75
|
-
"jiti": "^2.4.2",
|
|
76
76
|
"lint-staged": "^16.1.2",
|
|
77
77
|
"next": "^16.0.0",
|
|
78
|
-
"oxfmt": "^0.
|
|
79
|
-
"oxlint": "^1.
|
|
80
|
-
"oxlint-tsgolint": "^0.
|
|
81
|
-
"tsdown": "^0.
|
|
78
|
+
"oxfmt": "^0.28.0",
|
|
79
|
+
"oxlint": "^1.46.0",
|
|
80
|
+
"oxlint-tsgolint": "^0.11.3",
|
|
81
|
+
"tsdown": "^0.20.0",
|
|
82
82
|
"typescript-eslint": "^8.35.0",
|
|
83
83
|
"vitest": "^4.0.0"
|
|
84
84
|
},
|
|
85
|
-
"peerDependencies": {
|
|
86
|
-
"jiti": "*"
|
|
87
|
-
},
|
|
88
85
|
"lint-staged": {
|
|
89
86
|
"*": "oxfmt --no-error-on-unmatched-pattern"
|
|
90
87
|
},
|
|
91
|
-
"packageManager": "pnpm@10.28.
|
|
88
|
+
"packageManager": "pnpm@10.28.2"
|
|
92
89
|
}
|