@zukhruf/eslint 0.6.7 → 0.6.9

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.
package/README.md CHANGED
@@ -36,7 +36,7 @@ export default defineConfig({
36
36
  });
37
37
  ```
38
38
 
39
- Put framework presets (for example [`@zukhruf/eslint/react`](#react), which is Nx's `flat/react`) **before** the zukhruf configs. The package's own checks survive any order. But `base` also changes some third-party rules, for example it turns `@typescript-eslint/no-unused-vars` off, and a preset that comes later sets them again.
39
+ Put framework configs (for example [`@zukhruf/eslint/react`](#react)) **before** the zukhruf configs. The package's own checks survive any order. But `base` also changes some third-party rules, for example it turns `@typescript-eslint/no-unused-vars` off, and a preset that comes later sets them again.
40
40
 
41
41
  ## Configs
42
42
 
@@ -203,7 +203,7 @@ The rule decides each manifest's options itself, so your options add to the shar
203
203
 
204
204
  ## React
205
205
 
206
- `@zukhruf/eslint/react` is Nx's `flat/react` config from `@nx/eslint-plugin`, with one change: it sets `settings.react.version`. Use it in place of `nx.configs['flat/react']` in the `eslint.config.mjs` of a React project. Put it first, and then the root config, as before:
206
+ `@zukhruf/eslint/react` gives the configs that the React community maintains. The package adds no rule of its own to them and changes no severity. Use it in the `eslint.config.mjs` of a React project. Put it first, and then the root config, as before:
207
207
 
208
208
  ```js
209
209
  import react from '@zukhruf/eslint/react';
@@ -213,20 +213,29 @@ import baseConfig from '../../eslint.config.mjs';
213
213
  export default [...react, ...baseConfig];
214
214
  ```
215
215
 
216
- `flat/react` sets the React version to `'detect'`. On ESLint 10, `'detect'` stops every rule of `eslint-plugin-react` 7.37.5 at load, because the plugin calls `context.getFilename()`, which ESLint 10 removed. So the preset sets the version of the `react` package that resolves from the folder where ESLint runs. `nx lint` runs ESLint in the project folder, and a hoisted `react` resolves from there. Do not set `settings.react.version` in your config. If `react` does not resolve, the preset throws an error when it loads. Install `react` in the workspace. `react` is an optional peer of this package, so a lint input on `@zukhruf/eslint` also hashes the React version.
216
+ The configs apply only to TypeScript files, the files to which `zukhruf/base` gives type information. Thus they do not lint the `package.json` or the other files of a project.
217
217
 
218
- `flat/react` loads `eslint-plugin-import`, `eslint-plugin-jsx-a11y`, `eslint-plugin-react` and `eslint-plugin-react-hooks`. Install these 4 plugins in the React workspace. They are optional peers of this package, because `@nx/eslint-plugin` (checked at 24.0.2) does not declare them. With the peers, npm writes the lockfile edges from `@zukhruf/eslint` to the 4 plugins, so a lint input on `@zukhruf/eslint` also hashes the plugins.
218
+ It gives these configs, in this order:
219
219
 
220
- The peer ranges of `eslint-plugin-import`, `eslint-plugin-jsx-a11y` and `eslint-plugin-react` stop at ESLint 9. On ESLint 10, add an `overrides` entry for each of the 3 to `package.json`, as factory and whatisgoingon do:
220
+ 1. `recommended` of `eslint-plugin-jsx-a11y-x`: the accessibility rules. This plugin is the maintained fork of `eslint-plugin-jsx-a11y`, and its peer range includes ESLint 10.
221
+ 2. `flat.recommended` of `eslint-plugin-react-hooks`: the rules of the React team.
222
+ 3. `recommended-type-checked` of `@eslint-react/eslint-plugin`: the React rules, for example `@eslint-react/no-missing-key`. The rules use type information. `zukhruf/base` gives it, because it sets `projectService`.
223
+ 4. `disable-conflict-eslint-plugin-react-hooks` of `@eslint-react/eslint-plugin`: it turns off the 12 rules of `eslint-plugin-react-hooks` that `@eslint-react/eslint-plugin` also has.
221
224
 
222
- ```json
223
- "overrides": {
224
- "eslint-plugin-import": { "eslint": "$eslint" },
225
- "eslint-plugin-jsx-a11y": { "eslint": "$eslint" },
226
- "eslint-plugin-react": { "eslint": "$eslint" }
227
- }
225
+ Thus `@eslint-react/eslint-plugin` owns the hook rules, for example `@eslint-react/rules-of-hooks` and `@eslint-react/exhaustive-deps`, and ESLint reports each problem one time. This is the path of the eslint-react guide "Migrating from eslint-plugin-react-hooks". `eslint-plugin-react-hooks` adds only its 4 React Compiler rules: `preserve-manual-memoization`, `incompatible-library`, `config` and `gating`. Each rule has the severity that its plugin ships.
226
+
227
+ The style rules of zukhruf for React are not in this export. They are in the config `zukhruf/react`.
228
+
229
+ Install the 3 plugins in the React workspace:
230
+
231
+ ```sh
232
+ npm install --save-dev @eslint-react/eslint-plugin eslint-plugin-jsx-a11y-x eslint-plugin-react-hooks
228
233
  ```
