@depup/oxlint 1.56.0-depup.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.
@@ -0,0 +1,698 @@
1
+ //#region src-js/package/config.generated.d.ts
2
+ type AllowWarnDeny = ("allow" | "off" | "warn" | "error" | "deny") | number;
3
+ type GlobalValue = "readonly" | "writable" | "off";
4
+ type ExternalPluginEntry = string | {
5
+ /**
6
+ * Custom name/alias for the plugin.
7
+ *
8
+ * Note: The following plugin names are reserved because they are implemented natively in Rust within oxlint and cannot be used for JS plugins:
9
+ * - react (includes react-hooks)
10
+ * - unicorn
11
+ * - typescript (includes @typescript-eslint)
12
+ * - oxc
13
+ * - import (includes import-x)
14
+ * - jsdoc
15
+ * - jest
16
+ * - vitest
17
+ * - jsx-a11y
18
+ * - nextjs
19
+ * - react-perf
20
+ * - promise
21
+ * - node
22
+ * - vue
23
+ * - eslint
24
+ *
25
+ * If you need to use the JavaScript version of any of these plugins, provide a custom alias to avoid conflicts.
26
+ */
27
+ name: string;
28
+ /**
29
+ * Path or package name of the plugin
30
+ */
31
+ specifier: string;
32
+ };
33
+ /**
34
+ * A set of glob patterns.
35
+ */
36
+ type GlobSet = string[];
37
+ type LintPluginOptionsSchema = "eslint" | "react" | "unicorn" | "typescript" | "oxc" | "import" | "jsdoc" | "jest" | "vitest" | "jsx-a11y" | "nextjs" | "react-perf" | "promise" | "node" | "vue";
38
+ type LintPlugins = LintPluginOptionsSchema[];
39
+ type DummyRule = AllowWarnDeny | unknown[];
40
+ type OxlintOverrides = OxlintOverride[];
41
+ type TagNamePreference = string | {
42
+ message: string;
43
+ replacement: string;
44
+ [k: string]: unknown;
45
+ } | {
46
+ message: string;
47
+ [k: string]: unknown;
48
+ } | boolean;
49
+ type OneOrManyFor_String = string | string[];
50
+ type CustomComponent = string | {
51
+ attribute: string;
52
+ name: string;
53
+ [k: string]: unknown;
54
+ } | {
55
+ attributes: string[];
56
+ name: string;
57
+ [k: string]: unknown;
58
+ };
59
+ /**
60
+ * Oxlint Configuration File
61
+ *
62
+ * This configuration is aligned with ESLint v8's configuration schema (`eslintrc.json`).
63
+ *
64
+ * Usage: `oxlint -c oxlintrc.json`
65
+ *
66
+ * Example
67
+ *
68
+ * `.oxlintrc.json`
69
+ *
70
+ * ```json
71
+ * {
72
+ * "$schema": "./node_modules/oxlint/configuration_schema.json",
73
+ * "plugins": [
74
+ * "import",
75
+ * "typescript",
76
+ * "unicorn"
77
+ * ],
78
+ * "env": {
79
+ * "browser": true
80
+ * },
81
+ * "globals": {
82
+ * "foo": "readonly"
83
+ * },
84
+ * "settings": {
85
+ * "react": {
86
+ * "version": "18.2.0"
87
+ * },
88
+ * "custom": {
89
+ * "option": true
90
+ * }
91
+ * },
92
+ * "rules": {
93
+ * "eqeqeq": "warn",
94
+ * "import/no-cycle": "error",
95
+ * "react/self-closing-comp": [
96
+ * "error",
97
+ * {
98
+ * "html": false
99
+ * }
100
+ * ]
101
+ * },
102
+ * "overrides": [
103
+ * {
104
+ * "files": [
105
+ * "*.test.ts",
106
+ * "*.spec.ts"
107
+ * ],
108
+ * "rules": {
109
+ * "@typescript-eslint/no-explicit-any": "off"
110
+ * }
111
+ * }
112
+ * ]
113
+ * }
114
+ * ```
115
+ *
116
+ * `oxlint.config.ts`
117
+ *
118
+ * ```ts
119
+ * import { defineConfig } from "oxlint";
120
+ *
121
+ * export default defineConfig({
122
+ * plugins: ["import", "typescript", "unicorn"],
123
+ * env: {
124
+ * "browser": true
125
+ * },
126
+ * globals: {
127
+ * "foo": "readonly"
128
+ * },
129
+ * settings: {
130
+ * react: {
131
+ * version: "18.2.0"
132
+ * },
133
+ * custom: { option: true }
134
+ * },
135
+ * rules: {
136
+ * "eqeqeq": "warn",
137
+ * "import/no-cycle": "error",
138
+ * "react/self-closing-comp": ["error", { "html": false }]
139
+ * },
140
+ * overrides: [
141
+ * {
142
+ * files: ["*.test.ts", "*.spec.ts"],
143
+ * rules: {
144
+ * "@typescript-eslint/no-explicit-any": "off"
145
+ * }
146
+ * }
147
+ * ]
148
+ * });
149
+ * ```
150
+ */
151
+ interface Oxlintrc$1 {
152
+ /**
153
+ * Schema URI for editor tooling.
154
+ */
155
+ $schema?: string;
156
+ categories?: RuleCategories;
157
+ /**
158
+ * Environments enable and disable collections of global variables.
159
+ */
160
+ env?: OxlintEnv;
161
+ /**
162
+ * Paths of configuration files that this configuration file extends (inherits from). The files
163
+ * are resolved relative to the location of the configuration file that contains the `extends`
164
+ * property. The configuration files are merged from the first to the last, with the last file
165
+ * overriding the previous ones.
166
+ */
167
+ extends?: string[];
168
+ /**
169
+ * Enabled or disabled specific global variables.
170
+ */
171
+ globals?: OxlintGlobals;
172
+ /**
173
+ * Globs to ignore during linting. These are resolved from the configuration file path.
174
+ */
175
+ ignorePatterns?: string[];
176
+ /**
177
+ * JS plugins, allows usage of ESLint plugins with Oxlint.
178
+ *
179
+ * Read more about JS plugins in
180
+ * [the docs](https://oxc.rs/docs/guide/usage/linter/js-plugins.html).
181
+ *
182
+ * Note: JS plugins are in alpha and not subject to semver.
183
+ *
184
+ * Examples:
185
+ *
186
+ * Basic usage with a local plugin path.
187
+ *
188
+ * ```json
189
+ * {
190
+ * "jsPlugins": [
191
+ * "./custom-plugin.js"
192
+ * ],
193
+ * "rules": {
194
+ * "custom/rule-name": "warn"
195
+ * }
196
+ * }
197
+ * ```
198
+ *
199
+ * Using a built-in Rust plugin alongside a JS plugin with the same name
200
+ * by giving the JS plugin an alias.
201
+ *
202
+ * ```json
203
+ * {
204
+ * "plugins": [
205
+ * "import"
206
+ * ],
207
+ * "jsPlugins": [
208
+ * {
209
+ * "name": "import-js",
210
+ * "specifier": "eslint-plugin-import"
211
+ * }
212
+ * ],
213
+ * "rules": {
214
+ * "import/no-cycle": "error",
215
+ * "import-js/no-unresolved": "warn"
216
+ * }
217
+ * }
218
+ * ```
219
+ */
220
+ jsPlugins?: null | ExternalPluginEntry[];
221
+ /**
222
+ * Oxlint config options.
223
+ */
224
+ options?: OxlintOptions;
225
+ /**
226
+ * Add, remove, or otherwise reconfigure rules for specific files or groups of files.
227
+ */
228
+ overrides?: OxlintOverrides;
229
+ /**
230
+ * Enabled built-in plugins for Oxlint.
231
+ * You can view the list of available plugins on
232
+ * [the website](https://oxc.rs/docs/guide/usage/linter/plugins.html#supported-plugins).
233
+ *
234
+ * NOTE: Setting the `plugins` field will overwrite the base set of plugins.
235
+ * The `plugins` array should reflect all of the plugins you want to use.
236
+ */
237
+ plugins?: LintPlugins;
238
+ /**
239
+ * Example
240
+ *
241
+ * `.oxlintrc.json`
242
+ *
243
+ * ```json
244
+ * {
245
+ * "$schema": "./node_modules/oxlint/configuration_schema.json",
246
+ * "rules": {
247
+ * "eqeqeq": "warn",
248
+ * "import/no-cycle": "error",
249
+ * "prefer-const": [
250
+ * "error",
251
+ * {
252
+ * "ignoreReadBeforeAssign": true
253
+ * }
254
+ * ]
255
+ * }
256
+ * }
257
+ * ```
258
+ *
259
+ * See [Oxlint Rules](https://oxc.rs/docs/guide/usage/linter/rules.html) for the list of
260
+ * rules.
261
+ */
262
+ rules?: DummyRuleMap;
263
+ /**
264
+ * Plugin-specific configuration for both built-in and custom plugins.
265
+ * This includes settings for built-in plugins such as `react` and `jsdoc`
266
+ * as well as configuring settings for JS custom plugins loaded via `jsPlugins`.
267
+ */
268
+ settings?: OxlintPluginSettings;
269
+ }
270
+ /**
271
+ * Configure an entire category of rules all at once.
272
+ *
273
+ * Rules enabled or disabled this way will be overwritten by individual rules in the `rules` field.
274
+ *
275
+ * Example
276
+ * ```json
277
+ * {
278
+ * "$schema": "./node_modules/oxlint/configuration_schema.json",
279
+ * "categories": {
280
+ * "correctness": "warn"
281
+ * },
282
+ * "rules": {
283
+ * "eslint/no-unused-vars": "error"
284
+ * }
285
+ * }
286
+ * ```
287
+ */
288
+ interface RuleCategories {
289
+ correctness?: AllowWarnDeny;
290
+ nursery?: AllowWarnDeny;
291
+ pedantic?: AllowWarnDeny;
292
+ perf?: AllowWarnDeny;
293
+ restriction?: AllowWarnDeny;
294
+ style?: AllowWarnDeny;
295
+ suspicious?: AllowWarnDeny;
296
+ }
297
+ /**
298
+ * Predefine global variables.
299
+ *
300
+ * Environments specify what global variables are predefined.
301
+ * See [ESLint's list of environments](https://eslint.org/docs/v8.x/use/configure/language-options#specifying-environments)
302
+ * for what environments are available and what each one provides.
303
+ */
304
+ interface OxlintEnv {
305
+ [k: string]: boolean;
306
+ }
307
+ /**
308
+ * Add or remove global variables.
309
+ *
310
+ * For each global variable, set the corresponding value equal to `"writable"`
311
+ * to allow the variable to be overwritten or `"readonly"` to disallow overwriting.
312
+ *
313
+ * Globals can be disabled by setting their value to `"off"`. For example, in
314
+ * an environment where most Es2015 globals are available but `Promise` is unavailable,
315
+ * you might use this config:
316
+ *
317
+ * ```json
318
+ * {
319
+ * "$schema": "./node_modules/oxlint/configuration_schema.json",
320
+ * "env": {
321
+ * "es6": true
322
+ * },
323
+ * "globals": {
324
+ * "Promise": "off"
325
+ * }
326
+ * }
327
+ * ```
328
+ *
329
+ * You may also use `"readable"` or `false` to represent `"readonly"`, and
330
+ * `"writeable"` or `true` to represent `"writable"`.
331
+ */
332
+ interface OxlintGlobals {
333
+ [k: string]: GlobalValue;
334
+ }
335
+ /**
336
+ * Options for the linter.
337
+ */
338
+ interface OxlintOptions {
339
+ /**
340
+ * Ensure warnings produce a non-zero exit code.
341
+ *
342
+ * Equivalent to passing `--deny-warnings` on the CLI.
343
+ */
344
+ denyWarnings?: boolean;
345
+ /**
346
+ * Specify a warning threshold. Exits with an error status if warnings exceed this value.
347
+ *
348
+ * Equivalent to passing `--max-warnings` on the CLI.
349
+ */
350
+ maxWarnings?: number;
351
+ /**
352
+ * Report unused disable directives (e.g. `// oxlint-disable-line` or `// eslint-disable-line`).
353
+ *
354
+ * Equivalent to passing `--report-unused-disable-directives-severity` on the CLI.
355
+ * CLI flags take precedence over this value when both are set.
356
+ * Only supported in the root configuration file.
357
+ */
358
+ reportUnusedDisableDirectives?: AllowWarnDeny;
359
+ /**
360
+ * Enable rules that require type information.
361
+ *
362
+ * Equivalent to passing `--type-aware` on the CLI.
363
+ *
364
+ * Note that this requires the `oxlint-tsgolint` package to be installed.
365
+ */
366
+ typeAware?: boolean;
367
+ /**
368
+ * Enable experimental type checking (includes TypeScript compiler diagnostics).
369
+ *
370
+ * Equivalent to passing `--type-check` on the CLI.
371
+ *
372
+ * Note that this requires the `oxlint-tsgolint` package to be installed.
373
+ */
374
+ typeCheck?: boolean;
375
+ }
376
+ interface OxlintOverride {
377
+ /**
378
+ * Environments enable and disable collections of global variables.
379
+ */
380
+ env?: OxlintEnv;
381
+ /**
382
+ * A list of glob patterns to override.
383
+ *
384
+ * ## Example
385
+ * `[ "*.test.ts", "*.spec.ts" ]`
386
+ */
387
+ files: GlobSet;
388
+ /**
389
+ * Enabled or disabled specific global variables.
390
+ */
391
+ globals?: OxlintGlobals;
392
+ /**
393
+ * JS plugins for this override, allows usage of ESLint plugins with Oxlint.
394
+ *
395
+ * Read more about JS plugins in
396
+ * [the docs](https://oxc.rs/docs/guide/usage/linter/js-plugins.html).
397
+ *
398
+ * Note: JS plugins are in alpha and not subject to semver.
399
+ */
400
+ jsPlugins?: null | ExternalPluginEntry[];
401
+ /**
402
+ * Optionally change what plugins are enabled for this override. When
403
+ * omitted, the base config's plugins are used.
404
+ */
405
+ plugins?: LintPlugins;
406
+ rules?: DummyRuleMap;
407
+ }
408
+ /**
409
+ * See [Oxlint Rules](https://oxc.rs/docs/guide/usage/linter/rules.html)
410
+ */
411
+ interface DummyRuleMap {
412
+ [k: string]: DummyRule;
413
+ }
414
+ /**
415
+ * Configure the behavior of linter plugins.
416
+ *
417
+ * Here's an example if you're using Next.js in a monorepo:
418
+ *
419
+ * ```json
420
+ * {
421
+ * "settings": {
422
+ * "next": {
423
+ * "rootDir": "apps/dashboard/"
424
+ * },
425
+ * "react": {
426
+ * "linkComponents": [
427
+ * {
428
+ * "name": "Link",
429
+ * "linkAttribute": "to"
430
+ * }
431
+ * ]
432
+ * },
433
+ * "jsx-a11y": {
434
+ * "components": {
435
+ * "Link": "a",
436
+ * "Button": "button"
437
+ * }
438
+ * }
439
+ * }
440
+ * }
441
+ * ```
442
+ */
443
+ interface OxlintPluginSettings {
444
+ jsdoc?: JSDocPluginSettings;
445
+ "jsx-a11y"?: JSXA11YPluginSettings;
446
+ next?: NextPluginSettings;
447
+ react?: ReactPluginSettings;
448
+ vitest?: VitestPluginSettings;
449
+ [k: string]: unknown;
450
+ }
451
+ interface JSDocPluginSettings {
452
+ /**
453
+ * Only for `require-(yields|returns|description|example|param|throws)` rule
454
+ */
455
+ augmentsExtendsReplacesDocs?: boolean;
456
+ /**
457
+ * Only for `require-param-type` and `require-param-description` rule
458
+ */
459
+ exemptDestructuredRootsFromChecks?: boolean;
460
+ /**
461
+ * For all rules but NOT apply to `empty-tags` rule
462
+ */
463
+ ignoreInternal?: boolean;
464
+ /**
465
+ * For all rules but NOT apply to `check-access` and `empty-tags` rule
466
+ */
467
+ ignorePrivate?: boolean;
468
+ /**
469
+ * Only for `require-(yields|returns|description|example|param|throws)` rule
470
+ */
471
+ ignoreReplacesDocs?: boolean;
472
+ /**
473
+ * Only for `require-(yields|returns|description|example|param|throws)` rule
474
+ */
475
+ implementsReplacesDocs?: boolean;
476
+ /**
477
+ * Only for `require-(yields|returns|description|example|param|throws)` rule
478
+ */
479
+ overrideReplacesDocs?: boolean;
480
+ tagNamePreference?: {
481
+ [k: string]: TagNamePreference;
482
+ };
483
+ [k: string]: unknown;
484
+ }
485
+ /**
486
+ * Configure JSX A11y plugin rules.
487
+ *
488
+ * See
489
+ * [eslint-plugin-jsx-a11y](https://github.com/jsx-eslint/eslint-plugin-jsx-a11y#configurations)'s
490
+ * configuration for a full reference.
491
+ */
492
+ interface JSXA11YPluginSettings {
493
+ /**
494
+ * Map of attribute names to their DOM equivalents.
495
+ * This is useful for non-React frameworks that use different attribute names.
496
+ *
497
+ * Example:
498
+ *
499
+ * ```json
500
+ * {
501
+ * "settings": {
502
+ * "jsx-a11y": {
503
+ * "attributes": {
504
+ * "for": [
505
+ * "htmlFor",
506
+ * "for"
507
+ * ]
508
+ * }
509
+ * }
510
+ * }
511
+ * }
512
+ * ```
513
+ */
514
+ attributes?: {
515
+ [k: string]: string[];
516
+ };
517
+ /**
518
+ * To have your custom components be checked as DOM elements, you can
519
+ * provide a mapping of your component names to the DOM element name.
520
+ *
521
+ * Example:
522
+ *
523
+ * ```json
524
+ * {
525
+ * "settings": {
526
+ * "jsx-a11y": {
527
+ * "components": {
528
+ * "Link": "a",
529
+ * "IconButton": "button"
530
+ * }
531
+ * }
532
+ * }
533
+ * }
534
+ * ```
535
+ */
536
+ components?: {
537
+ [k: string]: string;
538
+ };
539
+ /**
540
+ * An optional setting that define the prop your code uses to create polymorphic components.
541
+ * This setting will be used to determine the element type in rules that
542
+ * require semantic context.
543
+ *
544
+ * For example, if you set the `polymorphicPropName` to `as`, then this element:
545
+ *
546
+ * ```jsx
547
+ * <Box as="h3">Hello</Box>
548
+ * ```
549
+ *
550
+ * Will be treated as an `h3`. If not set, this component will be treated
551
+ * as a `Box`.
552
+ */
553
+ polymorphicPropName?: string;
554
+ [k: string]: unknown;
555
+ }
556
+ /**
557
+ * Configure Next.js plugin rules.
558
+ */
559
+ interface NextPluginSettings {
560
+ /**
561
+ * The root directory of the Next.js project.
562
+ *
563
+ * This is particularly useful when you have a monorepo and your Next.js
564
+ * project is in a subfolder.
565
+ *
566
+ * Example:
567
+ *
568
+ * ```json
569
+ * {
570
+ * "settings": {
571
+ * "next": {
572
+ * "rootDir": "apps/dashboard/"
573
+ * }
574
+ * }
575
+ * }
576
+ * ```
577
+ */
578
+ rootDir?: OneOrManyFor_String;
579
+ [k: string]: unknown;
580
+ }
581
+ /**
582
+ * Configure React plugin rules.
583
+ *
584
+ * Derived from [eslint-plugin-react](https://github.com/jsx-eslint/eslint-plugin-react#configuration-legacy-eslintrc-)
585
+ */
586
+ interface ReactPluginSettings {
587
+ /**
588
+ * Functions that wrap React components and should be treated as HOCs.
589
+ *
590
+ * Example:
591
+ *
592
+ * ```jsonc
593
+ * {
594
+ * "settings": {
595
+ * "react": {
596
+ * "componentWrapperFunctions": ["observer", "withRouter"]
597
+ * }
598
+ * }
599
+ * }
600
+ * ```
601
+ */
602
+ componentWrapperFunctions?: string[];
603
+ /**
604
+ * Components used as alternatives to `<form>` for forms, such as `<Formik>`.
605
+ *
606
+ * Example:
607
+ *
608
+ * ```jsonc
609
+ * {
610
+ * "settings": {
611
+ * "react": {
612
+ * "formComponents": [
613
+ * "CustomForm",
614
+ * // OtherForm is considered a form component and has an endpoint attribute
615
+ * { "name": "OtherForm", "formAttribute": "endpoint" },
616
+ * // allows specifying multiple properties if necessary
617
+ * { "name": "Form", "formAttribute": ["registerEndpoint", "loginEndpoint"] }
618
+ * ]
619
+ * }
620
+ * }
621
+ * }
622
+ * ```
623
+ */
624
+ formComponents?: CustomComponent[];
625
+ /**
626
+ * Components used as alternatives to `<a>` for linking, such as `<Link>`.
627
+ *
628
+ * Example:
629
+ *
630
+ * ```jsonc
631
+ * {
632
+ * "settings": {
633
+ * "react": {
634
+ * "linkComponents": [
635
+ * "HyperLink",
636
+ * // Use `linkAttribute` for components that use a different prop name
637
+ * // than `href`.
638
+ * { "name": "MyLink", "linkAttribute": "to" },
639
+ * // allows specifying multiple properties if necessary
640
+ * { "name": "Link", "linkAttribute": ["to", "href"] }
641
+ * ]
642
+ * }
643
+ * }
644
+ * }
645
+ * ```
646
+ */
647
+ linkComponents?: CustomComponent[];
648
+ /**
649
+ * React version to use for version-specific rules.
650
+ *
651
+ * Accepts semver versions (e.g., "18.2.0", "17.0").
652
+ *
653
+ * Example:
654
+ *
655
+ * ```jsonc
656
+ * {
657
+ * "settings": {
658
+ * "react": {
659
+ * "version": "18.2.0"
660
+ * }
661
+ * }
662
+ * }
663
+ * ```
664
+ */
665
+ version?: string;
666
+ [k: string]: unknown;
667
+ }
668
+ /**
669
+ * Configure Vitest plugin rules.
670
+ *
671
+ * See [eslint-plugin-vitest](https://github.com/vitest-dev/eslint-plugin-vitest)'s
672
+ * configuration for a full reference.
673
+ */
674
+ interface VitestPluginSettings {
675
+ /**
676
+ * Whether to enable typecheck mode for Vitest rules.
677
+ * When enabled, some rules will skip certain checks for describe blocks
678
+ * to accommodate TypeScript type checking scenarios.
679
+ */
680
+ typecheck?: boolean;
681
+ [k: string]: unknown;
682
+ }
683
+ //#endregion
684
+ //#region src-js/package/config.d.ts
685
+ type Oxlintrc = Omit<Oxlintrc$1, "$schema" | "extends">;
686
+ type ExternalPluginsConfig = Exclude<Oxlintrc["jsPlugins"], undefined | null>;
687
+ interface OxlintConfig extends Oxlintrc {
688
+ extends?: OxlintConfig[];
689
+ }
690
+ /**
691
+ * Define an Oxlint configuration with type inference.
692
+ *
693
+ * @param config - Oxlint configuration
694
+ * @returns Config unchanged
695
+ */
696
+ declare function defineConfig<T extends OxlintConfig>(config: T): T;
697
+ //#endregion
698
+ export { type AllowWarnDeny, type DummyRule, type DummyRuleMap, type ExternalPluginEntry, type ExternalPluginsConfig, type OxlintConfig, type OxlintEnv, type OxlintGlobals, type OxlintOverride, type RuleCategories, defineConfig };
package/dist/index.js ADDED
@@ -0,0 +1,12 @@
1
+ //#region src-js/package/config.ts
2
+ /**
3
+ * Define an Oxlint configuration with type inference.
4
+ *
5
+ * @param config - Oxlint configuration
6
+ * @returns Config unchanged
7
+ */
8
+ function defineConfig(config) {
9
+ return config;
10
+ }
11
+ //#endregion
12
+ export { defineConfig };