eslint-plugin-react-dom 5.24.1 → 5.24.2

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.
Files changed (2) hide show
  1. package/dist/index.js +2 -850
  2. package/package.json +6 -6
package/dist/index.js CHANGED
@@ -26,7 +26,7 @@ var __exportAll = (all, no_symbols) => {
26
26
  //#endregion
27
27
  //#region package.json
28
28
  var name$2 = "eslint-plugin-react-dom";
29
- var version = "5.24.1";
29
+ var version = "5.24.2";
30
30
 
31
31
  //#endregion
32
32
  //#region src/utils/create-rule.ts
@@ -214,44 +214,6 @@ function buildFix$2(context, node) {
214
214
 
215
215
  //#endregion
216
216
  //#region ../../.pkgs/eff/dist/index.js
217
- /**
218
- * Applies a `pipe` method's variadic arguments to an initial value from left
219
- * to right.
220
- *
221
- * **When to use**
222
- *
223
- * Use to implement a custom `.pipe(...)` method from JavaScript's `arguments`
224
- * object.
225
- *
226
- * **Details**
227
- *
228
- * This helper is intended for implementing `Pipeable.pipe` methods that
229
- * receive JavaScript's `arguments` object. With no functions it returns the
230
- * original value; otherwise it feeds each result into the next function.
231
- *
232
- * **Example** (Implementing a pipe method)
233
- *
234
- * ```ts
235
- * import { Pipeable } from "effect"
236
- *
237
- * class NumberBox {
238
- * constructor(readonly value: number) {}
239
- *
240
- * pipe(..._fns: ReadonlyArray<(value: number) => number>): number {
241
- * return Pipeable.pipeArguments(this.value, arguments) as number
242
- * }
243
- * }
244
- *
245
- * const result = new NumberBox(5).pipe(
246
- * (n) => n + 2,
247
- * (n) => n * 3
248
- * )
249
- * result // => 21
250
- * ```
251
- *
252
- * @category combinators
253
- * @since 2.0.0
254
- */
255
217
  const pipeArguments = (self, args) => {
256
218
  switch (args.length) {
257
219
  case 0: return self;
@@ -271,100 +233,14 @@ const pipeArguments = (self, args) => {
271
233
  }
272
234
  }
273
235
  };
274
- /**
275
- * Reusable prototype that implements `Pipeable.pipe`.
276
- *
277
- * **When to use**
278
- *
279
- * Use when classes or object prototypes can reuse this value when they need the
280
- * standard pipe implementation backed by `pipeArguments`.
281
- *
282
- * @category prototypes
283
- * @since 3.15.0
284
- */
285
236
  const Prototype = { pipe() {
286
237
  return pipeArguments(this, arguments);
287
238
  } };
288
- /**
289
- * Provides a base constructor whose instances implement the standard `Pipeable.pipe`
290
- * method.
291
- *
292
- * **When to use**
293
- *
294
- * Use when you need to define a class that supports Effect-style method
295
- * chaining through `.pipe(...)`.
296
- *
297
- * @category constructors
298
- * @since 3.15.0
299
- */
300
239
  const Class = (function() {
301
240
  function PipeableBase() {}
302
241
  PipeableBase.prototype = Prototype;
303
242
  return PipeableBase;
304
243
  })();
305
- /**
306
- * Creates a function that can be called in data-first style or data-last
307
- * (`pipe`-friendly) style.
308
- *
309
- * **When to use**
310
- *
311
- * Use to expose one implementation through both direct and `pipe`-friendly
312
- * call styles.
313
- *
314
- * **Details**
315
- *
316
- * Pass either the arity of the uncurried function or a predicate that decides
317
- * whether the current call is data-first. Arity is the common case. Use a
318
- * predicate when optional arguments make arity ambiguous.
319
- *
320
- * **Example** (Selecting data-first or data-last style by arity)
321
- *
322
- * ```ts
323
- * import { Function, pipe } from "effect"
324
- *
325
- * const sum = Function.dual<
326
- * (that: number) => (self: number) => number,
327
- * (self: number, that: number) => number
328
- * >(2, (self, that) => self + that)
329
- *
330
- * sum(2, 3) // => 5
331
- * pipe(2, sum(3)) // => 5
332
- * ```
333
- *
334
- * **Example** (Defining overloads with call signatures)
335
- *
336
- * ```ts
337
- * import { Function, pipe } from "effect"
338
- *
339
- * const sum: {
340
- * (that: number): (self: number) => number
341
- * (self: number, that: number): number
342
- * } = Function.dual(2, (self: number, that: number): number => self + that)
343
- *
344
- * sum(2, 3) // => 5
345
- * pipe(2, sum(3)) // => 5
346
- * ```
347
- *
348
- * **Example** (Selecting data-first or data-last style with a predicate)
349
- *
350
- * ```ts
351
- * import { Function, pipe } from "effect"
352
- *
353
- * const sum = Function.dual<
354
- * (that: number) => (self: number) => number,
355
- * (self: number, that: number) => number
356
- * >(
357
- * (args) => args.length === 2,
358
- * (self, that) => self + that
359
- * )
360
- *
361
- * sum(2, 3) // => 5
362
- * pipe(2, sum(3)) // => 5
363
- * ```
364
- *
365
- * @category combinators
366
- * @since 2.0.0
367
- */
368
244
  const dual = function(arity, body) {
369
245
  if (typeof arity === "function") return function() {
370
246
  return arity(arguments) ? body.apply(this, arguments) : ((self) => body(self, ...arguments));
@@ -393,588 +269,35 @@ const dual = function(arity, body) {
393
269
  };
394
270
  }
395
271
  };
396
- /**
397
- * Returns its input argument unchanged.
398
- *
399
- * **When to use**
400
- *
401
- * Use to return a value unchanged where a function is required.
402
- *
403
- * **Example** (Returning the same value)
404
- *
405
- * ```ts
406
- * import { identity } from "effect"
407
- *
408
- * identity(5) // => 5
409
- * ```
410
- *
411
- * @category combinators
412
- * @since 2.0.0
413
- */
414
272
  const identity = (a) => a;
415
- /**
416
- * Returns the input value with a different static type.
417
- *
418
- * **When to use**
419
- *
420
- * Use when you need an explicit type-level cast and accept that the value is
421
- * returned unchanged at runtime.
422
- *
423
- * **Gotchas**
424
- *
425
- * This is a type-level cast only; it performs no runtime validation or
426
- * conversion.
427
- *
428
- * @see {@link satisfies} for checking assignability without changing the resulting type
429
- *
430
- * @category utility types
431
- * @since 4.0.0
432
- */
433
273
  const cast = identity;
434
- /**
435
- * Creates a zero-argument function that always returns the provided value.
436
- *
437
- * **When to use**
438
- *
439
- * Use when you need a thunk or callback that returns the same value on every
440
- * invocation.
441
- *
442
- * **Example** (Creating a constant thunk)
443
- *
444
- * ```ts
445
- * import { Function } from "effect"
446
- *
447
- * const constNull = Function.constant(null)
448
- *
449
- * constNull() // => null
450
- * constNull() // => null
451
- * ```
452
- *
453
- * @category constructors
454
- * @since 2.0.0
455
- */
456
274
  const constant = (value) => () => value;
457
- /**
458
- * Returns `true` when called.
459
- *
460
- * **When to use**
461
- *
462
- * Use when you need a thunk that returns `true` on every invocation.
463
- *
464
- * **Example** (Returning true from a thunk)
465
- *
466
- * ```ts
467
- * import { Function } from "effect"
468
- *
469
- * Function.constTrue() // => true
470
- * ```
471
- *
472
- * @category constants
473
- * @since 2.0.0
474
- */
475
275
  const constTrue = constant(true);
476
- /**
477
- * Returns `false` when called.
478
- *
479
- * **When to use**
480
- *
481
- * Use when you need a thunk that returns `false` on every invocation.
482
- *
483
- * **Example** (Returning false from a thunk)
484
- *
485
- * ```ts
486
- * import { Function } from "effect"
487
- *
488
- * Function.constFalse() // => false
489
- * ```
490
- *
491
- * @category constants
492
- * @since 2.0.0
493
- */
494
276
  const constFalse = constant(false);
495
- /**
496
- * Returns `null` when called.
497
- *
498
- * **When to use**
499
- *
500
- * Use when you need a thunk that returns `null` on every invocation.
501
- *
502
- * **Example** (Returning null from a thunk)
503
- *
504
- * ```ts
505
- * import { Function } from "effect"
506
- *
507
- * Function.constNull() // => null
508
- * ```
509
- *
510
- * @category constants
511
- * @since 2.0.0
512
- */
513
277
  const constNull = constant(null);
514
- /**
515
- * Returns `undefined` when called.
516
- *
517
- * **When to use**
518
- *
519
- * Use when you need a thunk that returns `undefined` on every invocation.
520
- *
521
- * **Example** (Returning undefined from a thunk)
522
- *
523
- * ```ts
524
- * import { Function } from "effect"
525
- *
526
- * Function.constUndefined() // => undefined
527
- * ```
528
- *
529
- * @category constants
530
- * @since 2.0.0
531
- */
532
278
  const constUndefined = constant(void 0);
533
- /**
534
- * Composes two functions, `ab` and `bc` into a single function that takes in an argument `a` of type `A` and returns a result of type `C`.
535
- * The result is obtained by first applying the `ab` function to `a` and then applying the `bc` function to the result of `ab`.
536
- *
537
- * **When to use**
538
- *
539
- * Use to compose exactly two unary functions into a reusable unary function.
540
- *
541
- * **Example** (Composing two functions)
542
- *
543
- * ```ts
544
- * import { Function } from "effect"
545
- *
546
- * const increment = (n: number) => n + 1
547
- * const square = (n: number) => n * n
548
- *
549
- * Function.compose(increment, square)(2) // => 9
550
- * ```
551
- *
552
- * @see {@link flow} for composing a left-to-right sequence of functions
553
- * @see {@link pipe} for applying a value through a left-to-right sequence immediately
554
- *
555
- * @category combinators
556
- * @since 2.0.0
557
- */
558
279
  const compose = dual(2, (ab, bc) => (a) => bc(ab(a)));
559
- /**
560
- * Marks an impossible branch by accepting a `never` value and returning any
561
- * type.
562
- *
563
- * **When to use**
564
- *
565
- * Use when you need a return value in a branch that exhaustive checks prove
566
- * cannot be reached.
567
- *
568
- * **Gotchas**
569
- *
570
- * Calling `absurd` throws, because a value of type `never` should be
571
- * impossible at runtime.
572
- *
573
- * **Example** (Handling impossible values)
574
- *
575
- * ```ts
576
- * import { absurd } from "effect"
577
- *
578
- * const handleNever = (value: never) => {
579
- * return absurd(value) // This will throw an error if called
580
- * }
581
- * ```
582
- *
583
- * @category utility types
584
- * @since 2.0.0
585
- */
586
280
  const absurd = (_) => {
587
281
  throw new Error("Called `absurd` function which should be uncallable");
588
282
  };
589
- /**
590
- * Creates a compile-time placeholder for a value of any type.
591
- *
592
- * **When to use**
593
- *
594
- * Use as a temporary typed placeholder while developing incomplete code.
595
- *
596
- * **Gotchas**
597
- *
598
- * `hole` is intended for temporary development use. If the placeholder is
599
- * evaluated at runtime, it throws.
600
- *
601
- * **Example** (Creating a development placeholder)
602
- *
603
- * ```ts
604
- * import { hole } from "effect"
605
- *
606
- * // Intentionally not called: `hole` throws if the placeholder is evaluated.
607
- * const buildUser = (id: number): { readonly id: number; readonly name: string } => ({
608
- * id,
609
- * name: hole<string>()
610
- * })
611
- *
612
- * ```
613
- *
614
- * @category utility types
615
- * @since 2.0.0
616
- */
617
283
  const hole = cast(absurd);
618
- /**
619
- * Creates a predicate that returns `true` only if both predicates are `true`.
620
- *
621
- * **When to use**
622
- *
623
- * Use when you want to combine `Predicate`s with AND, accepting values that
624
- * satisfy multiple conditions, including refinements that narrow to an
625
- * intersection.
626
- *
627
- * **Details**
628
- *
629
- * Evaluation short-circuits on the first `false`. For refinements, the output
630
- * type is an intersection.
631
- *
632
- * **Example** (Checking both conditions)
633
- *
634
- * ```ts
635
- * import { Predicate } from "effect"
636
- *
637
- * const hasAAndB = Predicate.and(
638
- * Predicate.hasProperty("a"),
639
- * Predicate.hasProperty("b")
640
- * )
641
- *
642
- * const input: unknown = JSON.parse(`{"a":1,"b":"ok"}`)
643
- * if (hasAAndB(input)) {
644
- * // input has both properties at this point
645
- * const a = input.a
646
- * const b = input.b
647
- *
648
- * const values = [a, b] // => [1, "ok"]
649
- * }
650
- * ```
651
- *
652
- * @see {@link or}
653
- * @see {@link not}
654
- * @category combinators
655
- * @since 2.0.0
656
- */
657
284
  const and = dual(2, (a, b) => (data) => a(data) && b(data));
658
- /**
659
- * Creates a predicate that returns `true` if either predicate is `true`.
660
- *
661
- * **When to use**
662
- *
663
- * Use when you want to combine `Predicate`s with OR, accepting values that
664
- * satisfy at least one condition, including refinements that narrow to a union.
665
- *
666
- * **Details**
667
- *
668
- * Evaluation short-circuits on the first `true`. For refinements, the output
669
- * type is a union.
670
- *
671
- * **Example** (Checking either condition)
672
- *
673
- * ```ts
674
- * import { Predicate } from "effect"
675
- *
676
- * const isStringOrNumber = Predicate.or(Predicate.isString, Predicate.isNumber)
677
- *
678
- * isStringOrNumber("a") // => true
679
- * ```
680
- *
681
- * @see {@link and}
682
- * @see {@link xor}
683
- * @category combinators
684
- * @since 2.0.0
685
- */
686
285
  const or = dual(2, (a, b) => (data) => a(data) || b(data));
687
- /**
688
- * Creates a predicate that returns `true` if exactly one predicate is `true`.
689
- *
690
- * **When to use**
691
- *
692
- * Use when you want to combine two `Predicate`s with exclusive-or semantics.
693
- *
694
- * **Details**
695
- *
696
- * Returns `true` when results differ.
697
- *
698
- * **Example** (Checking exclusive-or conditions)
699
- *
700
- * ```ts
701
- * import { Predicate } from "effect"
702
- *
703
- * const isEven = (n: number) => n % 2 === 0
704
- * const isPositive = (n: number) => n > 0
705
- * const either = Predicate.xor(isEven, isPositive)
706
- *
707
- * either(-2) // => true
708
- * ```
709
- *
710
- * @see {@link or}
711
- * @see {@link and}
712
- * @category combinators
713
- * @since 2.0.0
714
- */
715
286
  const xor = dual(2, (a, b) => (data) => a(data) !== b(data));
716
- /**
717
- * Creates a predicate that returns `true` when both predicates agree.
718
- *
719
- * **When to use**
720
- *
721
- * Use when you want to check equivalence of two `Predicate`s.
722
- *
723
- * **Details**
724
- *
725
- * Returns `true` when both results are equal.
726
- *
727
- * **Example** (Defining equivalence)
728
- *
729
- * ```ts
730
- * import { Predicate } from "effect"
731
- *
732
- * const isEven = (n: number) => n % 2 === 0
733
- * const same = Predicate.eqv(isEven, isEven)
734
- *
735
- * same(3) // => true
736
- * ```
737
- *
738
- * @see {@link xor}
739
- * @category combinators
740
- * @since 2.0.0
741
- */
742
287
  const eqv = dual(2, (a, b) => (data) => a(data) === b(data));
743
- /**
744
- * Creates a predicate representing logical implication: if `antecedent`, then `consequent`.
745
- *
746
- * **When to use**
747
- *
748
- * Use when you need to encode logical implication between `Predicate` rules,
749
- * where one rule only applies when a precondition holds.
750
- *
751
- * **Details**
752
- *
753
- * Models constraints like "if A then B" and returns `true` when the antecedent
754
- * is `false`.
755
- *
756
- * **Example** (Checking implication)
757
- *
758
- * ```ts
759
- * import { Predicate } from "effect"
760
- *
761
- * const isAdult = (age: number) => age >= 18
762
- * const canVote = (age: number) => age >= 18
763
- * const implies = Predicate.implies(isAdult, canVote)
764
- *
765
- * implies(16) // => true
766
- * ```
767
- *
768
- * @see {@link and}
769
- * @see {@link or}
770
- * @category combinators
771
- * @since 2.0.0
772
- */
773
288
  const implies = dual(2, (antecedent, consequent) => (data) => !antecedent(data) || consequent(data));
774
- /**
775
- * Creates a predicate that returns `true` when neither predicate is `true`.
776
- *
777
- * **When to use**
778
- *
779
- * Use when you want to combine two `Predicate`s with logical NOR semantics.
780
- *
781
- * **Details**
782
- *
783
- * Returns the negation of `or`.
784
- *
785
- * **Example** (Checking NOR conditions)
786
- *
787
- * ```ts
788
- * import { Predicate } from "effect"
789
- *
790
- * const neither = Predicate.nor(Predicate.isString, Predicate.isNumber)
791
- *
792
- * neither(true) // => true
793
- * ```
794
- *
795
- * @see {@link or}
796
- * @see {@link not}
797
- * @category combinators
798
- * @since 2.0.0
799
- */
800
289
  const nor = dual(2, (a, b) => (data) => !a(data) && !b(data));
801
- /**
802
- * Creates a predicate that returns `true` unless both predicates are `true`.
803
- *
804
- * **When to use**
805
- *
806
- * Use when you want to combine two `Predicate`s with logical NAND semantics.
807
- *
808
- * **Details**
809
- *
810
- * Returns the negation of `and`.
811
- *
812
- * **Example** (Checking NAND conditions)
813
- *
814
- * ```ts
815
- * import { Predicate } from "effect"
816
- *
817
- * const notBoth = Predicate.nand(Predicate.isString, Predicate.isNumber)
818
- *
819
- * notBoth("a") // => true
820
- * ```
821
- *
822
- * @see {@link and}
823
- * @see {@link not}
824
- * @category combinators
825
- * @since 2.0.0
826
- */
827
290
  const nand = dual(2, (a, b) => (data) => !a(data) || !b(data));
828
- /**
829
- * Checks whether a value is a `string`.
830
- *
831
- * **When to use**
832
- *
833
- * Use when you need a `Predicate` guard to narrow an `unknown` value to a
834
- * string.
835
- *
836
- * **Details**
837
- *
838
- * Uses `typeof input === "string"`.
839
- *
840
- * **Example** (Guarding strings)
841
- *
842
- * ```ts
843
- * import { Predicate } from "effect"
844
- *
845
- * const data: unknown = "hi"
846
- *
847
- * if (Predicate.isString(data)) {
848
- * data.toUpperCase() // => "HI"
849
- * }
850
- * ```
851
- *
852
- * @see {@link isNumber}
853
- * @see {@link isBoolean}
854
- * @see {@link Refinement}
855
- * @category guards
856
- * @since 2.0.0
857
- */
858
291
  function isString(input) {
859
292
  return typeof input === "string";
860
293
  }
861
- /**
862
- * Checks whether a value is a `function`.
863
- *
864
- * **When to use**
865
- *
866
- * Use when you need a `Predicate` guard to narrow an `unknown` value to a
867
- * callable function.
868
- *
869
- * **Details**
870
- *
871
- * Uses `typeof input === "function"`.
872
- *
873
- * **Example** (Guarding functions)
874
- *
875
- * ```ts
876
- * import { Predicate } from "effect"
877
- *
878
- * const data: unknown = () => 1
879
- *
880
- * if (Predicate.isFunction(data)) {
881
- * data() // => 1
882
- * }
883
- * ```
884
- *
885
- * @see {@link isObjectKeyword}
886
- * @category guards
887
- * @since 2.0.0
888
- */
889
294
  function isFunction(input) {
890
295
  return typeof input === "function";
891
296
  }
892
- /**
893
- * Checks whether a value is an `object` in the JavaScript sense (objects, arrays, functions).
894
- *
895
- * **When to use**
896
- *
897
- * Use when you need a `Predicate` guard that accepts arrays and functions as
898
- * well as objects.
899
- *
900
- * **Details**
901
- *
902
- * Returns `true` for arrays and functions, and `false` for `null`.
903
- *
904
- * **Example** (Checking object keywords)
905
- *
906
- * ```ts
907
- * import { Predicate } from "effect"
908
- *
909
- * Predicate.isObjectKeyword(() => 1) // => true
910
- * Predicate.isObjectKeyword(null) // => false
911
- * ```
912
- *
913
- * @see {@link isObject}
914
- * @see {@link isObjectOrArray}
915
- * @category guards
916
- * @since 4.0.0
917
- */
918
297
  function isObjectKeyword(input) {
919
298
  return typeof input === "object" && input !== null || isFunction(input);
920
299
  }
921
- /**
922
- * Checks whether a value has a given property key.
923
- *
924
- * **When to use**
925
- *
926
- * Use when you need a `Predicate` guard for property access on `unknown`
927
- * values with a simple structural object check.
928
- *
929
- * **Details**
930
- *
931
- * Uses the `in` operator and `isObjectKeyword`. This does not check property
932
- * value types.
933
- *
934
- * **Example** (Guarding object properties)
935
- *
936
- * ```ts
937
- * import { Predicate } from "effect"
938
- *
939
- * const hasName = Predicate.hasProperty("name")
940
- * const data: unknown = { name: "Ada" }
941
- *
942
- * if (hasName(data)) {
943
- * data.name // => "Ada"
944
- * }
945
- * ```
946
- *
947
- * @see {@link isTagged}
948
- * @see {@link isObjectKeyword}
949
- * @category guards
950
- * @since 2.0.0
951
- */
952
300
  const hasProperty = dual(2, (data, property) => isObjectKeyword(data) && property in data);
953
- /**
954
- * Drops elements from the start while the predicate holds, returning the rest.
955
- *
956
- * **When to use**
957
- *
958
- * Use to remove a leading prefix of elements that satisfy a predicate.
959
- *
960
- * **Details**
961
- *
962
- * The predicate receives `(element, index)`.
963
- *
964
- * **Example** (Dropping while condition holds)
965
- *
966
- * ```ts
967
- * import { Array } from "effect"
968
- *
969
- * Array.dropWhile([1, 2, 3, 4, 5], (x) => x < 4) // => [4, 5]
970
- * ```
971
- *
972
- * @see {@link takeWhile} — keep the matching prefix instead
973
- * @see {@link drop} — drop a fixed count
974
- *
975
- * @category getters
976
- * @since 2.0.0
977
- */
978
301
  const dropWhile = dual(2, (self, predicate) => {
979
302
  const input = Array.isArray(self) ? self : Array.from(self);
980
303
  const len = input.length;
@@ -982,35 +305,6 @@ const dropWhile = dual(2, (self, predicate) => {
982
305
  while (idx < len && predicate(input[idx], idx)) idx++;
983
306
  return input.slice(idx);
984
307
  });
985
- /**
986
- * Takes elements from the start while the predicate holds, stopping at the
987
- * first element that fails.
988
- *
989
- * **When to use**
990
- *
991
- * Use to keep the leading elements of an iterable while each element satisfies
992
- * a predicate, returning the retained prefix as an array.
993
- *
994
- * **Details**
995
- *
996
- * Supports refinements for type narrowing. The predicate receives
997
- * `(element, index)`.
998
- *
999
- * **Example** (Taking while condition holds)
1000
- *
1001
- * ```ts
1002
- * import { Array } from "effect"
1003
- *
1004
- * Array.takeWhile([1, 3, 2, 4, 1, 2], (x) => x < 4) // => [1, 3, 2]
1005
- * ```
1006
- *
1007
- * @see {@link take} for keeping a fixed number of leading elements
1008
- * @see {@link dropWhile} for removing the matching prefix and keeping the rest
1009
- * @see {@link span} for splitting the matching prefix from the remaining elements
1010
- *
1011
- * @category getters
1012
- * @since 2.0.0
1013
- */
1014
308
  const takeWhile = dual(2, (self, predicate) => {
1015
309
  const input = Array.isArray(self) ? self : Array.from(self);
1016
310
  const len = input.length;
@@ -1021,29 +315,9 @@ const takeWhile = dual(2, (self, predicate) => {
1021
315
 
1022
316
  //#endregion
1023
317
  //#region src/utils/create-jsx-element-resolver.ts
1024
- /**
1025
- * Creates a resolver for JSX elements that determines the underlying DOM element type.
1026
- *
1027
- * This resolver handles:
1028
- * 1. Regular HTML elements (div, span, etc.)
1029
- * 2. Polymorphic components (components that render as a different element via a prop,
1030
- * ex: `<Box as="a">`). Only static string values of the polymorphic prop are
1031
- * supported; `<Box as={Component}>` cannot be resolved statically and falls back
1032
- * to the JSX element's own name.
1033
- *
1034
- * @param context The ESLint rule context
1035
- * @returns An object with a resolve method to determine the element type
1036
- */
1037
318
  function createJsxElementResolver(context) {
1038
319
  const { polymorphicPropName } = getSettingsFromContext(context);
1039
- return {
1040
- /**
1041
- * Resolves the JSX element to determine its type and the underlying DOM element type
1042
- *
1043
- * @param node The JSX element node to resolve
1044
- * @returns An object containing the JSX element type and DOM element type
1045
- */
1046
- resolve(node) {
320
+ return { resolve(node) {
1047
321
  const elementName = getElementFullType(node);
1048
322
  const result = {
1049
323
  domElementType: elementName,
@@ -1317,9 +591,6 @@ function create$5(context) {
1317
591
 
1318
592
  //#endregion
1319
593
  //#region src/rules/no-unknown-property/lib.ts
1320
- /**
1321
- * Map of standard HTML attributes to their React counterparts
1322
- */
1323
594
  const DOM_ATTRIBUTE_NAMES = {
1324
595
  "accept-charset": "acceptCharset",
1325
596
  class: "className",
@@ -1328,9 +599,6 @@ const DOM_ATTRIBUTE_NAMES = {
1328
599
  "http-equiv": "httpEquiv",
1329
600
  nomodule: "noModule"
1330
601
  };
1331
- /**
1332
- * Map of SVG attributes to their React camelCase equivalents
1333
- */
1334
602
  const SVGDOM_ATTRIBUTE_NAMES = {
1335
603
  "accent-height": "accentHeight",
1336
604
  "alignment-baseline": "alignmentBaseline",
@@ -1415,9 +683,6 @@ const SVGDOM_ATTRIBUTE_NAMES = {
1415
683
  "xml:lang": "xmlLang",
1416
684
  "xml:space": "xmlSpace"
1417
685
  };
1418
- /**
1419
- * Map of attributes that are only valid on specific HTML tags
1420
- */
1421
686
  const ATTRIBUTE_TAGS_MAP = {
1422
687
  abbr: ["th", "td"],
1423
688
  align: [
@@ -1563,9 +828,6 @@ const ATTRIBUTE_TAGS_MAP = {
1563
828
  webkitAllowFullScreen: ["iframe", "video"],
1564
829
  webkitDirectory: ["input"]
1565
830
  };
1566
- /**
1567
- * Single-word HTML/DOM properties
1568
- */
1569
831
  const DOM_PROPERTY_NAMES_ONE_WORD = [
1570
832
  "dir",
1571
833
  "draggable",
@@ -1758,9 +1020,6 @@ const DOM_PROPERTY_NAMES_ONE_WORD = [
1758
1020
  "security",
1759
1021
  "controls"
1760
1022
  ];
1761
- /**
1762
- * Multi-word (camelCase) HTML/DOM properties
1763
- */
1764
1023
  const DOM_PROPERTY_NAMES_TWO_WORDS = [
1765
1024
  "accessKey",
1766
1025
  "autoCapitalize",
@@ -2124,9 +1383,6 @@ const DOM_PROPERTY_NAMES_TWO_WORDS = [
2124
1383
  "disablePictureInPicture",
2125
1384
  "disableRemotePlayback"
2126
1385
  ];
2127
- /**
2128
- * DOM properties that are exempt from case sensitivity checks
2129
- */
2130
1386
  const DOM_PROPERTIES_IGNORE_CASE = [
2131
1387
  "charset",
2132
1388
  "allowFullScreen",
@@ -2134,9 +1390,6 @@ const DOM_PROPERTIES_IGNORE_CASE = [
2134
1390
  "mozAllowFullScreen",
2135
1391
  "webkitDirectory"
2136
1392
  ];
2137
- /**
2138
- * List of ARIA attributes
2139
- */
2140
1393
  const ARIA_PROPERTIES = [
2141
1394
  "aria-atomic",
2142
1395
  "aria-braillelabel",
@@ -2192,9 +1445,6 @@ const ARIA_PROPERTIES = [
2192
1445
  "aria-rowspan",
2193
1446
  "aria-setsize"
2194
1447
  ];
2195
- /**
2196
- * React-specific pointer event handlers added in React 16.4
2197
- */
2198
1448
  const REACT_ON_PROPS = [
2199
1449
  "onGotPointerCapture",
2200
1450
  "onGotPointerCaptureCapture",
@@ -2218,9 +1468,6 @@ const REACT_ON_PROPS = [
2218
1468
  "onPointerUp",
2219
1469
  "onPointerUpCapture"
2220
1470
  ];
2221
- /**
2222
- * Popover API properties added in React 19
2223
- */
2224
1471
  const POPOVER_API_PROPS = [
2225
1472
  "popover",
2226
1473
  "popoverTarget",
@@ -2229,9 +1476,6 @@ const POPOVER_API_PROPS = [
2229
1476
  "onBeforeToggle"
2230
1477
  ];
2231
1478
  const REACT_19_PROPS = [...POPOVER_API_PROPS];
2232
- /**
2233
- * Tag-specific attributes added in React 19
2234
- */
2235
1479
  const REACT_19_ATTRIBUTE_TAGS_MAP = {
2236
1480
  blocking: [
2237
1481
  "link",
@@ -2240,9 +1484,6 @@ const REACT_19_ATTRIBUTE_TAGS_MAP = {
2240
1484
  ],
2241
1485
  precedence: ["link", "style"]
2242
1486
  };
2243
- /**
2244
- * DOM properties added in React 19.3
2245
- */
2246
1487
  const REACT_19_3_PROPS = [
2247
1488
  "credentialless",
2248
1489
  "maskType",
@@ -2251,30 +1492,12 @@ const REACT_19_3_PROPS = [
2251
1492
  "onFullscreenError",
2252
1493
  "onFullscreenErrorCapture"
2253
1494
  ];
2254
- /**
2255
- * Tag-specific attributes added in React 19.3
2256
- */
2257
1495
  const REACT_19_3_ATTRIBUTE_TAGS_MAP = { credentialless: ["iframe"] };
2258
- /**
2259
- * SVG attribute mappings added in React 19.3
2260
- */
2261
1496
  const REACT_19_3_SVGDOM_ATTRIBUTE_NAMES = { "mask-type": "maskType" };
2262
- /**
2263
- * Tests React version against a comparator
2264
- * @param context ESLint context
2265
- * @param comparator Comparison operator
2266
- * @param version Version to compare against
2267
- * @returns Comparison result
2268
- */
2269
1497
  function testReactVersion(context, comparator, version) {
2270
1498
  const { version: localVersion } = getSettingsFromContext(context);
2271
1499
  return compare(localVersion, version, comparator);
2272
1500
  }
2273
- /**
2274
- * Gets all valid DOM property names based on React version
2275
- * @param context ESLint rule context
2276
- * @returns Array of valid DOM property names
2277
- */
2278
1501
  function getDOMPropertyNames(context) {
2279
1502
  const ALL_DOM_PROPERTY_NAMES = DOM_PROPERTY_NAMES_TWO_WORDS.concat(DOM_PROPERTY_NAMES_ONE_WORD);
2280
1503
  if (testReactVersion(context, "<=", "16.1.0")) {
@@ -2287,11 +1510,6 @@ function getDOMPropertyNames(context) {
2287
1510
  if (testReactVersion(context, ">=", "19.3.0")) ALL_DOM_PROPERTY_NAMES.push(...REACT_19_3_PROPS);
2288
1511
  return ALL_DOM_PROPERTY_NAMES;
2289
1512
  }
2290
- /**
2291
- * Gets the map of attributes to their allowed tags based on React version
2292
- * @param context ESLint rule context
2293
- * @returns Map of attributes to allowed tags
2294
- */
2295
1513
  function getAttributeTagsMap(context) {
2296
1514
  let attributeTagsMap = ATTRIBUTE_TAGS_MAP;
2297
1515
  if (testReactVersion(context, ">=", "19.0.0-rc.0")) attributeTagsMap = {
@@ -2304,80 +1522,32 @@ function getAttributeTagsMap(context) {
2304
1522
  };
2305
1523
  return attributeTagsMap;
2306
1524
  }
2307
- /**
2308
- * Check if a node's parent is a JSX tag that is written with lowercase letters,
2309
- * and is not a custom web component.
2310
- * @param childNode JSX element being tested
2311
- * @returns Whether the node is a valid HTML tag in JSX
2312
- */
2313
1525
  function isValidHTMLTagInJSX(childNode) {
2314
1526
  if (childNode.parent.name.type === AST_NODE_TYPES.JSXIdentifier && /^[a-z][^-]*$/.test(childNode.parent.name.name)) return !childNode.parent.attributes.some((attrNode) => attrNode.type === AST_NODE_TYPES.JSXAttribute && attrNode.name.type === AST_NODE_TYPES.JSXIdentifier && attrNode.name.name === "is");
2315
1527
  return false;
2316
1528
  }
2317
- /**
2318
- * Normalizes attribute names that should be case-insensitive
2319
- * @param name Attribute name to normalize
2320
- * @returns Normalized attribute name
2321
- */
2322
1529
  function normalizeAttributeCase(name) {
2323
1530
  return DOM_PROPERTIES_IGNORE_CASE.find((element) => element.toLowerCase() === name.toLowerCase()) ?? name;
2324
1531
  }
2325
- /**
2326
- * Check if an attribute name is a valid data-* attribute
2327
- * @param name Attribute name to test
2328
- * @returns Whether the attribute is a valid data attribute
2329
- */
2330
1532
  function isValidDataAttribute(name) {
2331
1533
  return !/^data-xml/i.test(name) && /^data-[^:]*$/.test(name);
2332
1534
  }
2333
- /**
2334
- * Check if an attribute name has uppercase characters
2335
- * @param name Attribute name to test
2336
- * @returns Whether the name has uppercase characters
2337
- */
2338
1535
  function hasUpperCaseCharacter(name) {
2339
1536
  return name.toLowerCase() !== name;
2340
1537
  }
2341
- /**
2342
- * Check if an attribute is a valid ARIA attribute
2343
- * @param name Attribute name to test
2344
- * @returns Whether the attribute is a valid ARIA attribute
2345
- */
2346
1538
  function isValidAriaAttribute(name) {
2347
1539
  return ARIA_PROPERTIES.some((element) => element === name);
2348
1540
  }
2349
- /**
2350
- * Gets the tag name for a JSXAttribute
2351
- * @param node JSXAttribute to get tag name from
2352
- * @returns Tag name or null
2353
- */
2354
1541
  function getTagName(node) {
2355
1542
  if (node.parent.name.type === AST_NODE_TYPES.JSXIdentifier) return node.parent.name.name;
2356
1543
  return null;
2357
1544
  }
2358
- /**
2359
- * Check if the tag name has a dot (member expression)
2360
- * @param node JSXAttribute to check
2361
- * @returns Whether the tag name has a dot
2362
- */
2363
1545
  function tagNameHasDot(node) {
2364
1546
  return node.parent.name.type === AST_NODE_TYPES.JSXMemberExpression;
2365
1547
  }
2366
- /**
2367
- * Check if an object has a property
2368
- * @param obj Object to check
2369
- * @param key Key to check for
2370
- * @returns Whether the object has the property
2371
- */
2372
1548
  function has(obj, key) {
2373
1549
  return Object.hasOwn(obj, key);
2374
1550
  }
2375
- /**
2376
- * Gets the standard name of an attribute
2377
- * @param name Attribute name
2378
- * @param context ESLint context
2379
- * @returns Standard name or undefined
2380
- */
2381
1551
  function getStandardName(name, context) {
2382
1552
  if (has(DOM_ATTRIBUTE_NAMES, name)) return DOM_ATTRIBUTE_NAMES[name] ?? null;
2383
1553
  const svgAttributeNames = testReactVersion(context, ">=", "19.3.0") ? {
@@ -2387,12 +1557,6 @@ function getStandardName(name, context) {
2387
1557
  if (has(svgAttributeNames, name)) return svgAttributeNames[name] ?? null;
2388
1558
  return getDOMPropertyNames(context).find((element) => element.toLowerCase() === name.toLowerCase()) ?? null;
2389
1559
  }
2390
- /**
2391
- * Gets text of a node
2392
- * @param context ESLint context
2393
- * @param node Node to get text from
2394
- * @returns Node's text
2395
- */
2396
1560
  function getText(context, node) {
2397
1561
  return context.sourceCode.getText(node);
2398
1562
  }
@@ -2536,22 +1700,10 @@ function create$3(context) {
2536
1700
 
2537
1701
  //#endregion
2538
1702
  //#region src/rules/no-unsafe-target-blank/lib.ts
2539
- /**
2540
- * Check if a value appears to be an external link.
2541
- * External links typically start with http(s):// or have protocol-relative format.
2542
- * @param value The value to check
2543
- * @returns Whether the value represents an external link
2544
- */
2545
1703
  function isExternalLinkLike(value) {
2546
1704
  if (!isString(value)) return false;
2547
1705
  return value.startsWith("https://") || /^(?:\w+:|\/\/)/u.test(value);
2548
1706
  }
2549
- /**
2550
- * Check if a rel prop value contains the necessary security attributes.
2551
- * At minimum, it should contain "noreferrer".
2552
- * @param value The rel prop value to check
2553
- * @returns Whether the rel value is considered secure
2554
- */
2555
1707
  function isSafeRel(value) {
2556
1708
  if (!isString(value)) return false;
2557
1709
  return value === "noreferrer" || /\bnoreferrer\b/u.test(value);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-react-dom",
3
- "version": "5.24.1",
3
+ "version": "5.24.2",
4
4
  "description": "ESLint React's ESLint plugin for DOM related rules.",
5
5
  "keywords": [
6
6
  "react",
@@ -37,11 +37,11 @@
37
37
  "dist"
38
38
  ],
39
39
  "dependencies": {
40
- "@eslint-react/ast": "5.24.1",
41
- "@eslint-react/eslint": "5.24.1",
42
- "@eslint-react/jsx": "5.24.1",
43
- "@eslint-react/shared": "5.24.1",
44
- "@eslint-react/var": "5.24.1",
40
+ "@eslint-react/ast": "5.24.2",
41
+ "@eslint-react/eslint": "5.24.2",
42
+ "@eslint-react/jsx": "5.24.2",
43
+ "@eslint-react/shared": "5.24.2",
44
+ "@eslint-react/var": "5.24.2",
45
45
  "@typescript-eslint/types": "^8.71.0",
46
46
  "@typescript-eslint/utils": "^8.71.0",
47
47
  "compare-versions": "^6.1.1",