@zukhruf/eslint 0.6.6 → 0.6.8

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,27 @@ 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
+ It gives these configs, in this order:
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
+ 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.
219
+ 2. `flat.recommended` of `eslint-plugin-react-hooks`: the rules of the React team.
220
+ 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`.
221
+ 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.
219
222
 
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:
223
+ 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.
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
+ The style rules of zukhruf for React are not in this export. They are in the config `zukhruf/react`.
226
+
227
+ Install the 3 plugins in the React workspace:
228
+
229
+ ```sh
230
+ npm install --save-dev @eslint-react/eslint-plugin eslint-plugin-jsx-a11y-x eslint-plugin-react-hooks
228
231
  ```
229
232
 
233
+ 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.
234
+
235
+ `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.
236
+
230
237
  ## React Native: Hermes
231
238
 
232
239
  `@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,640 @@
1
- declare const _default: import("typescript-eslint").FlatConfig.Config[];
1
+ declare const _default: (import("eslint").Linter.Config<import("@eslint/core", { with: { "resolution-mode": "require" } }).RulesConfig> | {
2
+ name: string;
3
+ plugins: {
4
+ "jsx-a11y-x": {
5
+ meta: {
6
+ name: string;
7
+ version: string;
8
+ };
9
+ rules: {
10
+ "alt-text": {
11
+ meta: {
12
+ docs: {
13
+ url: string;
14
+ description: string;
15
+ };
16
+ schema: {
17
+ type: string;
18
+ properties: {};
19
+ required: undefined;
20
+ }[];
21
+ defaultOptions: {
22
+ elements: string[];
23
+ }[];
24
+ };
25
+ create: (context: any) => {
26
+ JSXOpeningElement(node: any): void;
27
+ };
28
+ };
29
+ "anchor-ambiguous-text": {
30
+ meta: {
31
+ docs: {
32
+ url: string;
33
+ description: string;
34
+ };
35
+ schema: {
36
+ type: string;
37
+ properties: {};
38
+ required: undefined;
39
+ }[];
40
+ defaultOptions: {
41
+ words: string[];
42
+ }[];
43
+ };
44
+ create: (context: any) => {
45
+ JSXOpeningElement: (node: any) => void;
46
+ };
47
+ };
48
+ "anchor-has-content": {
49
+ meta: {
50
+ docs: {
51
+ url: string;
52
+ description: string;
53
+ };
54
+ schema: {
55
+ type: string;
56
+ properties: {};
57
+ required: undefined;
58
+ }[];
59
+ defaultOptions: {
60
+ components: never[];
61
+ }[];
62
+ };
63
+ create: (context: any) => {
64
+ JSXOpeningElement: (node: any) => void;
65
+ };
66
+ };
67
+ "anchor-is-valid": {
68
+ meta: {
69
+ docs: {
70
+ url: string;
71
+ description: string;
72
+ };
73
+ schema: {
74
+ type: string;
75
+ properties: {};
76
+ required: undefined;
77
+ }[];
78
+ defaultOptions: {
79
+ components: never[];
80
+ specialLink: never[];
81
+ aspects: string[];
82
+ }[];
83
+ };
84
+ create: (context: any) => {
85
+ JSXOpeningElement: (node: any) => void;
86
+ };
87
+ };
88
+ "aria-activedescendant-has-tabindex": {
89
+ meta: {
90
+ docs: {
91
+ url: string;
92
+ description: string;
93
+ };
94
+ schema: never[];
95
+ };
96
+ create: (context: any) => {
97
+ JSXOpeningElement: (node: any) => void;
98
+ };
99
+ };
100
+ "aria-props": {
101
+ meta: {
102
+ docs: {
103
+ url: string;
104
+ description: string;
105
+ };
106
+ schema: never[];
107
+ };
108
+ create: (context: any) => {
109
+ JSXAttribute: (attribute: any) => void;
110
+ };
111
+ };
112
+ "aria-proptypes": {
113
+ validityCheck: (value: any, expectedType: any, permittedValues: any) => any;
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-role": {
126
+ meta: {
127
+ docs: {
128
+ url: string;
129
+ description: string;
130
+ };
131
+ schema: {
132
+ type: string;
133
+ properties: {};
134
+ required: undefined;
135
+ }[];
136
+ defaultOptions: {
137
+ allowedInvalidRoles: never[];
138
+ ignoreNonDOM: boolean;
139
+ }[];
140
+ };
141
+ create: (context: any) => {
142
+ JSXAttribute: (attribute: any) => void;
143
+ };
144
+ };
145
+ "aria-unsupported-elements": {
146
+ meta: {
147
+ docs: {
148
+ url: string;
149
+ description: string;
150
+ };
151
+ schema: never[];
152
+ };
153
+ create: (context: any) => {
154
+ JSXOpeningElement: (node: any) => void;
155
+ };
156
+ };
157
+ "autocomplete-valid": {
158
+ meta: {
159
+ docs: {
160
+ url: string;
161
+ description: string;
162
+ };
163
+ schema: {
164
+ type: string;
165
+ properties: {};
166
+ required: undefined;
167
+ }[];
168
+ defaultOptions: {
169
+ inputComponents: never[];
170
+ }[];
171
+ };
172
+ create: (context: any) => {
173
+ JSXOpeningElement: (node: any) => void;
174
+ };
175
+ };
176
+ "click-events-have-key-events": {
177
+ meta: {
178
+ docs: {
179
+ url: string;
180
+ description: string;
181
+ };
182
+ schema: never[];
183
+ };
184
+ create: (context: any) => {
185
+ JSXOpeningElement: (node: any) => void;
186
+ };
187
+ };
188
+ "control-has-associated-label": {
189
+ meta: {
190
+ docs: {
191
+ description: string;
192
+ url: string;
193
+ };
194
+ schema: {
195
+ type: string;
196
+ properties: {};
197
+ required: undefined;
198
+ }[];
199
+ defaultOptions: {
200
+ labelAttributes: never[];
201
+ controlComponents: never[];
202
+ ignoreElements: never[];
203
+ ignoreRoles: never[];
204
+ }[];
205
+ };
206
+ create: (context: any) => {
207
+ JSXElement: (node: any) => void;
208
+ };
209
+ };
210
+ "heading-has-content": {
211
+ meta: {
212
+ docs: {
213
+ url: string;
214
+ description: string;
215
+ };
216
+ schema: {
217
+ type: string;
218
+ properties: {};
219
+ required: undefined;
220
+ }[];
221
+ defaultOptions: {
222
+ components: never[];
223
+ }[];
224
+ };
225
+ create: (context: any) => {
226
+ JSXOpeningElement: (node: any) => void;
227
+ };
228
+ };
229
+ "html-has-lang": {
230
+ meta: {
231
+ docs: {
232
+ url: string;
233
+ description: string;
234
+ };
235
+ schema: never[];
236
+ };
237
+ create: (context: any) => {
238
+ JSXOpeningElement: (node: any) => void;
239
+ };
240
+ };
241
+ "iframe-has-title": {
242
+ meta: {
243
+ docs: {
244
+ url: string;
245
+ description: string;
246
+ };
247
+ schema: never[];
248
+ };
249
+ create: (context: any) => {
250
+ JSXOpeningElement: (node: any) => void;
251
+ };
252
+ };
253
+ "img-redundant-alt": {
254
+ meta: {
255
+ docs: {
256
+ url: string;
257
+ description: string;
258
+ };
259
+ schema: {
260
+ type: string;
261
+ properties: {};
262
+ required: undefined;
263
+ }[];
264
+ defaultOptions: {
265
+ components: never[];
266
+ words: never[];
267
+ }[];
268
+ };
269
+ create: (context: any) => {
270
+ JSXOpeningElement: (node: any) => void;
271
+ };
272
+ };
273
+ "interactive-supports-focus": {
274
+ meta: {
275
+ docs: {
276
+ url: string;
277
+ description: string;
278
+ };
279
+ hasSuggestions: boolean;
280
+ messages: {
281
+ "tabIndex=0": string;
282
+ "tabIndex=-1": string;
283
+ };
284
+ schema: {
285
+ type: string;
286
+ properties: {};
287
+ required: undefined;
288
+ }[];
289
+ defaultOptions: {
290
+ tabbable: never[];
291
+ }[];
292
+ };
293
+ create: (context: any) => {
294
+ JSXOpeningElement: (node: any) => void;
295
+ };
296
+ };
297
+ "label-has-associated-control": {
298
+ meta: {
299
+ docs: {
300
+ description: string;
301
+ url: string;
302
+ };
303
+ schema: {
304
+ type: string;
305
+ properties: {};
306
+ required: undefined;
307
+ }[];
308
+ defaultOptions: {
309
+ labelComponents: never[];
310
+ labelAttributes: never[];
311
+ controlComponents: never[];
312
+ assert: string;
313
+ depth: number;
314
+ }[];
315
+ };
316
+ create: (context: any) => {
317
+ JSXElement: (node: any) => void;
318
+ };
319
+ };
320
+ lang: {
321
+ meta: {
322
+ docs: {
323
+ url: string;
324
+ description: string;
325
+ };
326
+ schema: never[];
327
+ };
328
+ create: (context: any) => {
329
+ JSXAttribute: (node: any) => void;
330
+ };
331
+ };
332
+ "media-has-caption": {
333
+ meta: {
334
+ docs: {
335
+ url: string;
336
+ description: string;
337
+ };
338
+ schema: {
339
+ type: string;
340
+ properties: {};
341
+ required: undefined;
342
+ }[];
343
+ defaultOptions: {
344
+ audio: never[];
345
+ video: never[];
346
+ track: never[];
347
+ }[];
348
+ };
349
+ create: (context: any) => {
350
+ JSXElement: (node: any) => void;
351
+ };
352
+ };
353
+ "mouse-events-have-key-events": {
354
+ meta: {
355
+ docs: {
356
+ url: string;
357
+ description: string;
358
+ };
359
+ schema: {
360
+ type: string;
361
+ properties: {};
362
+ required: undefined;
363
+ }[];
364
+ defaultOptions: {
365
+ hoverInHandlers: string[];
366
+ hoverOutHandlers: string[];
367
+ }[];
368
+ };
369
+ create: (context: any) => {
370
+ JSXOpeningElement: (node: any) => void;
371
+ };
372
+ };
373
+ "no-access-key": {
374
+ meta: {
375
+ docs: {
376
+ url: string;
377
+ description: string;
378
+ };
379
+ schema: never[];
380
+ };
381
+ create: (context: any) => {
382
+ JSXOpeningElement: (node: any) => void;
383
+ };
384
+ };
385
+ "no-aria-hidden-on-focusable": {
386
+ meta: {
387
+ docs: {
388
+ url: string;
389
+ description: string;
390
+ };
391
+ schema: never[];
392
+ };
393
+ create(context: any): {
394
+ JSXOpeningElement(node: any): void;
395
+ };
396
+ };
397
+ "no-autofocus": {
398
+ meta: {
399
+ docs: {
400
+ url: string;
401
+ description: string;
402
+ };
403
+ schema: {
404
+ type: string;
405
+ properties: {};
406
+ required: undefined;
407
+ }[];
408
+ defaultOptions: {
409
+ ignoreNonDOM: boolean;
410
+ }[];
411
+ };
412
+ create: (context: any) => {
413
+ JSXAttribute: (attribute: any) => void;
414
+ };
415
+ };
416
+ "no-distracting-elements": {
417
+ meta: {
418
+ docs: {
419
+ url: string;
420
+ description: string;
421
+ };
422
+ schema: {
423
+ type: string;
424
+ properties: {};
425
+ required: undefined;
426
+ }[];
427
+ defaultOptions: {
428
+ elements: string[];
429
+ }[];
430
+ };
431
+ create: (context: any) => {
432
+ JSXOpeningElement: (node: any) => void;
433
+ };
434
+ };
435
+ "no-interactive-element-to-noninteractive-role": {
436
+ meta: {
437
+ docs: {
438
+ url: string;
439
+ description: string;
440
+ };
441
+ schema: {
442
+ type: string;
443
+ additionalProperties: {
444
+ type: string;
445
+ items: {
446
+ type: string;
447
+ };
448
+ uniqueItems: boolean;
449
+ };
450
+ description: string;
451
+ }[];
452
+ defaultOptions: {}[];
453
+ };
454
+ create: (context: any) => {
455
+ JSXAttribute: (attribute: any) => void;
456
+ };
457
+ };
458
+ "no-noninteractive-element-interactions": {
459
+ meta: {
460
+ docs: {
461
+ url: string;
462
+ description: string;
463
+ };
464
+ schema: {
465
+ type: string;
466
+ properties: {};
467
+ required: undefined;
468
+ }[];
469
+ defaultOptions: {
470
+ handlers: any[];
471
+ }[];
472
+ };
473
+ create: (context: any) => {
474
+ JSXOpeningElement: (node: any) => void;
475
+ };
476
+ };
477
+ "no-noninteractive-element-to-interactive-role": {
478
+ meta: {
479
+ docs: {
480
+ url: string;
481
+ description: string;
482
+ };
483
+ schema: {
484
+ type: string;
485
+ additionalProperties: {
486
+ type: string;
487
+ items: {
488
+ type: string;
489
+ };
490
+ uniqueItems: boolean;
491
+ };
492
+ description: string;
493
+ }[];
494
+ defaultOptions: {}[];
495
+ };
496
+ create: (context: any) => {
497
+ JSXAttribute: (attribute: any) => void;
498
+ };
499
+ };
500
+ "no-noninteractive-tabindex": {
501
+ meta: {
502
+ docs: {
503
+ url: string;
504
+ description: string;
505
+ };
506
+ schema: {
507
+ type: string;
508
+ properties: {};
509
+ required: undefined;
510
+ }[];
511
+ defaultOptions: {
512
+ roles: never[];
513
+ tags: never[];
514
+ }[];
515
+ };
516
+ create: (context: any) => {
517
+ JSXOpeningElement: (node: any) => void;
518
+ };
519
+ };
520
+ "no-redundant-roles": {
521
+ meta: {
522
+ docs: {
523
+ url: string;
524
+ description: string;
525
+ };
526
+ schema: {
527
+ type: string;
528
+ additionalProperties: {
529
+ type: string;
530
+ items: {
531
+ type: string;
532
+ };
533
+ uniqueItems: boolean;
534
+ };
535
+ description: string;
536
+ }[];
537
+ defaultOptions: {}[];
538
+ };
539
+ create: (context: any) => {
540
+ JSXOpeningElement: (node: any) => void;
541
+ };
542
+ };
543
+ "no-static-element-interactions": {
544
+ meta: {
545
+ docs: {
546
+ url: string;
547
+ description: string;
548
+ };
549
+ schema: {
550
+ type: string;
551
+ properties: {};
552
+ required: undefined;
553
+ }[];
554
+ defaultOptions: {
555
+ handlers: any[];
556
+ }[];
557
+ };
558
+ create: (context: any) => {
559
+ JSXOpeningElement: (node: any) => void;
560
+ };
561
+ };
562
+ "prefer-tag-over-role": {
563
+ meta: {
564
+ docs: {
565
+ description: string;
566
+ url: string;
567
+ };
568
+ schema: never[];
569
+ };
570
+ create: (context: any) => {
571
+ JSXOpeningElement: (node: any) => void;
572
+ };
573
+ };
574
+ "role-has-required-aria-props": {
575
+ meta: {
576
+ docs: {
577
+ url: string;
578
+ description: string;
579
+ };
580
+ schema: never[];
581
+ };
582
+ create: (context: any) => {
583
+ JSXAttribute: (attribute: any) => void;
584
+ };
585
+ };
586
+ "role-supports-aria-props": {
587
+ meta: {
588
+ docs: {
589
+ url: string;
590
+ description: string;
591
+ };
592
+ schema: never[];
593
+ };
594
+ create(context: any): {
595
+ JSXOpeningElement(node: any): void;
596
+ };
597
+ };
598
+ scope: {
599
+ meta: {
600
+ docs: {
601
+ url: string;
602
+ description: string;
603
+ };
604
+ schema: never[];
605
+ };
606
+ create: (context: any) => {
607
+ JSXAttribute: (node: any) => void;
608
+ };
609
+ };
610
+ "tabindex-no-positive": {
611
+ meta: {
612
+ docs: {
613
+ url: string;
614
+ description: string;
615
+ };
616
+ schema: never[];
617
+ };
618
+ create: (context: any) => {
619
+ JSXAttribute: (attribute: any) => void;
620
+ };
621
+ };
622
+ };
623
+ };
624
+ };
625
+ rules: {};
626
+ languageOptions: {
627
+ parserOptions: {
628
+ ecmaFeatures: {
629
+ jsx: boolean;
630
+ };
631
+ };
632
+ };
633
+ } | {
634
+ plugins: {
635
+ react: any;
636
+ };
637
+ rules: import("eslint").Linter.RulesRecord;
638
+ })[];
2
639
  export default _default;
3
640
  //# 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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AASA,wBAKE"}
package/dist/react.js CHANGED
@@ -1,46 +1,15 @@
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
+ // react is an optional peer, because its version changes the lint result:
5
+ // @eslint-react/shared 5.28.8 (dist/index.js:184, :190-195) reads the version
6
+ // of the react that resolves from the folder where ESLint runs. With the peer,
7
+ // npm writes the lockfile edge, so @zukhruf/nx/lint hashes the React version
8
+ // in a lint input on @zukhruf/eslint.
9
+ export default [
10
+ jsxA11y.configs.recommended,
11
+ reactHooks.configs.flat.recommended,
12
+ eslintReact.configs['recommended-type-checked'],
13
+ eslintReact.configs['disable-conflict-eslint-plugin-react-hooks'],
14
+ ];
46
15
  //# 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,0EAA0E;AAC1E,8EAA8E;AAC9E,+EAA+E;AAC/E,6EAA6E;AAC7E,sCAAsC;AACtC,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"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zukhruf/eslint",
3
- "version": "0.6.6",
3
+ "version": "0.6.8",
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,19 +62,18 @@
62
62
  "ts-api-utils": "^2.5.0"
63
63
  },
64
64
  "devDependencies": {
65
- "@zukhruf/testing": "^0.6.6"
65
+ "@zukhruf/testing": "^0.6.8"
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",
76
+ "eslint-plugin-jsx-a11y-x": "^0.2.0",
78
77
  "eslint-plugin-react-hooks": "^5.0.0 || ^7.0.0",
79
78
  "jsonc-eslint-parser": "^2.4.0 || ^3.0.0",
80
79
  "react": "*",
@@ -82,6 +81,9 @@
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": {