oxlint-react-compiler-experimental 0.0.4 → 0.0.6

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