@oxlint/migrate 0.0.1 → 0.0.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/dist/bin/oxlint-migrate.mjs +0 -0
- package/dist/src/cleanup.mjs +2 -1
- package/dist/src/env_globals.d.ts +4 -3
- package/dist/src/env_globals.mjs +13 -0
- package/dist/src/index.mjs +1 -0
- package/dist/src/plugins_rules.d.ts +1 -1
- package/dist/src/plugins_rules.mjs +4 -2
- package/dist/src/types.d.ts +1 -0
- package/package.json +34 -15
|
File without changes
|
package/dist/src/cleanup.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { removeGlobalsWithAreCoveredByEnv, ES_VERSIONS } from "./env_globals.mjs";
|
|
1
|
+
import { removeGlobalsWithAreCoveredByEnv, transformBoolGlobalToString, ES_VERSIONS } from "./env_globals.mjs";
|
|
2
2
|
const isEqualDeep = (a, b) => {
|
|
3
3
|
if (a === b) {
|
|
4
4
|
return true;
|
|
@@ -91,6 +91,7 @@ const cleanUpUselessOverridesEntries = (config) => {
|
|
|
91
91
|
};
|
|
92
92
|
const cleanUpOxlintConfig = (config) => {
|
|
93
93
|
removeGlobalsWithAreCoveredByEnv(config);
|
|
94
|
+
transformBoolGlobalToString(config);
|
|
94
95
|
if (config.globals !== void 0 && Object.keys(config.globals).length === 0) {
|
|
95
96
|
delete config.globals;
|
|
96
97
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { OxlintConfigOrOverride, Reporter } from './types.js';
|
|
2
2
|
import { Linter } from 'eslint';
|
|
3
3
|
export declare const ES_VERSIONS: number[];
|
|
4
|
-
export declare const removeGlobalsWithAreCoveredByEnv: (config:
|
|
5
|
-
export declare const
|
|
4
|
+
export declare const removeGlobalsWithAreCoveredByEnv: (config: OxlintConfigOrOverride) => void;
|
|
5
|
+
export declare const transformBoolGlobalToString: (config: OxlintConfigOrOverride) => void;
|
|
6
|
+
export declare const detectEnvironmentByGlobals: (config: OxlintConfigOrOverride) => void;
|
|
6
7
|
export declare const transformEnvAndGlobals: (eslintConfig: Linter.Config, targetConfig: OxlintConfigOrOverride, reporter?: Reporter) => void;
|
package/dist/src/env_globals.mjs
CHANGED
|
@@ -62,6 +62,18 @@ const removeGlobalsWithAreCoveredByEnv = (config) => {
|
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
64
|
};
|
|
65
|
+
const transformBoolGlobalToString = (config) => {
|
|
66
|
+
if (config.globals === void 0) {
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
for (const [entry, value] of Object.entries(config.globals)) {
|
|
70
|
+
if (value === false) {
|
|
71
|
+
config.globals[entry] = "readonly";
|
|
72
|
+
} else if (value === true) {
|
|
73
|
+
config.globals[entry] = "writable";
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
};
|
|
65
77
|
const detectEnvironmentByGlobals = (config) => {
|
|
66
78
|
if (config.globals === void 0) {
|
|
67
79
|
return;
|
|
@@ -121,5 +133,6 @@ export {
|
|
|
121
133
|
ES_VERSIONS,
|
|
122
134
|
detectEnvironmentByGlobals,
|
|
123
135
|
removeGlobalsWithAreCoveredByEnv,
|
|
136
|
+
transformBoolGlobalToString,
|
|
124
137
|
transformEnvAndGlobals
|
|
125
138
|
};
|
package/dist/src/index.mjs
CHANGED
|
@@ -4,6 +4,7 @@ import { transformIgnorePatterns } from "./ignorePatterns.mjs";
|
|
|
4
4
|
import { transformRuleEntry, detectNeededRulesPlugins } from "./plugins_rules.mjs";
|
|
5
5
|
const buildConfig = (configs, reporter) => {
|
|
6
6
|
const oxlintConfig = {
|
|
7
|
+
$schema: "./node_modules/oxlint/configuration_schema.json",
|
|
7
8
|
// disable all plugins and check later
|
|
8
9
|
plugins: [],
|
|
9
10
|
env: {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { Linter } from 'eslint';
|
|
2
2
|
import { OxlintConfigOrOverride, Reporter } from './types.js';
|
|
3
3
|
export declare const transformRuleEntry: (eslintConfig: Linter.Config, targetConfig: OxlintConfigOrOverride, reporter: Reporter) => void;
|
|
4
|
-
export declare const detectNeededRulesPlugins: (targetConfig: OxlintConfigOrOverride, reporter
|
|
4
|
+
export declare const detectNeededRulesPlugins: (targetConfig: OxlintConfigOrOverride, reporter?: Reporter) => void;
|
|
@@ -32,8 +32,10 @@ const detectNeededRulesPlugins = (targetConfig, reporter) => {
|
|
|
32
32
|
}
|
|
33
33
|
let found = false;
|
|
34
34
|
for (const [prefix, plugin] of Object.entries(rulesPrefixesForPlugins)) {
|
|
35
|
-
if (rule.startsWith(`${prefix}/`)
|
|
36
|
-
targetConfig.plugins.
|
|
35
|
+
if (rule.startsWith(`${prefix}/`)) {
|
|
36
|
+
if (!targetConfig.plugins.includes(plugin)) {
|
|
37
|
+
targetConfig.plugins.push(plugin);
|
|
38
|
+
}
|
|
37
39
|
found = true;
|
|
38
40
|
}
|
|
39
41
|
}
|
package/dist/src/types.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,12 +1,24 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oxlint/migrate",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"description": "",
|
|
5
|
-
"main": "index.js",
|
|
3
|
+
"version": "0.0.2",
|
|
4
|
+
"description": "Generates a `.oxlintrc.json` from a existing eslint v9 configuration",
|
|
6
5
|
"type": "module",
|
|
7
6
|
"bin": {
|
|
8
7
|
"oxlint-migrate": "./dist/bin/oxlint-migrate.mjs"
|
|
9
8
|
},
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "https://github.com/oxc-project/oxlint-migrate"
|
|
12
|
+
},
|
|
13
|
+
"scripts": {
|
|
14
|
+
"prepare": "husky",
|
|
15
|
+
"generate": "node --import @oxc-node/core/register ./scripts/generate.ts",
|
|
16
|
+
"format": "npx prettier --write .",
|
|
17
|
+
"type-check": "tsc --noEmit",
|
|
18
|
+
"test": "vitest",
|
|
19
|
+
"build": "vite build",
|
|
20
|
+
"manual-test": "pnpm build; chmod +x dist/bin/oxlint-migrate.mjs; npx . integration_test/projects/autoprefixer.eslint.config.mjs"
|
|
21
|
+
},
|
|
10
22
|
"files": [
|
|
11
23
|
"dist/*",
|
|
12
24
|
"README.md"
|
|
@@ -20,14 +32,25 @@
|
|
|
20
32
|
"author": "Sysix <sysix@sysix-coding.de>",
|
|
21
33
|
"license": "MIT",
|
|
22
34
|
"devDependencies": {
|
|
35
|
+
"@antfu/eslint-config": "^4.2.0",
|
|
36
|
+
"@logux/eslint-config": "^53.5.1",
|
|
23
37
|
"@oxc-node/core": "^0.0.19",
|
|
24
|
-
"@
|
|
38
|
+
"@stylistic/eslint-plugin-ts": "^3.1.0",
|
|
39
|
+
"@types/eslint-config-prettier": "^6.11.3",
|
|
40
|
+
"@types/node": "^22.13.4",
|
|
41
|
+
"@vitest/coverage-v8": "^3.0.5",
|
|
25
42
|
"eslint": "^9.20.1",
|
|
43
|
+
"eslint-config-prettier": "^10.0.1",
|
|
44
|
+
"eslint-plugin-header": "^3.1.1",
|
|
45
|
+
"eslint-plugin-local": "^6.0.0",
|
|
46
|
+
"eslint-plugin-oxlint": "^0.15.10",
|
|
47
|
+
"eslint-plugin-regexp": "^2.7.0",
|
|
26
48
|
"husky": "^9.1.7",
|
|
27
49
|
"lint-staged": "^15.4.3",
|
|
28
50
|
"oxlint": "^0.15.10",
|
|
29
|
-
"prettier": "^3.5.
|
|
51
|
+
"prettier": "^3.5.1",
|
|
30
52
|
"typescript": "^5.7.3",
|
|
53
|
+
"typescript-eslint": "^8.24.0",
|
|
31
54
|
"vite": "^6.1.0",
|
|
32
55
|
"vite-plugin-dts": "^4.5.0",
|
|
33
56
|
"vitest": "^3.0.5"
|
|
@@ -37,14 +60,10 @@
|
|
|
37
60
|
},
|
|
38
61
|
"dependencies": {
|
|
39
62
|
"commander": "^13.1.0",
|
|
40
|
-
"globals": "^15.
|
|
63
|
+
"globals": "^15.15.0"
|
|
41
64
|
},
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
"build": "vite build",
|
|
48
|
-
"manual-test": "pnpm build; chmod +x dist/bin/oxlint-migrate.mjs; npx . integration_test/projects/autoprefixer.eslint.config.mjs"
|
|
49
|
-
}
|
|
50
|
-
}
|
|
65
|
+
"peerDependencies": {
|
|
66
|
+
"eslint": "^9"
|
|
67
|
+
},
|
|
68
|
+
"packageManager": "pnpm@9.15.0"
|
|
69
|
+
}
|