@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.
File without changes
@@ -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 { OxlintConfig, OxlintConfigOrOverride, Reporter } from './types.js';
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: OxlintConfig) => void;
5
- export declare const detectEnvironmentByGlobals: (config: OxlintConfig) => void;
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;
@@ -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
  };
@@ -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: Reporter) => void;
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}/`) && !targetConfig.plugins.includes(plugin)) {
36
- targetConfig.plugins.push(plugin);
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
  }
@@ -11,6 +11,7 @@ export type OxlintConfigOverride = {
11
11
  rules?: Partial<Linter.RulesRecord>;
12
12
  };
13
13
  export type OxlintConfig = {
14
+ $schema?: string;
14
15
  env?: OxlintConfigEnv;
15
16
  globals?: Linter.Globals;
16
17
  plugins?: OxlintConfigPlugins;
package/package.json CHANGED
@@ -1,12 +1,24 @@
1
1
  {
2
2
  "name": "@oxlint/migrate",
3
- "version": "0.0.1",
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
- "@types/node": "^22.13.1",
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.0",
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.14.0"
63
+ "globals": "^15.15.0"
41
64
  },
42
- "scripts": {
43
- "generate": "node --import @oxc-node/core/register ./scripts/generate.ts",
44
- "format": "npx prettier --write .",
45
- "type-check": "tsc --noEmit",
46
- "test": "vitest",
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
+ }