229
234
 
235
+ They are optional peers of this package. With the peers, npm writes the lockfile edges from `@zukhruf/eslint` to the 3 plugins, so a lint input on `@zukhruf/eslint` also hashes the plugins.
236
+
237
+ `react` is also an optional peer, because the React version changes the lint result. `@eslint-react/eslint-plugin` reads the version of the `react` package that resolves from the folder where ESLint runs. `nx lint` runs ESLint in the project folder, and a hoisted `react` resolves from there. With the peer, a lint input on `@zukhruf/eslint` also hashes the React version.
238
+
230
239
  ## React Native: Hermes
231
240
 
232
241
  `@zukhruf/eslint/react-native` needs `eslint-plugin-es-x`. es-x 10 needs ESLint 10.6 or later; on ESLint 9, install `eslint-plugin-es-x@9`. `hermes/recommended` checks the code that ships in the app, and leaves tests, config files and scripts alone, because those run in Node:
package/dist/react.d.ts CHANGED
@@ -1,3 +1,654 @@
1
- declare const _default: import("typescript-eslint").FlatConfig.Config[];
1
+ declare const _default: ({
2
+ files: string[];
3
+ name?: string;
4
+ basePath?: string;
5
+ ignores?: string[];
6
+ language?: string;
7
+ languageOptions?: import("@eslint/core", { with: { "resolution-mode": "require" } }).LanguageOptions;
8
+ linterOptions?: import("@eslint/core", { with: { "resolution-mode": "require" } }).LinterOptionsConfig;
9
+ processor?: string | import("@eslint/core", { with: { "resolution-mode": "require" } }).Processor;
10
+ plugins?: Record<string, import("@eslint/core", { with: { "resolution-mode": "require" } }).Plugin>;
11
+ rules?: Partial<import("@eslint/core", { with: { "resolution-mode": "require" } }).RulesConfig>;
12
+ settings?: import("@eslint/core", { with: { "resolution-mode": "require" } }).SettingsConfig;
13
+ } | {
14
+ files: string[];
15
+ name: string;
16
+ plugins: {
17
+ "jsx-a11y-x": {
18
+ meta: {
19
+ name: string;
20
+ version: string;
21
+ };
22
+ rules: {
23
+ "alt-text": {
24
+ meta: {
25
+ docs: {
26
+ url: string;
27
+ description: string;
28
+ };
29
+ schema: {
30
+ type: string;
31
+ properties: {};
32
+ required: undefined;
33
+ }[];
34
+ defaultOptions: {
35
+ elements: string[];
36
+ }[];
37
+ };
38
+ create: (context: any) => {
39
+ JSXOpeningElement(node: any): void;
40
+ };
41
+ };
42
+ "anchor-ambiguous-text": {
43
+ meta: {
44
+ docs: {
45
+ url: string;
46
+ description: string;
47
+ };
48
+ schema: {
49
+ type: string;
50
+ properties: {};
51
+ required: undefined;
52
+ }[];
53
+ defaultOptions: {
54
+ words: string[];
55
+ }[];
56
+ };
57
+ create: (context: any) => {
58
+ JSXOpeningElement: (node: any) => void;
59
+ };
60
+ };
61
+ "anchor-has-content": {
62
+ meta: {
63
+ docs: {
64
+ url: string;
65
+ description: string;
66
+ };
67
+ schema: {
68
+ type: string;
69
+ properties: {};
70
+ required: undefined;
71
+ }[];
72
+ defaultOptions: {
73
+ components: never[];
74
+ }[];
75
+ };
76
+ create: (context: any) => {
77
+ JSXOpeningElement: (node: any) => void;
78
+ };
79
+ };
80
+ "anchor-is-valid": {
81
+ meta: {
82
+ docs: {
83
+ url: string;
84
+ description: string;
85
+ };
86
+ schema: {
87
+ type: string;
88
+ properties: {};
89
+ required: undefined;
90
+ }[];
91
+ defaultOptions: {
92
+ components: never[];
93
+ specialLink: never[];
94
+ aspects: string[];
95
+ }[];
96
+ };
97
+ create: (context: any) => {
98
+ JSXOpeningElement: (node: any) => void;
99
+ };
100
+ };
101
+ "aria-activedescendant-has-tabindex": {
102
+ meta: {
103
+ docs: {
104
+ url: string;
105
+ description: string;
106
+ };
107
+ schema: never[];
108
+ };
109
+ create: (context: any) => {
110
+ JSXOpeningElement: (node: any) => void;
111
+ };
112
+ };
113
+ "aria-props": {
114
+ meta: {
115
+ docs: {
116
+ url: string;
117
+ description: string;
118
+ };
119
+ schema: never[];
120
+ };
121
+ create: (context: any) => {
122
+ JSXAttribute: (attribute: any) => void;
123
+ };
124
+ };
125
+ "aria-proptypes": {
126
+ validityCheck: (value: any, expectedType: any, permittedValues: any) => any;
127
+ meta: {
128
+ docs: {
129
+ url: string;
130
+ description: string;
131
+ };
132
+ schema: never[];
133
+ };
134
+ create: (context: any) => {
135
+ JSXAttribute: (attribute: any) => void;
136
+ };
137
+ };
138
+ "aria-role": {
139
+ meta: {
140
+ docs: {
141
+ url: string;
142
+ description: string;
143
+ };
144
+ schema: {
145
+ type: string;
146
+ properties: {};
147
+ required: undefined;
148
+ }[];
149
+ defaultOptions: {
150
+ allowedInvalidRoles: never[];
151
+ ignoreNonDOM: boolean;
152
+ }[];
153
+ };
154
+ create: (context: any) => {
155
+ JSXAttribute: (attribute: any) => void;
156
+ };
157
+ };
158
+ "aria-unsupported-elements": {
159
+ meta: {
160
+ docs: {
161
+ url: string;
162
+ description: string;
163
+ };
164
+ schema: never[];
165
+ };
166
+ create: (context: any) => {
167
+ JSXOpeningElement: (node: any) => void;
168
+ };
169
+ };
170
+ "autocomplete-valid": {
171
+ meta: {
172
+ docs: {
173
+ url: string;
174
+ description: string;
175
+ };
176
+ schema: {
177
+ type: string;
178
+ properties: {};
179
+ required: undefined;
180
+ }[];
181
+ defaultOptions: {
182
+ inputComponents: never[];
183
+ }[];
184
+ };
185
+ create: (context: any) => {
186
+ JSXOpeningElement: (node: any) => void;
187
+ };
188
+ };
189
+ "click-events-have-key-events": {
190
+ meta: {
191
+ docs: {
192
+ url: string;
193
+ description: string;
194
+ };
195
+ schema: never[];
196
+ };
197
+ create: (context: any) => {
198
+ JSXOpeningElement: (node: any) => void;
199
+ };
200
+ };
201
+ "control-has-associated-label": {
202
+ meta: {
203
+ docs: {
204
+ description: string;
205
+ url: string;
206
+ };
207
+ schema: {
208
+ type: string;
209
+ properties: {};
210
+ required: undefined;
211
+ }[];
212
+ defaultOptions: {
213
+ labelAttributes: never[];
214
+ controlComponents: never[];
215
+ ignoreElements: never[];
216
+ ignoreRoles: never[];
217
+ }[];
218
+ };
219
+ create: (context: any) => {
220
+ JSXElement: (node: any) => void;
221
+ };
222
+ };
223
+ "heading-has-content": {
224
+ meta: {
225
+ docs: {
226
+ url: string;
227
+ description: string;
228
+ };
229
+ schema: {
230
+ type: string;
231
+ properties: {};
232
+ required: undefined;
233
+ }[];
234
+ defaultOptions: {
235
+ components: never[];
236
+ }[];
237
+ };
238
+ create: (context: any) => {
239
+ JSXOpeningElement: (node: any) => void;
240
+ };
241
+ };
242
+ "html-has-lang": {
243
+ meta: {
244
+ docs: {
245
+ url: string;
246
+ description: string;
247
+ };
248
+ schema: never[];
249
+ };
250
+ create: (context: any) => {
251
+ JSXOpeningElement: (node: any) => void;
252
+ };
253
+ };
254
+ "iframe-has-title": {
255
+ meta: {
256
+ docs: {
257
+ url: string;
258
+ description: string;
259
+ };
260
+ schema: never[];
261
+ };
262
+ create: (context: any) => {
263
+ JSXOpeningElement: (node: any) => void;
264
+ };
265
+ };
266
+ "img-redundant-alt": {
267
+ meta: {
268
+ docs: {
269
+ url: string;
270
+ description: string;
271
+ };
272
+ schema: {
273
+ type: string;
274
+ properties: {};
275
+ required: undefined;
276
+ }[];
277
+ defaultOptions: {
278
+ components: never[];
279
+ words: never[];
280
+ }[];
281
+ };
282
+ create: (context: any) => {
283
+ JSXOpeningElement: (node: any) => void;
284
+ };
285
+ };
286
+ "interactive-supports-focus": {
287
+ meta: {
288
+ docs: {
289
+ url: string;
290
+ description: string;
291
+ };
292
+ hasSuggestions: boolean;
293
+ messages: {
294
+ "tabIndex=0": string;
295
+ "tabIndex=-1": string;
296
+ };
297
+ schema: {
298
+ type: string;
299
+ properties: {};
300
+ required: undefined;
301
+ }[];
302
+ defaultOptions: {
303
+ tabbable: never[];
304
+ }[];
305
+ };
306
+ create: (context: any) => {
307
+ JSXOpeningElement: (node: any) => void;
308
+ };
309
+ };
310
+ "label-has-associated-control": {
311
+ meta: {
312
+ docs: {
313
+ description: string;
314
+ url: string;
315
+ };
316
+ schema: {
317
+ type: string;
318
+ properties: {};
319
+ required: undefined;
320
+ }[];
321
+ defaultOptions: {
322
+ labelComponents: never[];
323
+ labelAttributes: never[];
324
+ controlComponents: never[];
325
+ assert: string;
326
+ depth: number;
327
+ }[];
328
+ };
329
+ create: (context: any) => {
330
+ JSXElement: (node: any) => void;
331
+ };
332
+ };
333
+ lang: {
334
+ meta: {
335
+ docs: {
336
+ url: string;
337
+ description: string;
338
+ };
339
+ schema: never[];
340
+ };
341
+ create: (context: any) => {
342
+ JSXAttribute: (node: any) => void;
343
+ };
344
+ };
345
+ "media-has-caption": {
346
+ meta: {
347
+ docs: {
348
+ url: string;
349
+ description: string;
350
+ };
351
+ schema: {
352
+ type: string;
353
+ properties: {};
354
+ required: undefined;
355
+ }[];
356
+ defaultOptions: {
357
+ audio: never[];
358
+ video: never[];
359
+ track: never[];
360
+ }[];
361
+ };
362
+ create: (context: any) => {
363
+ JSXElement: (node: any) => void;
364
+ };
365
+ };
366
+ "mouse-events-have-key-events": {
367
+ meta: {
368
+ docs: {
369
+ url: string;
370
+ description: string;
371
+ };
372
+ schema: {
373
+ type: string;
374
+ properties: {};
375
+ required: undefined;
376
+ }[];
377
+ defaultOptions: {
378
+ hoverInHandlers: string[];
379
+ hoverOutHandlers: string[];
380
+ }[];
381
+ };
382
+ create: (context: any) => {
383
+ JSXOpeningElement: (node: any) => void;
384
+ };
385
+ };
386
+ "no-access-key": {
387
+ meta: {
388
+ docs: {
389
+ url: string;
390
+ description: string;
391
+ };
392
+ schema: never[];
393
+ };
394
+ create: (context: any) => {
395
+ JSXOpeningElement: (node: any) => void;
396
+ };
397
+ };
398
+ "no-aria-hidden-on-focusable": {
399
+ meta: {
400
+ docs: {
401
+ url: string;
402
+ description: string;
403
+ };
404
+ schema: never[];
405
+ };
406
+ create(context: any): {
407
+ JSXOpeningElement(node: any): void;
408
+ };
409
+ };
410
+ "no-autofocus": {
411
+ meta: {
412
+ docs: {
413
+ url: string;
414
+ description: string;
415
+ };
416
+ schema: {
417
+ type: string;
418
+ properties: {};
419
+ required: undefined;
420
+ }[];
421
+ defaultOptions: {
422
+ ignoreNonDOM: boolean;
423
+ }[];
424
+ };
425
+ create: (context: any) => {
426
+ JSXAttribute: (attribute: any) => void;
427
+ };
428
+ };
429
+ "no-distracting-elements": {
430
+ meta: {
431
+ docs: {
432
+ url: string;
433
+ description: string;
434
+ };
435
+ schema: {
436
+ type: string;
437
+ properties: {};
438
+ required: undefined;
439
+ }[];
440
+ defaultOptions: {
441
+ elements: string[];
442
+ }[];
443
+ };
444
+ create: (context: any) => {
445
+ JSXOpeningElement: (node: any) => void;
446
+ };
447
+ };
448
+ "no-interactive-element-to-noninteractive-role": {
449
+ meta: {
450
+ docs: {
451
+ url: string;
452
+ description: string;
453
+ };
454
+ schema: {
455
+ type: string;
456
+ additionalProperties: {
457
+ type: string;
458
+ items: {
459
+ type: string;
460
+ };
461
+ uniqueItems: boolean;
462
+ };
463
+ description: string;
464
+ }[];
465
+ defaultOptions: {}[];
466
+ };
467
+ create: (context: any) => {
468
+ JSXAttribute: (attribute: any) => void;
469
+ };
470
+ };
471
+ "no-noninteractive-element-interactions": {
472
+ meta: {
473
+ docs: {
474
+ url: string;
475
+ description: string;
476
+ };
477
+ schema: {
478
+ type: string;
479
+ properties: {};
480
+ required: undefined;
481
+ }[];
482
+ defaultOptions: {
483
+ handlers: any[];
484
+ }[];
485
+ };
486
+ create: (context: any) => {
487
+ JSXOpeningElement: (node: any) => void;
488
+ };
489
+ };
490
+ "no-noninteractive-element-to-interactive-role": {
491
+ meta: {
492
+ docs: {
493
+ url: string;
494
+ description: string;
495
+ };
496
+ schema: {
497
+ type: string;
498
+ additionalProperties: {
499
+ type: string;
500
+ items: {
501
+ type: string;
502
+ };
503
+ uniqueItems: boolean;
504
+ };
505
+ description: string;
506
+ }[];
507
+ defaultOptions: {}[];
508
+ };
509
+ create: (context: any) => {
510
+ JSXAttribute: (attribute: any) => void;
511
+ };
512
+ };
513
+ "no-noninteractive-tabindex": {
514
+ meta: {
515
+ docs: {
516
+ url: string;
517
+ description: string;
518
+ };
519
+ schema: {
520
+ type: string;
521
+ properties: {};
522
+ required: undefined;
523
+ }[];
524
+ defaultOptions: {
525
+ roles: never[];
526
+ tags: never[];
527
+ }[];
528
+ };
529
+ create: (context: any) => {
530
+ JSXOpeningElement: (node: any) => void;
531
+ };
532
+ };
533
+ "no-redundant-roles": {
534
+ meta: {
535
+ docs: {
536
+ url: string;
537
+ description: string;
538
+ };
539
+ schema: {
540
+ type: string;
541
+ additionalProperties: {
542
+ type: string;
543
+ items: {
544
+ type: string;
545
+ };
546
+ uniqueItems: boolean;
547
+ };
548
+ description: string;
549
+ }[];
550
+ defaultOptions: {}[];
551
+ };
552
+ create: (context: any) => {
553
+ JSXOpeningElement: (node: any) => void;
554
+ };
555
+ };
556
+ "no-static-element-interactions": {
557
+ meta: {
558
+ docs: {
559
+ url: string;
560
+ description: string;
561
+ };
562
+ schema: {
563
+ type: string;
564
+ properties: {};
565
+ required: undefined;
566
+ }[];
567
+ defaultOptions: {
568
+ handlers: any[];
569
+ }[];
570
+ };
571
+ create: (context: any) => {
572
+ JSXOpeningElement: (node: any) => void;
573
+ };
574
+ };
575
+ "prefer-tag-over-role": {
576
+ meta: {
577
+ docs: {
578
+ description: string;
579
+ url: string;
580
+ };
581
+ schema: never[];
582
+ };
583
+ create: (context: any) => {
584
+ JSXOpeningElement: (node: any) => void;
585
+ };
586
+ };
587
+ "role-has-required-aria-props": {
588
+ meta: {
589
+ docs: {
590
+ url: string;
591
+ description: string;
592
+ };
593
+ schema: never[];
594
+ };
595
+ create: (context: any) => {
596
+ JSXAttribute: (attribute: any) => void;
597
+ };
598
+ };
599
+ "role-supports-aria-props": {
600
+ meta: {
601
+ docs: {
602
+ url: string;
603
+ description: string;
604
+ };
605
+ schema: never[];
606
+ };
607
+ create(context: any): {
608
+ JSXOpeningElement(node: any): void;
609
+ };
610
+ };
611
+ scope: {
612
+ meta: {
613
+ docs: {
614
+ url: string;
615
+ description: string;
616
+ };
617
+ schema: never[];
618
+ };
619
+ create: (context: any) => {
620
+ JSXAttribute: (node: any) => void;
621
+ };
622
+ };
623
+ "tabindex-no-positive": {
624
+ meta: {
625
+ docs: {
626
+ url: string;
627
+ description: string;
628
+ };
629
+ schema: never[];
630
+ };
631
+ create: (context: any) => {
632
+ JSXAttribute: (attribute: any) => void;
633
+ };
634
+ };
635
+ };
636
+ };
637
+ };
638
+ rules: {};
639
+ languageOptions: {
640
+ parserOptions: {
641
+ ecmaFeatures: {
642
+ jsx: boolean;
643
+ };
644
+ };
645
+ };
646
+ } | {
647
+ files: string[];
648
+ plugins: {
649
+ react: any;
650
+ };
651
+ rules: import("eslint").Linter.RulesRecord;
652
+ })[];
2
653
  export default _default;
