@oxlint/migrate 1.51.0 → 1.53.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.
@@ -1,6 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { a as preFixForJsPlugins, f as buildUnsupportedRuleExplanations, m as rules_exports, p as nurseryRules, u as isOffValue } from "../settings-R7dCJ7Y3.mjs";
3
- import main from "../src/index.mjs";
2
+ import { a as nurseryRules, i as buildUnsupportedRuleExplanations, n as preFixForJsPlugins, o as rules_exports, r as isOffValue, t as main } from "../src-DJ9UxHkF.mjs";
4
3
  import { program } from "commander";
5
4
  import { existsSync, readFileSync, renameSync, writeFileSync } from "node:fs";
6
5
  import path from "node:path";
@@ -8,7 +7,6 @@ import { pathToFileURL } from "node:url";
8
7
  import { parseSync } from "oxc-parser";
9
8
  import { glob } from "tinyglobby";
10
9
  import { writeFile } from "node:fs/promises";
11
-
12
10
  //#region bin/config-loader.ts
13
11
  const FLAT_CONFIG_FILENAMES = [
14
12
  "eslint.config.js",
@@ -30,11 +28,9 @@ const loadESLintConfig = async (filePath) => {
30
28
  if (!existsSync(filePath)) throw new Error(`eslint config file not found: ${filePath}`);
31
29
  return import(url);
32
30
  };
33
-
34
31
  //#endregion
35
32
  //#region package.json
36
- var version = "1.51.0";
37
-
33
+ var version = "1.53.0";
38
34
  //#endregion
39
35
  //#region src/walker/comments/replaceRuleDirectiveComment.ts
40
36
  const allRules = Object.values(rules_exports).flat();
@@ -69,7 +65,6 @@ function replaceRuleDirectiveComment(comment, type, options) {
69
65
  }
70
66
  return originalComment.replace(/eslint-/, "oxlint-");
71
67
  }
72
-
73
68
  //#endregion
74
69
  //#region src/walker/comments/index.ts
75
70
  function replaceComments(comment, type, options) {
@@ -82,7 +77,6 @@ function replaceComments(comment, type, options) {
82
77
  }
83
78
  return originalComment;
84
79
  }
85
-
86
80
  //#endregion
87
81
  //#region src/walker/partialSourceTextLoader.ts
88
82
  function extractLangAttribute(source) {
@@ -212,7 +206,6 @@ function partialAstroSourceTextLoader(sourceText) {
212
206
  }));
213
207
  return results;
214
208
  }
215
-
216
209
  //#endregion
217
210
  //#region src/walker/replaceCommentsInFile.ts
218
211
  const getComments = (absoluteFilePath, partialSourceText, options) => {
@@ -248,7 +241,6 @@ function replaceCommentsInFile(absoluteFilePath, fileContent, options) {
248
241
  }
249
242
  return fileContent;
250
243
  }
251
-
252
244
  //#endregion
253
245
  //#region src/walker/index.ts
254
246
  const walkAndReplaceProjectFiles = (projectFiles, readFileSync, writeFile, options) => {
@@ -260,7 +252,6 @@ const walkAndReplaceProjectFiles = (projectFiles, readFileSync, writeFile, optio
260
252
  return writeFile(file, newSourceText);
261
253
  }));
262
254
  };
263
-
264
255
  //#endregion
265
256
  //#region bin/project-loader.ts
266
257
  const getAllProjectFiles = () => {
@@ -270,7 +261,6 @@ const getAllProjectFiles = () => {
270
261
  "!**/dist/**"
271
262
  ], { absolute: true });
272
263
  };
273
-
274
264
  //#endregion
275
265
  //#region src/reporter.ts
276
266
  var DefaultReporter = class {
@@ -306,7 +296,6 @@ var DefaultReporter = class {
306
296
  return result;
307
297
  }
308
298
  };
309
-
310
299
  //#endregion
311
300
  //#region bin/output-formatter.ts
312
301
  const unsupportedRuleExplanations = buildUnsupportedRuleExplanations();
@@ -413,7 +402,6 @@ function displayMigrationResult(outputMessage, warnings) {
413
402
  console.log(outputMessage);
414
403
  if (warnings.length > 0) console.warn(formatWarningsOutput(warnings));
415
404
  }
416
-
417
405
  //#endregion
418
406
  //#region bin/oxlint-migrate.ts
