@nekoyasuii/config 0.1.2 → 0.1.4

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,3 +1,42 @@
1
+ /**
2
+ * eslint-plugin-github, eslint-plugin-sonarjs, and
3
+ * oxlint-plugin-react-doctor run through oxlint's JS plugin support to close
4
+ * the gap with the ESLint preset and to add React Doctor's extra checks
5
+ *
6
+ * This preset is opt-in: extend it alongside core (and any framework preset)
7
+ * only when you want those rules and accept the extra dependencies plus the
8
+ * slower JS-plugin lint pass. Rules that require type information are not
9
+ * supported by the JS plugin bridge and are excluded
10
+ *
11
+ * The react-doctor rules were previously bundled into the react/next/
12
+ * tanstack presets; they live here now so those framework presets run
13
+ * entirely on oxlint's native Rust rules. Framework-specific react-doctor
14
+ * rules (Next.js, TanStack) are NOT included here, since they fire on generic
15
+ * JSX and would false-positive in other frameworks
16
+ *
17
+ * For Next.js or TanStack, extend ultracite/oxlint/next/js-plugins or
18
+ * ultracite/oxlint/tanstack/js-plugins alongside this preset
19
+ *
20
+ * @example
21
+ * npm install -D eslint-plugin-github eslint-plugin-sonarjs oxlint-plugin-react-doctor
22
+ * import { defineConfig } from "oxlint";
23
+ * import core from "ultracite/oxlint/core";
24
+ * import jsPlugins, { jsPluginSettings } from "ultracite/oxlint/js-plugins";
25
+ * export default defineConfig({
26
+ * extends: [core, jsPlugins],
27
+ * ignorePatterns: core.ignorePatterns,
28
+ * jsPlugins: jsPlugins.jsPlugins,
29
+ * settings: jsPluginSettings,
30
+ * });
31
+ *
32
+ * `jsPlugins: jsPlugins.jsPlugins` re-declares the plugin packages on the
33
+ * root config: oxlint loads them from the extended preset either way, but
34
+ * dependency analyzers such as Knip only read `jsPlugins` off the root and
35
+ * would otherwise flag the packages as unused (#784)
36
+ *
37
+ * To enable only some of the plugins, extend selectJsPlugins(...) instead of
38
+ * the full preset, and see its doc comment below
39
+ */
1
40
  declare const jsPluginEntries: readonly [{
2
41
  readonly name: "github";
3
42
  readonly specifier: "eslint-plugin-github";
@@ -15,6 +54,25 @@ declare const jsPluginEntries: readonly [{
15
54
  readonly specifier: string;
16
55
  }];
17
56
  type JSPluginName = (typeof jsPluginEntries)[number]["name"];
57
+ /**
58
+ * react-doctor 0.9.x rewrote its ported oxc/react-refresh rules (notably
59
+ * only-export-components) with a stripped-down default mode: no framework
60
+ * detection, no route-file skipping, and allowConstantExport off, so Next.js
61
+ * route-segment exports (`export const dynamic = ...`, metadata, etc.)
62
+ * false-positive in every route file (#771). "curated" restores the
63
+ * framework-aware behavior these rule selections were curated against.
64
+ *
65
+ * oxlint does not merge `settings` from extended configs, so this preset
66
+ * carrying the settings is not enough, so they must land on the root config:
67
+ *
68
+ * export default defineConfig({
69
+ * extends: [core, jsPlugins],
70
+ * ignorePatterns: core.ignorePatterns,
71
+ * settings: jsPluginSettings,
72
+ * });
73
+ *
74
+ * `ultracite init` wires this into generated configs automatically.
75
+ */
18
76
  export declare const jsPluginSettings: {
19
77
  "react-doctor": {
20
78
  portedRuleMode: string;
@@ -25,18 +83,54 @@ declare const config: {
25
83
  name: string;
26
84
  specifier: string;
27
85
  }[];
86
+ /**
87
+ * Inert until oxlint merges settings from extends; the root config applies
88
+ * jsPluginSettings itself (see above)
89
+ */
28
90
  settings: {
29
91
  "react-doctor": {
30
92
  portedRuleMode: string;
31
93
  };
32
94
  };
33
- overrides: {
95
+ overrides: ({
34
96
  files: string[];
35
97
  rules: {
98
+ /**
99
+ * Repeated string literals (test titles, expected values) are normal
100
+ * and idiomatic in test files
101
+ */
36
102
  "sonarjs/no-duplicate-string": "off";
103
+ "lazuee/no-ts-accessibility"?: undefined;
104
+ "lazuee/interface-pascal-case"?: undefined;
105
+ "lazuee/canonical-header-names"?: undefined;
37
106
  };
38
- }[];
107
+ } | {
108
+ files: string[];
109
+ rules: {
110
+ /**
111
+ * Repeated string literals (test titles, expected values) are normal
112
+ * and idiomatic in test files
113
+ */
114
+ "sonarjs/no-duplicate-string"?: undefined;
115
+ "lazuee/no-ts-accessibility": "error";
116
+ "lazuee/interface-pascal-case": "error";
117
+ "lazuee/canonical-header-names"?: undefined;
118
+ };
119
+ } | {
120
+ files: string[];
121
+ rules: {
122
+ /**
123
+ * Repeated string literals (test titles, expected values) are normal
124
+ * and idiomatic in test files
125
+ */
126
+ "sonarjs/no-duplicate-string"?: undefined;
127
+ "lazuee/no-ts-accessibility"?: undefined;
128
+ "lazuee/interface-pascal-case"?: undefined;
129
+ "lazuee/canonical-header-names": "off";
130
+ };
131
+ })[];
39
132
  rules: {
133
+ /** ── github ───────────────────────────────────────────────────────── */
40
134
  "github/a11y-aria-label-is-well-formatted": "error";
41
135
  "github/a11y-no-title-attribute": "error";
42
136
  "github/a11y-no-visually-hidden-interactive-element": "error";
@@ -51,8 +145,13 @@ declare const config: {
51
145
  "github/js-class-name": "error";
52
146
  "github/no-blur": "error";
53
147
  "github/no-d-none": "error";
148
+ /** Conflicts with unicorn/prefer-dom-node-dataset, which is the benchmark */
54
149
  "github/no-dataset": "off";
55
150
  "github/no-dynamic-script-tag": "error";
151
+ /**
152
+ * The JS plugin bridge misreads module-scoped declarations (e.g. Astro
153
+ * frontmatter) as implicit globals, producing false positives.
154
+ */
56
155
  "github/no-implicit-buggy-globals": "off";
57
156
  "github/no-inner-html": "error";
58
157
  "github/no-innerText": "error";
@@ -60,9 +159,11 @@ declare const config: {
60
159
  "github/no-useless-passive": "error";
61
160
  "github/prefer-observers": "error";
62
161
  "github/require-passive-events": "error";
162
+ /** Mirrors the ESLint preset */
63
163
  "github/unescaped-html-literal": "off";
64
164
  "sonarjs/arguments-usage": "error";
65
165
  "sonarjs/array-constructor": "error";
166
+ /** Fights the formatter (arrowParentheses: always) */
66
167
  "sonarjs/arrow-function-convention": "off";
67
168
  "sonarjs/aws-apigateway-public-api": "error";
68
169
  "sonarjs/aws-ec2-rds-dms-public": "error";
@@ -88,6 +189,7 @@ declare const config: {
88
189
  "sonarjs/chai-determinate-assertion": "error";
89
190
  "sonarjs/class-name": "error";
90
191
  "sonarjs/code-eval": "error";
192
+ /** Matches Biome's noExcessiveCognitiveComplexity limit */
91
193
  "sonarjs/cognitive-complexity": ["error", number];
92
194
  "sonarjs/comma-or-logical-or-case": "error";
93
195
  "sonarjs/comment-regex": "error";
@@ -97,15 +199,22 @@ declare const config: {
97
199
  "sonarjs/cookie-no-httponly": "error";
98
200
  "sonarjs/cors": "error";
99
201
  "sonarjs/csrf": "error";
202
+ /** Duplicate of the core complexity rule */
100
203
  "sonarjs/cyclomatic-complexity": "off";
101
204
  "sonarjs/declarations-in-global-scope": "error";
102
205
  "sonarjs/destructuring-assignment-syntax": "error";
103
206
  "sonarjs/disabled-timeout": "error";
104
207
  "sonarjs/dynamically-constructed-templates": "error";
208
+ /** Mirrors the ESLint preset */
105
209
  "sonarjs/elseif-without-else": "off";
106
210
  "sonarjs/encryption-secure-mode": "error";
107
211
  "sonarjs/expression-complexity": "error";
212
+ /** Requires a headerFormat option; errors on every file without one */
108
213
  "sonarjs/file-header": "off";
214
+ /**
215
+ * Fires on any file whose name differs from an exported class, which is
216
+ * noise for config and module files that export objects, not classes
217
+ */
109
218
  "sonarjs/file-name-differ-from-class": "off";
110
219
  "sonarjs/file-permissions": "error";
111
220
  "sonarjs/file-uploads": "error";
@@ -124,11 +233,14 @@ declare const config: {
124
233
  "sonarjs/inverted-assertion-arguments": "error";
125
234
  "sonarjs/label-position": "error";
126
235
  "sonarjs/link-with-target-blank": "error";
236
+ /** The preset disables max-lines everywhere */
127
237
  "sonarjs/max-lines": "off";
238
+ /** The preset disables max-lines-per-function everywhere */
128
239
  "sonarjs/max-lines-per-function": "off";
129
240
  "sonarjs/max-switch-cases": "error";
130
241
  "sonarjs/max-union-size": "error";
131
242
  "sonarjs/misplaced-loop-counter": "error";
243
+ /** Duplicate of max-depth, which is off */
132
244
  "sonarjs/nested-control-flow": "off";
133
245
  "sonarjs/no-all-duplicated-branches": "error";
134
246
  "sonarjs/no-angular-bypass-sanitization": "error";
@@ -162,6 +274,10 @@ declare const config: {
162
274
  "sonarjs/no-identical-expressions": "error";
163
275
  "sonarjs/no-identical-functions": "error";
164
276
  "sonarjs/no-ignored-exceptions": "error";
277
+ /**
278
+ * The JS plugin bridge has no dependency-manifest resolution, so this
279
+ * flags builtin (bun:test) and workspace imports as missing dependencies
280
+ */
165
281
  "sonarjs/no-implicit-dependencies": "off";
166
282
  "sonarjs/no-implicit-global": "error";
167
283
  "sonarjs/no-incomplete-assertions": "error";
@@ -183,6 +299,7 @@ declare const config: {
183
299
  "sonarjs/no-redundant-assignments": "error";
184
300
  "sonarjs/no-redundant-boolean": "error";
185
301
  "sonarjs/no-redundant-jump": "error";
302
+ /** The jsPlugins bridge provides no globals, so every identifier is flagged */
186
303
  "sonarjs/no-reference-error": "off";
187
304
  "sonarjs/no-referrer-policy": "error";
188
305
  "sonarjs/no-same-argument-assert": "error";
@@ -221,6 +338,7 @@ declare const config: {
221
338
  "sonarjs/redundant-type-aliases": "error";
222
339
  "sonarjs/review-blockchain-mnemonic": "error";
223
340
  "sonarjs/session-regeneration": "error";
341
+ /** Conflicts with sort-keys */
224
342
  "sonarjs/shorthand-property-grouping": "off";
225
343
  "sonarjs/stable-tests": "error";
226
344
  "sonarjs/stateful-regex": "error";
@@ -239,6 +357,7 @@ declare const config: {
239
357
  "sonarjs/weak-ssl": "error";
240
358
  "sonarjs/x-powered-by": "error";
241
359
  "sonarjs/xml-parser-xxe": "error";
360
+ /** Generic React rules */
242
361
  "react-doctor/activity-wraps-effect-heavy-subtree": "error";
243
362
  "react-doctor/advanced-event-handler-refs": "error";
244
363
  "react-doctor/async-await-in-loop": "error";
@@ -344,6 +463,7 @@ declare const config: {
344
463
  "react-doctor/no-uncontrolled-input": "error";
345
464
  "react-doctor/no-undeferred-third-party": "error";
346
465
  "react-doctor/no-usememo-simple-expression": "error";
466
+ /** "react-doctor/only-export-components": "error", */
347
467
  "react-doctor/prefer-dynamic-import": "error";
348
468
  "react-doctor/prefer-explicit-variants": "error";
349
469
  "react-doctor/prefer-html-dialog": "error";
@@ -387,6 +507,13 @@ declare const config: {
387
507
  "react-doctor/zod-v4-no-deprecated-error-customization": "error";
388
508
  "react-doctor/zod-v4-no-deprecated-schema-apis": "error";
389
509
  "react-doctor/zod-v4-prefer-top-level-string-formats": "error";
510
+ /**
511
+ * Full-ruleset parity adjustments: rules the react-doctor CLI ships
512
+ * disabled by default (defaultEnabled: false) that only produce noise
513
+ * when oxlint force-enables every listed rule, and rules the CLI gates
514
+ * behind framework detection (`nextjs`, `pure-preact`) that this
515
+ * Bun + Hono + react-router app never satisfies
516
+ */
390
517
  "react-doctor/react-in-jsx-scope": "off";
391
518
  "react-doctor/jsx-boolean-value": "off";
392
519
  "react-doctor/jsx-handler-names": "off";
@@ -395,24 +522,62 @@ declare const config: {
395
522
  "react-doctor/nextjs-no-a-element": "off";
396
523
  "react-doctor/nextjs-no-img-element": "off";
397
524
  "react-doctor/preact-no-react-hooks-import": "off";
525
+ /**
526
+ * Small presentational helpers stay colocated in one file (see
527
+ * src/components/api-tester.tsx); mirrors `react/no-multi-comp` being off
528
+ * in the presets
529
+ */
398
530
  "react-doctor/no-multi-comp": "off";
399
531
  "react-doctor/no-multi-component-file": "off";
532
+ /** src/router.tsx exports the router object rather than a component */
400
533
  "react-doctor/only-export-components": "off";
534
+ /**
535
+ * ── tailwindcss ────────────────────────────────────────────────────
536
+ * Correctness: catch real bugs
537
+ */
401
538
  "tailwindcss/no-conflicting-classes": "error";
402
539
  "tailwindcss/no-deprecated-classes": "error";
403
540
  "tailwindcss/no-duplicate-classes": "warn";
404
541
  "tailwindcss/no-unknown-classes": "error";
542
+ /** Modernization: keep classes in current canonical form */
405
543
  "tailwindcss/enforce-canonical": "warn";
406
544
  "tailwindcss/no-unnecessary-arbitrary-value": "warn";
545
+ /** Style and consistency */
407
546
  "tailwindcss/enforce-sort-order": "warn";
408
547
  "tailwindcss/consistent-variant-order": "warn";
409
548
  "tailwindcss/enforce-consistent-important-position": "warn";
410
549
  "tailwindcss/no-unnecessary-whitespace": "warn";
550
+ /** ── lazuee ──────────────────────────────────────────────────── */
411
551
  "lazuee/prefer-alias": "error";
552
+ "lazuee/no-ts-accessibility": "off";
553
+ "lazuee/interface-pascal-case": "off";
554
+ "lazuee/canonical-header-names": "off";
412
555
  };
413
556
  };
414
557
  export default config;
558
+ /**
559
+ * Returns a copy of this preset narrowed to the given plugin names ("github",
560
+ * "sonarjs", "react-doctor"): only the selected jsPlugins entries are loaded
561
+ * and only their rules (top-level and per-override) are kept. `ultracite init`
562
+ * wires this into generated configs when a subset of the plugins is chosen,
563
+ * so the generated file stays a one-line extend instead of inlining the
564
+ * filtering logic:
565
+ *
566
+ * import { selectJsPlugins } from "ultracite/oxlint/js-plugins";
567
+ *
568
+ * const jsPlugins = selectJsPlugins(["github", "sonarjs"]);
569
+ *
570
+ * export default defineConfig({
571
+ * extends: [core, jsPlugins],
572
+ * ignorePatterns: core.ignorePatterns,
573
+ * jsPlugins: jsPlugins.jsPlugins,
574
+ * });
575
+ */
415
576
  export declare const selectJsPlugins: (pluginNames: JSPluginName[]) => {
577
+ /**
578
+ * Inert until oxlint merges settings from extends; the root config applies
579
+ * jsPluginSettings itself (see above)
580
+ */
416
581
  settings: {
417
582
  "react-doctor": {
418
583
  portedRuleMode: string;
@@ -434,12 +599,22 @@ export declare const selectJsPlugins: (pluginNames: JSPluginName[]) => {
434
599
  readonly name: "lazuee";
435
600
  readonly specifier: string;
436
601
  })[];
437
- overrides: {
602
+ overrides: ({
438
603
  files: string[];
439
604
  rules: {
440
- [k: string]: "off";
605
+ [k: string]: any;
441
606
  };
442
- }[];
607
+ } | {
608
+ files: string[];
609
+ rules: {
610
+ [k: string]: any;
611
+ };
612
+ } | {
613
+ files: string[];
614
+ rules: {
615
+ [k: string]: any;
616
+ };
617
+ })[];
443
618
  rules: {
444
619
  [k: string]: "error" | "off" | "warn" | ["error", number];
445
620
  };
@@ -2,7 +2,7 @@ import {
2
2
  jsPluginSettings,
3
3
  js_plugins_default,
4
4
  selectJsPlugins
5
- } from "../../../../chunk-1chg07xf.js";
5
+ } from "../../../../chunk-fqcw0kzp.js";
6
6
  import"../../../../chunk-5wgwscd0.js";
7
7
  export {
8
8
  js_plugins_default as default,
@@ -0,0 +1,19 @@
1
+ export declare const noCommentSlopConfig: {
2
+ jsPlugins: {
3
+ name: string;
4
+ specifier: string;
5
+ }[];
6
+ rules: {
7
+ "no-comment-slop/max-comment-lines": "error";
8
+ "no-comment-slop/no-banner-comment": "error";
9
+ "no-comment-slop/no-trailing-comment": "error";
10
+ "no-comment-slop/prefer-jsdoc-for-exports": "error";
11
+ "no-comment-slop/prefer-jsdoc-for-members": "error";
12
+ "no-comment-slop/require-member-docs": "error";
13
+ "no-comment-slop/multiline-jsdoc-format": "error";
14
+ "no-comment-slop/no-trailing-period": "error";
15
+ "no-comment-slop/no-em-dash": "error";
16
+ "no-comment-slop/no-jargon": "error";
17
+ "no-comment-slop/no-foreign-syntax": "error";
18
+ };
19
+ };
@@ -0,0 +1,7 @@
1
+ import {
2
+ noCommentSlopConfig
3
+ } from "../../../../chunk-97s6xvc6.js";
4
+ import"../../../../chunk-5wgwscd0.js";
5
+ export {
6
+ noCommentSlopConfig
7
+ };