3
654
  //# sourceMappingURL=react.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"react.d.ts","sourceRoot":"","sources":["../src/react.ts"],"names":[],"mappings":";AA4CA,wBAQG"}
1
+ {"version":3,"file":"react.d.ts","sourceRoot":"","sources":["../src/react.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgBA,wBAKsD"}
package/dist/react.js CHANGED
@@ -1,46 +1,20 @@
1
- import { createRequire } from 'node:module';
2
- import { join } from 'node:path';
3
- import nx from '@nx/eslint-plugin';
4
- import { isRecord } from "./unknown-values.js";
5
- // @nx/eslint-plugin (checked 24.0.2) requires eslint-plugin-import,
6
- // eslint-plugin-jsx-a11y, eslint-plugin-react and eslint-plugin-react-hooks in
7
- // flat/react, but declares none of them. This package declares them as optional
8
- // peers, so npm writes the lockfile edges that Nx hashes for a lint input on
9
- // @zukhruf/eslint. Delete the peers when @nx/eslint-plugin declares them.
10
- // flat/react sets settings.react.version to 'detect'. eslint-plugin-react
11
- // 7.37.5 lib/util/version.js:31 (resolveBasedir) then calls
12
- // context.getFilename(), which ESLint 10 removed, so every rule crashes at load.
13
- // No upstream fix as of 2026-10-31. The preset gives the version of the react
14
- // package that resolves from the folder where ESLint runs: `nx lint` runs
15
- // `eslint .` in the project root, and a hoisted react resolves from there.
16
- // react is an optional peer for the reason above: its version changes the lint
17
- // result, so the lockfile edge puts it in the hash of a lint input.
18
- function installedReactVersion() {
19
- const workspace = createRequire(join(process.cwd(), 'package.json'));
20
- let manifest;
21
- try {
22
- manifest = workspace('react/package.json');
23
- }
24
- catch (error) {
25
- if (isRecord(error) && error['code'] === 'MODULE_NOT_FOUND') {
26
- throw new Error(`@zukhruf/eslint/react needs the react package, and react does not resolve from ${process.cwd()}. Install react in the workspace.`, { cause: error });
27
- }
28
- throw error;
29
- }
30
- const version = isRecord(manifest) ? manifest['version'] : undefined;
31
- if (typeof version !== 'string') {
32
- throw new TypeError('The package.json of react has no version.');
33
- }
34
- return version;
35
- }
36
- const version = installedReactVersion();
37
- export default nx.configs['flat/react'].map((config) => {
38
- const react = config.settings?.['react'];
39
- return isRecord(react)
40
- ? {
41
- ...config,
42
- settings: { ...config.settings, react: { ...react, version } },
43
- }
44
- : config;
45
- });
1
+ import eslintReact from '@eslint-react/eslint-plugin';
2
+ import jsxA11y from 'eslint-plugin-jsx-a11y-x';
3
+ import reactHooks from 'eslint-plugin-react-hooks';
4
+ import { TYPESCRIPT } from "./files.js";
5
+ // react is an optional peer, because its version changes the lint result:
6
+ // @eslint-react/shared 5.28.8 (dist/index.js:184, :190-195) reads the version
7
+ // of the react that resolves from the folder where ESLint runs. With the peer,
8
+ // npm writes the lockfile edge, so @zukhruf/nx/lint hashes the React version
9
+ // in a lint input on @zukhruf/eslint.
10
+ // The community configs set no `files`. @eslint-react's type-checked rules need the
11
+ // parser services that zukhruf/base/typed gives to TYPESCRIPT only, and they
12
+ // throw on any other file, for example a package.json under
13
+ // jsonc-eslint-parser.
14
+ export default [
15
+ jsxA11y.configs.recommended,
16
+ reactHooks.configs.flat.recommended,
17
+ eslintReact.configs['recommended-type-checked'],
18
+ eslintReact.configs['disable-conflict-eslint-plugin-react-hooks'],
19
+ ].map((config) => ({ ...config, files: TYPESCRIPT }));
46
20
  //# sourceMappingURL=react.js.map
package/dist/react.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"react.js","sourceRoot":"","sources":["../src/react.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAEnC,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAE/C,oEAAoE;AACpE,+EAA+E;AAC/E,gFAAgF;AAChF,6EAA6E;AAC7E,0EAA0E;AAE1E,0EAA0E;AAC1E,4DAA4D;AAC5D,iFAAiF;AACjF,8EAA8E;AAC9E,0EAA0E;AAC1E,2EAA2E;AAC3E,+EAA+E;AAC/E,oEAAoE;AACpE,SAAS,qBAAqB;IAC5B,MAAM,SAAS,GAAG,aAAa,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,cAAc,CAAC,CAAC,CAAC;IACrE,IAAI,QAAiB,CAAC;IACtB,IAAI,CAAC;QACH,QAAQ,GAAG,SAAS,CAAC,oBAAoB,CAAC,CAAC;IAC7C,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,QAAQ,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,KAAK,kBAAkB,EAAE,CAAC;YAC5D,MAAM,IAAI,KAAK,CACb,kFAAkF,OAAO,CAAC,GAAG,EAAE,mCAAmC,EAClI,EAAE,KAAK,EAAE,KAAK,EAAE,CACjB,CAAC;QACJ,CAAC;QACD,MAAM,KAAK,CAAC;IACd,CAAC;IACD,MAAM,OAAO,GAAG,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IACrE,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE,CAAC;QAChC,MAAM,IAAI,SAAS,CAAC,2CAA2C,CAAC,CAAC;IACnE,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,MAAM,OAAO,GAAG,qBAAqB,EAAE,CAAC;AAExC,eAAe,EAAE,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE;IACrD,MAAM,KAAK,GAAG,MAAM,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,CAAC;IACzC,OAAO,QAAQ,CAAC,KAAK,CAAC;QACpB,CAAC,CAAC;YACE,GAAG,MAAM;YACT,QAAQ,EAAE,EAAE,GAAG,MAAM,CAAC,QAAQ,EAAE,KAAK,EAAE,EAAE,GAAG,KAAK,EAAE,OAAO,EAAE,EAAE;SAC/D;QACH,CAAC,CAAC,MAAM,CAAC;AACb,CAAC,CAAC,CAAC"}
1
+ {"version":3,"file":"react.js","sourceRoot":"","sources":["../src/react.ts"],"names":[],"mappings":"AAAA,OAAO,WAAW,MAAM,6BAA6B,CAAC;AACtD,OAAO,OAAO,MAAM,0BAA0B,CAAC;AAC/C,OAAO,UAAU,MAAM,2BAA2B,CAAC;AAEnD,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAExC,0EAA0E;AAC1E,8EAA8E;AAC9E,+EAA+E;AAC/E,6EAA6E;AAC7E,sCAAsC;AAEtC,oFAAoF;AACpF,6EAA6E;AAC7E,4DAA4D;AAC5D,uBAAuB;AACvB,eAAe;IACb,OAAO,CAAC,OAAO,CAAC,WAAW;IAC3B,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,WAAW;IACnC,WAAW,CAAC,OAAO,CAAC,0BAA0B,CAAC;IAC/C,WAAW,CAAC,OAAO,CAAC,4CAA4C,CAAC;CAClE,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zukhruf/eslint",
3
- "version": "0.6.7",
3
+ "version": "0.6.9",
4
4
  "description": "ESLint rules and configs shared across workspaces. Every check is its own named rule, so a repo's own config cannot silently erase it.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -62,26 +62,28 @@
62
62
  "ts-api-utils": "^2.5.0"
63
63
  },
64
64
  "devDependencies": {
65
- "@zukhruf/testing": "^0.6.7"
65
+ "@zukhruf/testing": "^0.6.9"
66
66
  },
67
67
  "peerDependencies": {
68
+ "@eslint-react/eslint-plugin": "^5.28.8",
68
69
  "@eslint/js": "^9.30.0 || ^10.0.0",
69
70
  "@nx/devkit": ">=21.0.0",
70
71
  "@nx/eslint-plugin": ">=21.0.0",
71
72
  "eslint": "^9.30.0 || ^10.0.0",
72
73
  "eslint-plugin-es-x": "^9.7.0 || ^10.0.0",
73
74
  "eslint-plugin-functional": "^10.0.0",
74
- "eslint-plugin-import": "^2.31.0",
75
75
  "eslint-plugin-import-x": "^4.16.0",
76
- "eslint-plugin-jsx-a11y": "^6.10.1",
77
- "eslint-plugin-react": "^7.35.0",
78
- "eslint-plugin-react-hooks": "^5.0.0 || ^7.0.0",
76
+ "eslint-plugin-jsx-a11y-x": "^0.2.0",
77
+ "eslint-plugin-react-hooks": "^7.0.0",
79
78
  "jsonc-eslint-parser": "^2.4.0 || ^3.0.0",
80
79
  "react": "*",
81
80
  "typescript": ">=5.8.0 <6.1.0",
82
81
  "typescript-eslint": "^8.47.0"
83
82
  },
84
83
  "peerDependenciesMeta": {
84
+ "@eslint-react/eslint-plugin": {
85
+ "optional": true
86
+ },
85
87
  "@nx/devkit": {
86
88
  "optional": true
87
89
  },
@@ -91,13 +93,7 @@
91
93
  "eslint-plugin-es-x": {
92
94
  "optional": true
93
95
  },
94
- "eslint-plugin-import": {
95
- "optional": true
96
- },
97
- "eslint-plugin-jsx-a11y": {
98
- "optional": true
99
- },
100
- "eslint-plugin-react": {
96
+ "eslint-plugin-jsx-a11y-x": {
101
97
  "optional": true
102
98
  },
103
99
  "eslint-plugin-react-hooks": {