419
407
  const cwd = process.cwd();
@@ -485,6 +473,5 @@ program.name("oxlint-migrate").version(version).argument("[eslint-config]", "The
485
473
  }), reporter.getWarnings());
486
474
  });
487
475
  program.parse();
488
-
489
476
  //#endregion
490
- export { };
477
+ export {};
@@ -102,6 +102,7 @@ type OxlintConfigJsPlugins = string[];
102
102
  type OxlintConfigCategories = Partial<Record<Category, unknown>>;
103
103
  type OxlintConfigEnv = Record<string, boolean>;
104
104
  type OxlintConfigIgnorePatterns = string[];
105
+ type OxlintConfigGlobalsValue = 'readonly' | 'writable' | 'off';
105
106
  type OxlintSupportedSettingsKey = 'jsx-a11y' | 'next' | 'react' | 'jsdoc' | 'vitest';
106
107
  type OxlintSettings = { [K in OxlintSupportedSettingsKey]?: Record<string, unknown> } & Record<string, Record<string, unknown> | undefined>;
107
108
  type OxlintOptions = {
@@ -111,7 +112,7 @@ type OxlintOptions = {
111
112
  type OxlintConfigOverride = {
112
113
  files: string[];
113
114
  env?: OxlintConfigEnv;
114
- globals?: ESLint.GlobalsConfig;
115
+ globals?: Record<string, OxlintConfigGlobalsValue>;
115
116
  plugins?: OxlintConfigPlugins;
116
117
  jsPlugins?: OxlintConfigJsPlugins;
117
118
  categories?: OxlintConfigCategories;
@@ -120,7 +121,7 @@ type OxlintConfigOverride = {
120
121
  type OxlintConfig = {
121
122
  $schema?: string;
122
123
  env?: OxlintConfigEnv;
123
- globals?: ESLint.GlobalsConfig;
124
+ globals?: Record<string, OxlintConfigGlobalsValue>;
124
125
  plugins?: OxlintConfigPlugins;
125
126
  jsPlugins?: OxlintConfigJsPlugins;
126
127
  categories?: OxlintConfigCategories;
@@ -1,67 +1,2 @@
1
- import { _ as transformEnvAndGlobals, c as cleanUpOxlintConfig, d as transformRuleEntry, g as detectEnvironmentByGlobals, h as typeAwareRules, i as fixForJsPlugins, l as detectNeededRulesPlugins, n as warnSettingsInOverride, o as detectSameOverride, r as processConfigFiles, s as transformIgnorePatterns, t as transformSettings } from "../settings-R7dCJ7Y3.mjs";
2
-
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
- const globalPlugins = {};
26
- for (const config of configs) if (config.plugins) Object.assign(globalPlugins, config.plugins);
27
- for (const config of configs) {
28
- if (config.name?.startsWith("oxlint/")) continue;
29
- let targetConfig;
30
- if (config.files === void 0) targetConfig = oxlintConfig;
31
- else {
32
- const validFiles = processConfigFiles(config.files, options?.reporter);
33
- if (validFiles.length === 0) continue;
34
- targetConfig = { files: validFiles };
35
- const [push, result] = detectSameOverride(oxlintConfig, targetConfig);
36
- if (push) overrides.push(result);
37
- }
38
- transformIgnorePatterns(config, targetConfig, options);
39
- transformRuleEntry(config, targetConfig, config.files !== void 0 ? oxlintConfig : void 0, options, config.files === void 0 ? overrides : void 0, globalPlugins);
40
- transformEnvAndGlobals(config, targetConfig, options);
41
- if (config.files === void 0) transformSettings(config, oxlintConfig, options);
42
- else warnSettingsInOverride(config, options);
43
- if ("files" in targetConfig) {
44
- detectNeededRulesPlugins(targetConfig);
45
- detectEnvironmentByGlobals(targetConfig);
46
- cleanUpOxlintConfig(targetConfig);
47
- }
48
- }
49
- oxlintConfig.overrides = overrides;
50
- detectNeededRulesPlugins(oxlintConfig);
51
- detectEnvironmentByGlobals(oxlintConfig);
52
- cleanUpOxlintConfig(oxlintConfig);
53
- if (options?.typeAware) {
54
- if ([...Object.keys(oxlintConfig.rules ?? {}), ...(oxlintConfig.overrides ?? []).flatMap((o) => Object.keys(o.rules ?? {}))].some((rule) => typeAwareRules.includes(rule))) oxlintConfig.options = {
55
- ...oxlintConfig.options,
56
- typeAware: true
57
- };
58
- }
59
- return oxlintConfig;
60
- };
61
- const main = async (configs, oxlintConfig, options) => {
62
- const resolved = await Promise.resolve(fixForJsPlugins(configs));
63
- return buildConfig(Array.isArray(resolved) ? resolved : [resolved], oxlintConfig, options);
64
- };
65
-
66
- //#endregion
67
- export { main as default };
1
+ import { t as main } from "../src-DJ9UxHkF.mjs";
2
+ export { main as default };
@@ -1,21 +1,15 @@
1
1
  import globals from "globals";
2
-
3
2
  //#region \0rolldown/runtime.js
4
3
  var __defProp = Object.defineProperty;
5
4
  var __exportAll = (all, no_symbols) => {
6
5
  let target = {};
7
- for (var name in all) {
8
- __defProp(target, name, {
9
- get: all[name],
10
- enumerable: true
11
- });
12
- }
13
- if (!no_symbols) {
14
- __defProp(target, Symbol.toStringTag, { value: "Module" });
15
- }
6
+ for (var name in all) __defProp(target, name, {
7
+ get: all[name],
8
+ enumerable: true
9
+ });
10
+ if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
16
11
  return target;
17
12
  };
18
-
19
13
  //#endregion
20
14
  //#region src/env_globals.ts
21
15
  const ES_VERSIONS = [
@@ -78,8 +72,12 @@ const removeGlobalsWithAreCoveredByEnv = (config) => {
78
72
  };
79
73
  const transformBoolGlobalToString = (config) => {
80
74
  if (config.globals === void 0) return;
81
- for (const [entry, value] of Object.entries(config.globals)) if (value === false || value === "readable") config.globals[entry] = "readonly";
82
- else if (value === true || value === "writeable") config.globals[entry] = "writable";
75
+ for (const [entry, value] of Object.entries(config.globals)) config.globals[entry] = transformEslintGlobalAccessToOxlintGlobalValue(value);
76
+ };
77
+ const transformEslintGlobalAccessToOxlintGlobalValue = (global) => {
78
+ if (global === false || global === "readable" || global === "readonly") return "readonly";
79
+ else if (global === true || global === "writeable" || global === "writable") return "writable";
80
+ else return "off";
83
81
  };
84
82
  const THRESHOLD_ENVS = [
85
83
  "browser",
@@ -106,8 +104,8 @@ const transformEnvAndGlobals = (eslintConfig, targetConfig, options) => {
106
104
  if (eslintConfig.languageOptions?.globals !== void 0 && eslintConfig.languageOptions?.globals !== null) {
107
105
  if (targetConfig.globals === void 0) targetConfig.globals = {};
108
106
  if (options?.merge) {
109
- for (const [global, globalSetting] of Object.entries(eslintConfig.languageOptions.globals)) if (!(global in targetConfig.globals)) targetConfig.globals[global] = globalSetting;
110
- } else Object.assign(targetConfig.globals, eslintConfig.languageOptions.globals);
107
+ for (const [global, globalSetting] of Object.entries(eslintConfig.languageOptions.globals)) if (!(global in targetConfig.globals)) targetConfig.globals[global] = transformEslintGlobalAccessToOxlintGlobalValue(globalSetting);
108
+ } else for (const [global, globalSetting] of Object.entries(eslintConfig.languageOptions.globals)) targetConfig.globals[global] = transformEslintGlobalAccessToOxlintGlobalValue(globalSetting);
111
109
  }
112
110
  if (eslintConfig.languageOptions?.ecmaVersion !== void 0) {
113
111
  if (eslintConfig.languageOptions.ecmaVersion === "latest") {
@@ -166,7 +164,6 @@ const cleanUpSupersetEnvs = (config) => {
166
164
  if (Object.keys(override.env).length === 0) delete override.env;
167
165
  }
168
166
  };
169
-
170
167
  //#endregion
171
168
  //#region src/generated/rules.ts
172
169
  var rules_exports = /* @__PURE__ */ __exportAll({
@@ -652,8 +649,10 @@ const restrictionRules = [
652
649
  "react/forbid-dom-props",
653
650
  "react/forbid-elements",
654
651
  "react/jsx-filename-extension",
652
+ "react/no-clone-element",
655
653
  "react/no-danger",
656
654
  "react/no-multi-comp",
655
+ "react/no-react-children",
657
656
  "react/no-unknown-property",
658
657
  "react/only-export-components",
659
658
  "@typescript-eslint/explicit-function-return-type",
@@ -936,6 +935,7 @@ const nurseryRules = [
936
935
  "@typescript-eslint/dot-notation",
937
936
  "@typescript-eslint/no-unnecessary-condition",
938
937
  "@typescript-eslint/no-unnecessary-qualifier",
938
+ "@typescript-eslint/no-unnecessary-type-conversion",
939
939
  "@typescript-eslint/no-unnecessary-type-parameters",
940
940
  "@typescript-eslint/no-useless-default-assignment",
941
941
  "@typescript-eslint/prefer-find",
@@ -985,6 +985,7 @@ const typeAwareRules = [
985
985
  "@typescript-eslint/no-unnecessary-template-expression",
986
986
  "@typescript-eslint/no-unnecessary-type-arguments",
987
987
  "@typescript-eslint/no-unnecessary-type-assertion",
988
+ "@typescript-eslint/no-unnecessary-type-conversion",
988
989
  "@typescript-eslint/no-unnecessary-type-parameters",
989
990
  "@typescript-eslint/no-unsafe-argument",
990
991
  "@typescript-eslint/no-unsafe-assignment",
@@ -1021,7 +1022,6 @@ const typeAwareRules = [
1021
1022
  "@typescript-eslint/unbound-method",
1022
1023
  "@typescript-eslint/use-unknown-in-catch-callback-variable"
1023
1024
  ];
1024
-
1025
1025
  //#endregion
1026
1026
  //#region src/constants.ts
1027
1027
  const rulesPrefixesForPlugins = {
@@ -1043,6 +1043,10 @@ const rulesPrefixesForPlugins = {
1043
1043
  vitest: "vitest",
1044
1044
  vue: "vue"
1045
1045
  };
1046
+ const eslintRulesToTypescriptEquivalents = {
1047
+ "dot-notation": "@typescript-eslint/dot-notation",
1048
+ "consistent-return": "@typescript-eslint/consistent-return"
1049
+ };
1046
1050
  const typescriptRulesExtendEslintRules = [
1047
1051
  "class-methods-use-this",
1048
1052
  "default-param-last",
@@ -1063,7 +1067,6 @@ const typescriptRulesExtendEslintRules = [
1063
1067
  "no-use-before-define",
1064
1068
  "no-useless-constructor"
1065
1069
  ];
1066
-
1067
1070
  //#endregion
1068
1071
  //#region src/jsPlugins.ts
1069
1072
  const ignorePlugins = new Set([
@@ -1191,7 +1194,6 @@ const enableJsPluginRule = (targetConfig, rule, ruleEntry, plugins) => {
1191
1194
  targetConfig.rules[resolvedRule] = ruleEntry;
1192
1195
  return true;
1193
1196
  };
1194
-
1195
1197
  //#endregion
1196
1198
  //#region src/generated/unsupported-rules.json
1197
1199
  var unsupportedRules = {
@@ -1269,6 +1271,8 @@ var unsupportedRules = {
1269
1271
  "react/jsx-curly-newline": "Stylistic rule from eslint-plugin-react. Should use Oxfmt for stylistic rules, or use JS Plugins to enable this rule.",
1270
1272
  "react/jsx-child-element-spacing": "Stylistic rule from eslint-plugin-react. Should use Oxfmt for stylistic rules, or use JS Plugins to enable this rule.",
1271
1273
  "react/jsx-one-expression-per-line": "Stylistic rule from eslint-plugin-react. Should use Oxfmt for stylistic rules, or use JS Plugins to enable this rule.",
1274
+ "react/jsx-sort-props": "Stylistic rule from eslint-plugin-react. Should use Oxfmt for stylistic rules, or use JS Plugins to enable this rule.",
1275
+ "react/no-adjacent-inline-elements": "Stylistic rule from eslint-plugin-react. Should use Oxfmt for stylistic rules, or use JS Plugins to enable this rule.",
1272
1276
  "react/config": "React Compiler rules will not be implemented in oxlint for now, as they require integration with the react compiler itself. These rules can be used via JS Plugins if desired.",
1273
1277
  "react/error-boundaries": "React Compiler rules will not be implemented in oxlint for now, as they require integration with the react compiler itself. These rules can be used via JS Plugins if desired.",
1274
1278
  "react/component-hook-factories": "React Compiler rules will not be implemented in oxlint for now, as they require integration with the react compiler itself. These rules can be used via JS Plugins if desired.",
@@ -1308,6 +1312,8 @@ var unsupportedRules = {
1308
1312
  "react/sort-default-props": "`defaultProps` is removed entirely in React 19, this rule is no longer relevant. Also stylistic.",
1309
1313
  "react/sort-prop-types": "PropTypes are ignored in React 19, and this rule is only relevant if you use the PropTypes package. Also stylistic.",
1310
1314
  "react/static-property-placement": "This rule only applies to legacy class components, which are not widely used in modern React.",
1315
+ "react/require-optimization": "This rule only applies to legacy class components, which are not widely used in modern React.",
1316
+ "react/prefer-read-only-props": "This rule is niche and primarily applies to legacy class components, which are not widely used in modern React.",
1311
1317
  "typescript/sort-type-constituents": "Deprecated, replaced by `perfectionist/sort-intersection-types` and `perfectionist/sort-union-types` rules.",
1312
1318
  "typescript/no-type-alias": "Deprecated, replaced by `typescript-eslint/consistent-type-definitions` rule.",
1313
1319
  "typescript/typedef": "Deprecated.",
@@ -1557,7 +1563,6 @@ var unsupportedRules = {
1557
1563
  "vue/valid-v-bind-sync": "Deprecated.",
1558
1564
  "vue/valid-model-definition": "Deprecated."
1559
1565
  };
1560
-
1561
1566
  //#endregion
1562
1567
  //#region src/utilities.ts
1563
1568
  const isEqualDeep = (a, b) => {
@@ -1585,7 +1590,6 @@ function buildUnsupportedRuleExplanations() {
1585
1590
  }
1586
1591
  return explanations;
1587
1592
  }
1588
-
1589
1593
  //#endregion
1590
1594
  //#region src/plugins_rules.ts
1591
1595
  const allRules = Object.values(rules_exports).flat();
@@ -1666,7 +1670,8 @@ const transformRuleEntry = (eslintConfig, targetConfig, baseConfig, options, ove
1666
1670
  ...globalPlugins,
1667
1671
  ...eslintConfig.plugins
1668
1672
  } : eslintConfig.plugins;
1669
- for (const [rule, config] of Object.entries(eslintConfig.rules)) {
1673
+ for (const [originalRule, config] of Object.entries(eslintConfig.rules)) {
1674
+ const rule = options?.typeAware && eslintRulesToTypescriptEquivalents[originalRule] !== void 0 ? eslintRulesToTypescriptEquivalents[originalRule] : originalRule;
1670
1675
  const normalizedConfig = normalizeSeverityValue(config);
1671
1676
  if (!options?.merge) {
1672
1677
  removePreviousOverrideRule(rule, eslintConfig, overrides);
@@ -1695,7 +1700,7 @@ const transformRuleEntry = (eslintConfig, targetConfig, baseConfig, options, ove
1695
1700
  if (isOffValue(normalizedConfig)) {
1696
1701
  const resolvedRule = resolveJsPluginRuleName(rule, effectivePlugins);
1697
1702
  if (eslintConfig.files === void 0) delete targetConfig.rules[resolvedRule];
1698
- else if (!isIgnoredPluginRule(rule)) targetConfig.rules[resolvedRule] = normalizedConfig;
1703
+ else if (!isIgnoredPluginRule(rule)) enableJsPluginRule(targetConfig, resolvedRule, normalizedConfig, effectivePlugins);
1699
1704
  if (eslintConfig.files === void 0) {
1700
1705
  options?.reporter?.removeSkipped(rule, "js-plugins");
1701
1706
  options?.reporter?.removeSkipped(rule, "not-implemented");
@@ -1851,7 +1856,6 @@ const replaceReactRefreshPluginName = (config) => {
1851
1856
  delete config.rules[rule];
1852
1857
  }
1853
1858
  };
1854
-
1855
1859
  //#endregion
1856
1860
  //#region src/cleanup.ts
1857
1861
  const TS_ESLINT_DEFAULT_OVERRIDE = {
@@ -1976,7 +1980,6 @@ function mergeConsecutiveOverridesWithDifferingFiles(config) {
1976
1980
  }
1977
1981
  config.overrides = mergedOverrides;
1978
1982
  }
1979
-
1980
1983
  //#endregion
1981
1984
  //#region src/ignorePatterns.ts
1982
1985
  const transformIgnorePatterns = (eslintConfig, targetConfig, options) => {
@@ -1988,7 +1991,6 @@ const transformIgnorePatterns = (eslintConfig, targetConfig, options) => {
1988
1991
  if (targetConfig.ignorePatterns === void 0) targetConfig.ignorePatterns = [];
1989
1992
  for (const ignores of eslintConfig.ignores) if (!targetConfig.ignorePatterns.includes(ignores)) targetConfig.ignorePatterns.push(ignores);
1990
1993
  };
1991
-
1992
1994
  //#endregion
1993
1995
  //#region src/overrides.ts
1994
1996
  const detectSameOverride = (config, override) => {
@@ -1999,7 +2001,6 @@ const detectSameOverride = (config, override) => {
1999
2001
  if (matchedOverride !== void 0) return [false, matchedOverride];
2000
2002
  return [true, override];
2001
2003
  };
2002
-
2003
2004
  //#endregion
2004
2005
  //#region src/js_plugin_fixes.ts
2005
2006
  /**
@@ -2036,7 +2037,6 @@ function fixForJsPlugins(configs) {
2036
2037
  const preFixForJsPlugins = () => {
2037
2038
  return fixForNextEslintConfig();
2038
2039
  };
2039
-
2040
2040
  //#endregion
2041
2041
  //#region src/files.ts
2042
2042
  /**
@@ -2061,7 +2061,6 @@ function processConfigFiles(files, reporter) {
2061
2061
  } else simpleFiles.push(file);
2062
2062
  return simpleFiles;
2063
2063
  }
2064
-
2065
2064
  //#endregion
2066
2065
  //#region src/settings.ts
2067
2066
  const OXLINT_SUPPORTED_SETTINGS_KEYS = [
@@ -2167,6 +2166,68 @@ const warnSettingsInOverride = (eslintConfig, options) => {
2167
2166
  options?.reporter?.addWarning("Settings found under a 'files' pattern — oxlint does not support settings in overrides and they will be skipped:\n" + formatSettingsKeyList(settingsKeys));
2168
2167
  }
2169
2168
  };
2170
-
2171
2169
  //#endregion
2172
- export { transformEnvAndGlobals as _, preFixForJsPlugins as a, cleanUpOxlintConfig as c, transformRuleEntry as d, buildUnsupportedRuleExplanations as f, detectEnvironmentByGlobals as g, typeAwareRules as h, fixForJsPlugins as i, detectNeededRulesPlugins as l, rules_exports as m, warnSettingsInOverride as n, detectSameOverride as o, nurseryRules as p, processConfigFiles as r, transformIgnorePatterns as s, transformSettings as t, isOffValue as u };
2170
+ //#region src/index.ts
2171
+ const buildConfig = (configs, oxlintConfig, options) => {
2172
+ if (oxlintConfig === void 0) if (options?.merge) oxlintConfig = {
2173
+ plugins: [
2174
+ "oxc",
2175
+ "typescript",
2176
+ "unicorn",
2177
+ "react"
2178
+ ],
2179
+ categories: { correctness: "warn" }
2180
+ };
2181
+ else oxlintConfig = {
2182
+ $schema: "./node_modules/oxlint/configuration_schema.json",
2183
+ plugins: [],
2184
+ categories: { correctness: "off" }
2185
+ };
2186
+ if (oxlintConfig.$schema === void 0 && options?.merge) oxlintConfig.$schema = "./node_modules/oxlint/configuration_schema.json";
2187
+ if (oxlintConfig.env?.builtin === void 0) {
2188
+ if (oxlintConfig.env === void 0) oxlintConfig.env = {};
2189
+ oxlintConfig.env.builtin = true;
2190
+ }
2191
+ const overrides = options?.merge ? oxlintConfig.overrides ?? [] : [];
2192
+ const globalPlugins = {};
2193
+ for (const config of configs) if (config.plugins) Object.assign(globalPlugins, config.plugins);
2194
+ for (const config of configs) {
2195
+ if (config.name?.startsWith("oxlint/")) continue;
2196
+ let targetConfig;
2197
+ if (config.files === void 0) targetConfig = oxlintConfig;
2198
+ else {
2199
+ const validFiles = processConfigFiles(config.files, options?.reporter);
2200
+ if (validFiles.length === 0) continue;
2201
+ targetConfig = { files: validFiles };
2202
+ const [push, result] = detectSameOverride(oxlintConfig, targetConfig);
2203
+ if (push) overrides.push(result);
2204
+ }
2205
+ transformIgnorePatterns(config, targetConfig, options);
2206
+ transformRuleEntry(config, targetConfig, config.files !== void 0 ? oxlintConfig : void 0, options, config.files === void 0 ? overrides : void 0, globalPlugins);
2207
+ transformEnvAndGlobals(config, targetConfig, options);
2208
+ if (config.files === void 0) transformSettings(config, oxlintConfig, options);
2209
+ else warnSettingsInOverride(config, options);
2210
+ if ("files" in targetConfig) {
2211
+ detectNeededRulesPlugins(targetConfig);
2212
+ detectEnvironmentByGlobals(targetConfig);
2213
+ cleanUpOxlintConfig(targetConfig);
2214
+ }
2215
+ }
2216
+ oxlintConfig.overrides = overrides;
2217
+ detectNeededRulesPlugins(oxlintConfig);
2218
+ detectEnvironmentByGlobals(oxlintConfig);
2219
+ cleanUpOxlintConfig(oxlintConfig);
2220
+ if (options?.typeAware) {
2221
+ if ([...Object.keys(oxlintConfig.rules ?? {}), ...(oxlintConfig.overrides ?? []).flatMap((o) => Object.keys(o.rules ?? {}))].some((rule) => typeAwareRules.includes(rule))) oxlintConfig.options = {
2222
+ ...oxlintConfig.options,
2223
+ typeAware: true
2224
+ };
2225
+ }
2226
+ return oxlintConfig;
2227
+ };
2228
+ const main = async (configs, oxlintConfig, options) => {
2229
+ const resolved = await Promise.resolve(fixForJsPlugins(configs));
2230
+ return buildConfig(Array.isArray(resolved) ? resolved : [resolved], oxlintConfig, options);
2231
+ };
2232
+ //#endregion
2233
+ export { nurseryRules as a, buildUnsupportedRuleExplanations as i, preFixForJsPlugins as n, rules_exports as o, isOffValue as r, main as t };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oxlint/migrate",
3
- "version": "1.51.0",
3
+ "version": "1.53.0",
4
4
  "description": "Generates a `.oxlintrc.json` from a existing eslint flat config",
5
5
  "keywords": [
6
6
  "eslint",
@@ -33,7 +33,7 @@
33
33
  "generate:unsupported": "node --import @oxc-node/core/register ./scripts/fetch-unsupported-rules.ts",
34
34
  "generate:all": "pnpm generate:vitest && pnpm generate && pnpm generate:unsupported && pnpm format",
35
35
  "format": "oxfmt",
36
- "lint": "oxlint --type-aware --type-check",
36
+ "lint": "oxlint",
37
37
  "test": "vitest",
38
38
  "build": "tsdown",
39
39
  "manual-test": "pnpm build; chmod +x dist/bin/oxlint-migrate.mjs; npx ."
@@ -41,7 +41,7 @@
41
41
  "dependencies": {
42
42
  "commander": "^14.0.0",
43
43
  "globals": "^17.0.0",
44
- "oxc-parser": "^0.115.0",
44
+ "oxc-parser": "^0.116.0",
45
45
  "tinyglobby": "^0.2.14"
46
46
  },
47
47
  "devDependencies": {
@@ -83,10 +83,10 @@
83
83
  "husky": "^9.1.7",
84
84
  "lint-staged": "^16.1.2",
85
85
  "next": "^16.0.0",
86
- "oxfmt": "^0.35.0",
87
- "oxlint": "^1.51.0",
88
- "oxlint-tsgolint": "^0.15.0",
89
- "tsdown": "^0.20.0",
86
+ "oxfmt": "^0.36.0",
87
+ "oxlint": "^1.53.0",
88
+ "oxlint-tsgolint": "^0.16.0",
89
+ "tsdown": "^0.21.0",
90
90
  "typescript-eslint": "^8.35.0",
91
91
  "vitest": "^4.0.0"
92
92
  },