@oxlint/migrate 1.40.0 → 1.41.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,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { i as rules_exports, n as preFixForJsPlugins, r as nurseryRules, t as src_default } from "../src-pmJg5CKN.mjs";
2
+ import { i as rules_exports, n as preFixForJsPlugins, r as nurseryRules, t as src_default } from "../src-BNblTDrB.mjs";
3
3
  import { program } from "commander";
4
4
  import { existsSync, readFileSync, renameSync, writeFileSync } from "node:fs";
5
5
  import path from "node:path";
@@ -40,7 +40,7 @@ const loadESLintConfig = async (filePath) => {
40
40
 
41
41
  //#endregion
42
42
  //#region package.json
43
- var version = "1.40.0";
43
+ var version = "1.41.0";
44
44
 
45
45
  //#endregion
46
46
  //#region src/walker/comments/replaceRuleDirectiveComment.ts
@@ -282,6 +282,11 @@ const getAllProjectFiles = () => {
282
282
  //#region src/reporter.ts
283
283
  var DefaultReporter = class {
284
284
  reports = /* @__PURE__ */ new Set();
285
+ skippedRules = new Map([
286
+ ["nursery", /* @__PURE__ */ new Set()],
287
+ ["type-aware", /* @__PURE__ */ new Set()],
288
+ ["unsupported", /* @__PURE__ */ new Set()]
289
+ ]);
285
290
  report(message) {
286
291
  this.reports.add(message);
287
292
  }
@@ -291,6 +296,21 @@ var DefaultReporter = class {
291
296
  getReports() {
292
297
  return Array.from(this.reports);
293
298
  }
299
+ markSkipped(rule, category) {
300
+ this.skippedRules.get(category)?.add(rule);
301
+ }
302
+ removeSkipped(rule, category) {
303
+ this.skippedRules.get(category)?.delete(rule);
304
+ }
305
+ getSkippedRulesByCategory() {
306
+ const result = {
307
+ nursery: [],
308
+ "type-aware": [],
309
+ unsupported: []
310
+ };
311
+ for (const [category, rules] of this.skippedRules) result[category] = Array.from(rules);
312
+ return result;
313
+ }
294
314
  };
295
315
 
296
316
  //#endregion
@@ -26,10 +26,15 @@ type OxlintConfig = {
26
26
  overrides?: OxlintConfigOverride[];
27
27
  ignorePatterns?: OxlintConfigIgnorePatterns;
28
28
  };
29
+ type RuleSkippedCategory = 'nursery' | 'type-aware' | 'unsupported';
30
+ type SkippedCategoryGroup = Record<RuleSkippedCategory, string[]>;
29
31
  type Reporter = {
30
32
  report(message: string): void;
31
33
  remove(message: string): void;
32
34
  getReports(): string[];
35
+ markSkipped(rule: string, category: RuleSkippedCategory): void;
36
+ removeSkipped(rule: string, category: RuleSkippedCategory): void;
37
+ getSkippedRulesByCategory(): SkippedCategoryGroup;
33
38
  };
34
39
  type Options = {
35
40
  reporter?: Reporter;
@@ -1,3 +1,3 @@
1
- import { t as src_default } from "../src-pmJg5CKN.mjs";
1
+ import { t as src_default } from "../src-BNblTDrB.mjs";
2
2
 
3
3
  export { src_default as default };
@@ -1108,10 +1108,12 @@ const transformRuleEntry = (eslintConfig, targetConfig, options) => {
1108
1108
  if (allRules.includes(rule)) {
1109
1109
  if (!options?.withNursery && nurseryRules.includes(rule)) {
1110
1110
  options?.reporter?.report(`unsupported rule, but available as a nursery rule: ${rule}`);
1111
+ options?.reporter?.markSkipped(rule, "nursery");
1111
1112
  continue;
1112
1113
  }
1113
1114
  if (!options?.typeAware && typescriptTypeAwareRules.includes(rule)) {
1114
1115
  options?.reporter?.report(`type-aware rule detected, but \`--type-aware\` is not enabled: ${rule}`);
1116
+ options?.reporter?.markSkipped(rule, "type-aware");
1115
1117
  continue;
1116
1118
  }
1117
1119
  if (options?.merge) {
@@ -1122,17 +1124,24 @@ const transformRuleEntry = (eslintConfig, targetConfig, options) => {
1122
1124
  if (isOffValue(normalizedConfig)) {
1123
1125
  if (eslintConfig.files === void 0) delete targetConfig.rules[rule];
1124
1126
  else if (!isIgnoredPluginRule(rule)) targetConfig.rules[rule] = normalizedConfig;
1125
- if (eslintConfig.files === void 0) options.reporter?.remove(unsupportedRuleMessage);
1127
+ if (eslintConfig.files === void 0) {
1128
+ options.reporter?.remove(unsupportedRuleMessage);
1129
+ options?.reporter?.removeSkipped(rule, "unsupported");
1130
+ }
1126
1131
  continue;
1127
1132
  }
1128
1133
  if (enableJsPluginRule(targetConfig, rule, normalizedConfig)) continue;
1129
1134
  }
1130
1135
  if (!isActiveValue(normalizedConfig)) {
1131
1136
  if (isOffValue(normalizedConfig)) delete targetConfig.rules[rule];
1132
- if (eslintConfig.files === void 0) options?.reporter?.remove(unsupportedRuleMessage);
1137
+ if (eslintConfig.files === void 0) {
1138
+ options?.reporter?.remove(unsupportedRuleMessage);
1139
+ options?.reporter?.removeSkipped(rule, "unsupported");
1140
+ }
1133
1141
  continue;
1134
1142
  }
1135
1143
  options?.reporter?.report(unsupportedRuleMessage);
1144
+ options?.reporter?.markSkipped(rule, "unsupported");
1136
1145
  }
1137
1146
  }
1138
1147
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oxlint/migrate",
3
- "version": "1.40.0",
3
+ "version": "1.41.0",
4
4
  "description": "Generates a `.oxlintrc.json` from a existing eslint flat config",
5
5
  "keywords": [
6
6
  "eslint",
@@ -38,11 +38,11 @@
38
38
  "dependencies": {
39
39
  "commander": "^14.0.0",
40
40
  "globals": "^17.0.0",
41
- "oxc-parser": "^0.108.0",
41
+ "oxc-parser": "^0.110.0",
42
42
  "tinyglobby": "^0.2.14"
43
43
  },
44
44
  "devDependencies": {
45
- "@antfu/eslint-config": "^6.0.0",
45
+ "@antfu/eslint-config": "^7.0.0",
46
46
  "@eslint/js": "^9.29.0",
47
47
  "@logux/eslint-config": "^57.0.0",
48
48
  "@oxc-node/core": "^0.0.35",
@@ -74,8 +74,8 @@
74
74
  "jiti": "^2.4.2",
75
75
  "lint-staged": "^16.1.2",
76
76
  "next": "^16.0.0",
77
- "oxfmt": "^0.24.0",
78
- "oxlint": "^1.40.0",
77
+ "oxfmt": "^0.25.0",
78
+ "oxlint": "^1.41.0",
79
79
  "oxlint-tsgolint": "^0.8.3",
80
80
  "tsdown": "^0.19.0",
81
81
  "typescript-eslint": "^8.35.0",