@oxlint/migrate 1.75.0 → 1.76.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 { a as nurseryRules, i as buildUnsupportedRuleExplanations, n as preFixForJsPlugins, o as rules_exports, r as isOffValue, s as normalizeRuleToCanonical, t as main } from "../src-V0W_ayvY.mjs";
2
+ import { a as nurseryRules, i as buildUnsupportedRuleExplanations, n as preFixForJsPlugins, o as rules_exports, r as isOffValue, s as normalizeRuleToCanonical, t as main } from "../src-CMaVigSj.mjs";
3
3
  import { program } from "commander";
4
4
  import { existsSync, readFileSync, renameSync, writeFileSync } from "node:fs";
5
5
  import path from "node:path";
@@ -30,7 +30,7 @@ const loadESLintConfig = async (filePath) => {
30
30
  };
31
31
  //#endregion
32
32
  //#region package.json
33
- var version = "1.75.0";
33
+ var version = "1.76.0";
34
34
  //#endregion
35
35
  //#region src/walker/comments/replaceRuleDirectiveComment.ts
36
36
  const allRulesSet = new Set(Object.values(rules_exports).flat());
@@ -10,7 +10,7 @@
10
10
  /**
11
11
  * What to enforce for `/// <reference types="..." />` references.
12
12
  */
13
- //#region node_modules/.pnpm/oxlint@1.75.0_oxlint-tsgolint@0.24.0/node_modules/oxlint/dist/index.d.ts
13
+ //#region node_modules/.pnpm/oxlint@1.76.0_oxlint-tsgolint@0.24.0/node_modules/oxlint/dist/index.d.ts
14
14
  //#region src-js/package/config.generated.d.ts
15
15
  type AllowWarnDeny = ("allow" | "off" | "warn" | "error" | "deny") | number;
16
16
  type GlobalValue = ("readonly" | "writable" | "off") | undefined;
@@ -95,8 +95,8 @@ type MaxDependenciesConfigJson = number | MaxDependenciesConfig;
95
95
  type Target = "single" | "any";
96
96
  type TestCaseName = "it" | "test";
97
97
  type JestFnType = "hook" | "describe" | "test" | "expect" | "jest" | "unknown";
98
- type DummyRule = AllowWarnDeny | [AllowWarnDeny, ...unknown[]];
99
98
  type SnapshotHintMode = "always" | "multi";
99
+ type DummyRule = AllowWarnDeny | [AllowWarnDeny, ...unknown[]];
100
100
  type AltTextElements = "img" | "object" | "area" | 'input[type="image"]';
101
101
  type AnchorIsValidAspect = "noHref" | "invalidHref" | "preferButton";
102
102
  type Assert = "htmlFor" | "nesting" | "both" | "either";
@@ -123,6 +123,8 @@ type NoInnerDeclarationsConfig = "functions" | "both";
123
123
  type BlockScopedFunctions = "allow" | "disallow";
124
124
  type Namespaces = "allow" | "disallow";
125
125
  type NoMagicNumbersNumber = number | string;
126
+ type NoRestrictedGlobalsConfigEnum = string | RestrictedGlobal | NoRestrictedGlobalsObjectConfig;
127
+ type GlobalNameOrObject = string | RestrictedGlobal;
126
128
  type NoRestrictedImportsConfigEnum = string | RestrictedPath | NoRestrictedImportsConfig;
127
129
  type PossiblePaths = string | RestrictedPath;
128
130
  type PossiblePatterns = string | RestrictedPattern;
@@ -145,6 +147,7 @@ type Location = "start" | "anywhere";
145
147
  * The rule takes a single option - an array of possible callback names - which may include object methods. The default callback names are `callback`, `cb`, `next`.
146
148
  */
147
149
  type CallbackReturn = string[];
150
+ type ExportsStyleMode = "module.exports" | "exports";
148
151
  /**
149
152
  * The rule takes a single string option: the name of the error parameter.
150
153
  *
@@ -483,9 +486,23 @@ interface Oxlintrc$1 {
483
486
  */
484
487
  env?: OxlintEnv;
485
488
  /**
486
- * Paths of configuration files that this configuration file extends (inherits from). The files
487
- * are resolved relative to the location of the configuration file that contains the `extends`
488
- * property. The configuration files are merged from the first to the last, with the last file
489
+ * Configurations that this configuration file extends (inherits from).
490
+ *
491
+ * In `.oxlintrc.json`, `extends` has type `string[]`. Each string is a path to a configuration
492
+ * file, resolved relative to the location of the configuration file that contains the
493
+ * `extends` property.
494
+ *
495
+ * In `oxlint.config.ts`, `extends` has type `OxlintConfig[]`. Import each configuration and
496
+ * pass the configuration object directly:
497
+ *
498
+ * ```ts
499
+ * import { defineConfig } from "oxlint";
500
+ * import baseConfig from "./base-config.ts";
501
+ *
502
+ * export default defineConfig({ extends: [baseConfig] });
503
+ * ```
504
+ *
505
+ * Configurations are merged from the first to the last, with the last configuration
489
506
  * overriding the previous ones.
490
507
  */
491
508
  extends?: string[];
@@ -836,6 +853,7 @@ interface DummyRuleMap {
836
853
  "getter-return"?: RuleNoConfig | [AllowWarnDeny, GetterReturn];
837
854
  "grouped-accessor-pairs"?: RuleNoConfig | [AllowWarnDeny, PairOrder] | [AllowWarnDeny, PairOrder, GroupedAccessorPairsConfig];
838
855
  "guard-for-in"?: RuleNoConfig;
856
+ "id-denylist"?: RuleNoConfig | [AllowWarnDeny, string, ...string[]];
839
857
  "id-length"?: RuleNoConfig | [AllowWarnDeny, IdLengthConfig];
840
858
  "id-match"?: RuleNoConfig | [AllowWarnDeny, string] | [AllowWarnDeny, string, IdMatchOptions];
841
859
  "import/consistent-type-specifier-style"?: RuleNoConfig | [AllowWarnDeny, Mode];
@@ -913,7 +931,7 @@ interface DummyRuleMap {
913
931
  "jest/prefer-hooks-on-top"?: RuleNoConfig;
914
932
  "jest/prefer-importing-jest-globals"?: RuleNoConfig | [AllowWarnDeny, PreferImportingJestGlobalsConfig];
915
933
  "jest/prefer-jest-mocked"?: RuleNoConfig;
916
- "jest/prefer-lowercase-title"?: DummyRule;
934
+ "jest/prefer-lowercase-title"?: RuleNoConfig | [AllowWarnDeny, PreferLowercaseTitleConfig];
917
935
  "jest/prefer-mock-promise-shorthand"?: RuleNoConfig;
918
936
  "jest/prefer-mock-return-shorthand"?: RuleNoConfig;
919
937
  "jest/prefer-snapshot-hint"?: RuleNoConfig | [AllowWarnDeny, SnapshotHintMode];
@@ -1097,7 +1115,7 @@ interface DummyRuleMap {
1097
1115
  "no-redeclare"?: RuleNoConfig | [AllowWarnDeny, NoRedeclare];
1098
1116
  "no-regex-spaces"?: RuleNoConfig;
1099
1117
  "no-restricted-exports"?: RuleNoConfig | [AllowWarnDeny, NoRestrictedExportsConfig];
1100
- "no-restricted-globals"?: DummyRule;
1118
+ "no-restricted-globals"?: RuleNoConfig | [AllowWarnDeny, NoRestrictedGlobalsConfigEnum, ...NoRestrictedGlobalsConfigEnum[]];
1101
1119
  "no-restricted-imports"?: RuleNoConfig | [AllowWarnDeny, NoRestrictedImportsConfigEnum, ...NoRestrictedImportsConfigEnum[]];
1102
1120
  "no-restricted-properties"?: RuleNoConfig | [AllowWarnDeny, PropertyDetails, ...PropertyDetails[]];
1103
1121
  "no-return-assign"?: RuleNoConfig | [AllowWarnDeny, NoReturnAssignMode];
@@ -1145,6 +1163,7 @@ interface DummyRuleMap {
1145
1163
  "no-warning-comments"?: RuleNoConfig | [AllowWarnDeny, NoWarningCommentsConfigJson];
1146
1164
  "no-with"?: RuleNoConfig;
1147
1165
  "node/callback-return"?: RuleNoConfig | [AllowWarnDeny, CallbackReturn];
1166
+ "node/exports-style"?: RuleNoConfig | [AllowWarnDeny, ExportsStyleMode] | [AllowWarnDeny, ExportsStyleMode, ExportsStyleOptions];
1148
1167
  "node/global-require"?: RuleNoConfig;
1149
1168
  "node/handle-callback-err"?: RuleNoConfig | [AllowWarnDeny, HandleCallbackErrConfig];
1150
1169
  "node/no-exports-assign"?: RuleNoConfig;
@@ -1161,6 +1180,7 @@ interface DummyRuleMap {
1161
1180
  "oxc/bad-bitwise-operator"?: RuleNoConfig;
1162
1181
  "oxc/bad-char-at-comparison"?: RuleNoConfig;
1163
1182
  "oxc/bad-comparison-sequence"?: RuleNoConfig;
1183
+ "oxc/bad-match-all-arg"?: RuleNoConfig;
1164
1184
  "oxc/bad-min-max-func"?: RuleNoConfig;
1165
1185
  "oxc/bad-object-literal-comparison"?: RuleNoConfig;
1166
1186
  "oxc/bad-replace-all-arg"?: RuleNoConfig;
@@ -1586,7 +1606,7 @@ interface DummyRuleMap {
1586
1606
  "vitest/prefer-hooks-on-top"?: RuleNoConfig;
1587
1607
  "vitest/prefer-import-in-mock"?: RuleNoConfig | [AllowWarnDeny, PreferImportInMockConfig];
1588
1608
  "vitest/prefer-importing-vitest-globals"?: RuleNoConfig;
1589
- "vitest/prefer-lowercase-title"?: DummyRule;
1609
+ "vitest/prefer-lowercase-title"?: RuleNoConfig | [AllowWarnDeny, PreferLowercaseTitleConfig];
1590
1610
  "vitest/prefer-mock-promise-shorthand"?: RuleNoConfig;
1591
1611
  "vitest/prefer-mock-return-shorthand"?: RuleNoConfig;
1592
1612
  "vitest/prefer-snapshot-hint"?: RuleNoConfig | [AllowWarnDeny, SnapshotHintMode];
@@ -2306,6 +2326,96 @@ interface PreferImportingJestGlobalsConfig {
2306
2326
  */
2307
2327
  types?: JestFnType[];
2308
2328
  }
2329
+ interface PreferLowercaseTitleConfig {
2330
+ /**
2331
+ * This array option allows specifying prefixes, which contain capitals that titles
2332
+ * can start with. This can be useful when writing tests for API endpoints, where
2333
+ * you'd like to prefix with the HTTP method.
2334
+ * By default, nothing is allowed (the equivalent of `{ "allowedPrefixes": [] }`).
2335
+ *
2336
+ * Example of **correct** code for the `{ "allowedPrefixes": ["GET"] }` option:
2337
+ * ```js
2338
+ * /* jest/prefer-lowercase-title: ["error", { "allowedPrefixes": ["GET"] }] * /
2339
+ * describe('GET /live');
2340
+ * ```
2341
+ */
2342
+ allowedPrefixes?: string[];
2343
+ /**
2344
+ * This array option controls which Jest or Vitest functions are checked by this rule. There
2345
+ * are four possible values:
2346
+ * - `"describe"`
2347
+ * - `"test"`
2348
+ * - `"it"`
2349
+ * - `"bench"`
2350
+ *
2351
+ * By default, none of these options are enabled (the equivalent of
2352
+ * `{ "ignore": [] }`).
2353
+ *
2354
+ * Example of **correct** code for the `{ "ignore": ["describe"] }` option:
2355
+ * ```js
2356
+ * /* jest/prefer-lowercase-title: ["error", { "ignore": ["describe"] }] * /
2357
+ * describe('Uppercase description');
2358
+ * ```
2359
+ *
2360
+ * Example of **correct** code for the `{ "ignore": ["test"] }` option:
2361
+ * ```js
2362
+ * /* jest/prefer-lowercase-title: ["error", { "ignore": ["test"] }] * /
2363
+ * test('Uppercase description');
2364
+ * ```
2365
+ *
2366
+ * Example of **correct** code for the `{ "ignore": ["it"] }` option:
2367
+ * ```js
2368
+ * /* jest/prefer-lowercase-title: ["error", { "ignore": ["it"] }] * /
2369
+ * it('Uppercase description');
2370
+ * ```
2371
+ */
2372
+ ignore?: string[];
2373
+ /**
2374
+ * This option can be set to allow only the top-level `describe` blocks to have a
2375
+ * title starting with an upper-case letter.
2376
+ *
2377
+ * Example of **correct** code for the `{ "ignoreTopLevelDescribe": true }` option:
2378
+ * ```js
2379
+ * /* jest/prefer-lowercase-title: ["error", { "ignoreTopLevelDescribe": true }] * /
2380
+ * describe('MyClass', () => {
2381
+ * describe('#myMethod', () => {
2382
+ * it('does things', () => {
2383
+ * //
2384
+ * });
2385
+ * });
2386
+ * });
2387
+ * ```
2388
+ */
2389
+ ignoreTopLevelDescribe?: boolean;
2390
+ /**
2391
+ * This option can be set to only validate that the first character of a test name is lowercased.
2392
+ *
2393
+ * Example of **correct** code for the `{ "lowercaseFirstCharacterOnly": true }` option:
2394
+ * ```js
2395
+ * /* vitest/prefer-lowercase-title: ["error", { "lowercaseFirstCharacterOnly": true }] * /
2396
+ * describe('myClass', () => {
2397
+ * describe('myMethod', () => {
2398
+ * it('does things', () => {
2399
+ * //
2400
+ * });
2401
+ * });
2402
+ * });
2403
+ * ```
2404
+ *
2405
+ * Example of **incorrect** code for the `{ "lowercaseFirstCharacterOnly": true }` option:
2406
+ * ```js
2407
+ * /* vitest/prefer-lowercase-title: ["error", { "lowercaseFirstCharacterOnly": true }] * /
2408
+ * describe('MyClass', () => {
2409
+ * describe('MyMethod', () => {
2410
+ * it('does things', () => {
2411
+ * //
2412
+ * });
2413
+ * });
2414
+ * });
2415
+ * ```
2416
+ */
2417
+ lowercaseFirstCharacterOnly?: boolean;
2418
+ }
2309
2419
  interface RequireHookConfig {
2310
2420
  /**
2311
2421
  * An array of function names that are allowed to be called outside of hooks.
@@ -3389,6 +3499,38 @@ interface RestrictDefaultExports {
3389
3499
  */
3390
3500
  namespaceFrom?: boolean;
3391
3501
  }
3502
+ /**
3503
+ * A restricted global with an optional custom message.
3504
+ */
3505
+ interface RestrictedGlobal {
3506
+ /**
3507
+ * A custom message shown when the restricted global is used.
3508
+ */
3509
+ message?: string;
3510
+ /**
3511
+ * The name of the restricted global.
3512
+ */
3513
+ name: string;
3514
+ }
3515
+ /**
3516
+ * Object form of the configuration, which additionally allows detecting
3517
+ * restricted globals accessed via global objects.
3518
+ */
3519
+ interface NoRestrictedGlobalsObjectConfig {
3520
+ /**
3521
+ * Whether to also detect restricted globals accessed via global objects. Default is `false`.
3522
+ */
3523
+ checkGlobalObject?: boolean;
3524
+ /**
3525
+ * Additional global object names to check when `checkGlobalObject` is enabled.
3526
+ * By default, the rule checks these global objects: `globalThis`, `self`, and `window`.
3527
+ */
3528
+ globalObjects?: string[];
3529
+ /**
3530
+ * The restricted globals, as names or `{ "name", "message" }` objects.
3531
+ */
3532
+ globals: GlobalNameOrObject[];
3533
+ }
3392
3534
  interface RestrictedPath {
3393
3535
  allowImportNames?: string[];
3394
3536
  allowTypeImports?: boolean;
@@ -3932,6 +4074,12 @@ interface NoWarningCommentsConfigJson {
3932
4074
  location?: Location;
3933
4075
  terms?: string[];
3934
4076
  }
4077
+ interface ExportsStyleOptions {
4078
+ /**
4079
+ * If this option is set to `true`, `module.exports = exports = obj` are allowed.
4080
+ */
4081
+ allowBatchAssign?: boolean;
4082
+ }
3935
4083
  interface NoMixedRequiresOptions {
3936
4084
  allowCall?: boolean;
3937
4085
  grouping?: boolean;
@@ -6747,6 +6895,11 @@ interface VitestPluginSettings {
6747
6895
  //#region src-js/package/config.d.ts
6748
6896
  type Oxlintrc = Omit<Oxlintrc$1, "$schema" | "extends">;
6749
6897
  interface OxlintConfig$1 extends Oxlintrc {
6898
+ /**
6899
+ * Configuration objects to extend.
6900
+ *
6901
+ * Import configurations and pass them directly instead of using file paths.
6902
+ */
6750
6903
  extends?: OxlintConfig$1[];
6751
6904
  }
6752
6905
  //#endregion
@@ -1,2 +1,2 @@
1
- import { t as main } from "../src-V0W_ayvY.mjs";
1
+ import { t as main } from "../src-CMaVigSj.mjs";
2
2
  export { main as default };
@@ -546,6 +546,7 @@ const styleRules = [
546
546
  "func-style",
547
547
  "grouped-accessor-pairs",
548
548
  "guard-for-in",
549
+ "id-denylist",
549
550
  "id-length",
550
551
  "id-match",
551
552
  "init-declarations",
@@ -651,6 +652,7 @@ const styleRules = [
651
652
  "jsdoc/require-throws-description",
652
653
  "jsdoc/require-yields-description",
653
654
  "node/callback-return",
655
+ "node/exports-style",
654
656
  "node/global-require",
655
657
  "node/no-exports-assign",
656
658
  "node/no-mixed-requires",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oxlint/migrate",
3
- "version": "1.75.0",
3
+ "version": "1.76.0",
4
4
  "description": "Generates a `.oxlintrc.json` from a existing eslint flat config",
5
5
  "keywords": [
6
6
  "eslint",
@@ -73,7 +73,7 @@
73
73
  "lint-staged": "^17.0.0",
74
74
  "next": "^16.0.0",
75
75
  "oxfmt": "^0.58.0",
76
- "oxlint": "^1.75.0",
76
+ "oxlint": "^1.76.0",
77
77
  "oxlint-tsgolint": "^0.24.0",
78
78
  "tsdown": "^0.22.0",
79
79
  "typescript": "^6.0.0",