eslint-plugin-react-dom 5.24.0 → 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 +29 -554
  2. package/package.json +7 -7
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.0";
29
+ var version = "5.24.2";
30
30
 
31
31
  //#endregion
32
32
  //#region src/utils/create-rule.ts
@@ -214,54 +214,6 @@ function buildFix$2(context, node) {
214
214
 
215
215
  //#endregion
216
216
  //#region ../../.pkgs/eff/dist/index.js
217
- /**
218
- * A function that checks if the passed parameter is a string and narrows its type accordingly.
219
- *
220
- * @param data - The variable to check.
221
- * @returns True if the passed input is a string, false otherwise.
222
- * @category guards
223
- */
224
- function isString(data) {
225
- return typeof data === "string";
226
- }
227
- /**
228
- * Applies a `pipe` method's variadic arguments to an initial value from left
229
- * to right.
230
- *
231
- * **When to use**
232
- *
233
- * Use to implement a custom `.pipe(...)` method from JavaScript's `arguments`
234
- * object.
235
- *
236
- * **Details**
237
- *
238
- * This helper is intended for implementing `Pipeable.pipe` methods that
239
- * receive JavaScript's `arguments` object. With no functions it returns the
240
- * original value; otherwise it feeds each result into the next function.
241
- *
242
- * **Example** (Implementing a pipe method)
243
- *
244
- * ```ts
245
- * import { Pipeable } from "effect"
246
- *
247
- * class NumberBox {
248
- * constructor(readonly value: number) {}
249
- *
250
- * pipe(..._fns: ReadonlyArray<(value: number) => number>): number {
251
- * return Pipeable.pipeArguments(this.value, arguments) as number
252
- * }
253
- * }
254
- *
255
- * const result = new NumberBox(5).pipe(
256
- * (n) => n + 2,
257
- * (n) => n * 3
258
- * )
259
- * console.log(result) // 21
260
- * ```
261
- *
262
- * @category combinators
263
- * @since 2.0.0
264
- */
265
217
  const pipeArguments = (self, args) => {
266
218
  switch (args.length) {
267
219
  case 0: return self;
@@ -281,110 +233,14 @@ const pipeArguments = (self, args) => {
281
233
  }
282
234
  }
283
235
  };
284
- /**
285
- * Reusable prototype that implements `Pipeable.pipe`.
286
- *
287
- * **When to use**
288
- *
289
- * Use when classes or object prototypes can reuse this value when they need the
290
- * standard pipe implementation backed by `pipeArguments`.
291
- *
292
- * @category prototypes
293
- * @since 3.15.0
294
- */
295
236
  const Prototype = { pipe() {
296
237
  return pipeArguments(this, arguments);
297
238
  } };
298
- /**
299
- * Provides a base constructor whose instances implement the standard `Pipeable.pipe`
300
- * method.
301
- *
302
- * **When to use**
303
- *
304
- * Use when you need to define a class that supports Effect-style method
305
- * chaining through `.pipe(...)`.
306
- *
307
- * @category constructors
308
- * @since 3.15.0
309
- */
310
239
  const Class = (function() {
311
240
  function PipeableBase() {}
312
241
  PipeableBase.prototype = Prototype;
313
242
  return PipeableBase;
314
243
  })();
315
- /**
316
- * Provides small helpers for defining and reusing TypeScript functions.
317
- *
318
- * The main helpers are `pipe` and `flow` for left-to-right composition and
319
- * `dual` for APIs that support both direct and pipe-friendly call styles. The
320
- * module also contains small identity, constant, tuple, type-level, and
321
- * memoization helpers used across the library.
322
- *
323
- * @since 2.0.0
324
- */
325
- /**
326
- * Creates a function that can be called in data-first style or data-last
327
- * (`pipe`-friendly) style.
328
- *
329
- * **When to use**
330
- *
331
- * Use to expose one implementation through both direct and `pipe`-friendly
332
- * call styles.
333
- *
334
- * **Details**
335
- *
336
- * Pass either the arity of the uncurried function or a predicate that decides
337
- * whether the current call is data-first. Arity is the common case. Use a
338
- * predicate when optional arguments make arity ambiguous.
339
- *
340
- * **Example** (Selecting data-first or data-last style by arity)
341
- *
342
- * ```ts
343
- * import { Function, pipe } from "effect"
344
- *
345
- * const sum = Function.dual<
346
- * (that: number) => (self: number) => number,
347
- * (self: number, that: number) => number
348
- * >(2, (self, that) => self + that)
349
- *
350
- * console.log(sum(2, 3)) // 5
351
- * console.log(pipe(2, sum(3))) // 5
352
- * ```
353
- *
354
- * **Example** (Defining overloads with call signatures)
355
- *
356
- * ```ts
357
- * import { Function, pipe } from "effect"
358
- *
359
- * const sum: {
360
- * (that: number): (self: number) => number
361
- * (self: number, that: number): number
362
- * } = Function.dual(2, (self: number, that: number): number => self + that)
363
- *
364
- * console.log(sum(2, 3)) // 5
365
- * console.log(pipe(2, sum(3))) // 5
366
- * ```
367
- *
368
- * **Example** (Selecting data-first or data-last style with a predicate)
369
- *
370
- * ```ts
371
- * import { Function, pipe } from "effect"
372
- *
373
- * const sum = Function.dual<
374
- * (that: number) => (self: number) => number,
375
- * (self: number, that: number) => number
376
- * >(
377
- * (args) => args.length === 2,
378
- * (self, that) => self + that
379
- * )
380
- *
381
- * console.log(sum(2, 3)) // 5
382
- * console.log(pipe(2, sum(3))) // 5
383
- * ```
384
- *
385
- * @category combinators
386
- * @since 2.0.0
387
- */
388
244
  const dual = function(arity, body) {
389
245
  if (typeof arity === "function") return function() {
390
246
  return arity(arguments) ? body.apply(this, arguments) : ((self) => body(self, ...arguments));
@@ -413,314 +269,55 @@ const dual = function(arity, body) {
413
269
  };
414
270
  }
415
271
  };
416
- /**
417
- * Returns its input argument unchanged.
418
- *
419
- * **When to use**
420
- *
421
- * Use to return a value unchanged where a function is required.
422
- *
423
- * **Example** (Returning the same value)
424
- *
425
- * ```ts
426
- * import { identity } from "effect"
427
- * import * as assert from "node:assert"
428
- *
429
- * assert.deepStrictEqual(identity(5), 5)
430
- * ```
431
- *
432
- * @category combinators
433
- * @since 2.0.0
434
- */
435
272
  const identity = (a) => a;
436
- /**
437
- * Returns the input value with a different static type.
438
- *
439
- * **When to use**
440
- *
441
- * Use when you need an explicit type-level cast and accept that the value is
442
- * returned unchanged at runtime.
443
- *
444
- * **Gotchas**
445
- *
446
- * This is a type-level cast only; it performs no runtime validation or
447
- * conversion.
448
- *
449
- * @see {@link satisfies} for checking assignability without changing the resulting type
450
- *
451
- * @category utility types
452
- * @since 4.0.0
453
- */
454
273
  const cast = identity;
455
- /**
456
- * Creates a zero-argument function that always returns the provided value.
457
- *
458
- * **When to use**
459
- *
460
- * Use when you need a thunk or callback that returns the same value on every
461
- * invocation.
462
- *
463
- * **Example** (Creating a constant thunk)
464
- *
465
- * ```ts
466
- * import { Function } from "effect"
467
- * import * as assert from "node:assert"
468
- *
469
- * const constNull = Function.constant(null)
470
- *
471
- * assert.deepStrictEqual(constNull(), null)
472
- * assert.deepStrictEqual(constNull(), null)
473
- * ```
474
- *
475
- * @category constructors
476
- * @since 2.0.0
477
- */
478
274
  const constant = (value) => () => value;
479
- /**
480
- * Returns `true` when called.
481
- *
482
- * **When to use**
483
- *
484
- * Use when you need a thunk that returns `true` on every invocation.
485
- *
486
- * **Example** (Returning true from a thunk)
487
- *
488
- * ```ts
489
- * import { Function } from "effect"
490
- * import * as assert from "node:assert"
491
- *
492
- * assert.deepStrictEqual(Function.constTrue(), true)
493
- * ```
494
- *
495
- * @category constants
496
- * @since 2.0.0
497
- */
498
275
  const constTrue = constant(true);
499
- /**
500
- * Returns `false` when called.
501
- *
502
- * **When to use**
503
- *
504
- * Use when you need a thunk that returns `false` on every invocation.
505
- *
506
- * **Example** (Returning false from a thunk)
507
- *
508
- * ```ts
509
- * import { Function } from "effect"
510
- * import * as assert from "node:assert"
511
- *
512
- * assert.deepStrictEqual(Function.constFalse(), false)
513
- * ```
514
- *
515
- * @category constants
516
- * @since 2.0.0
517
- */
518
276
  const constFalse = constant(false);
519
- /**
520
- * Returns `null` when called.
521
- *
522
- * **When to use**
523
- *
524
- * Use when you need a thunk that returns `null` on every invocation.
525
- *
526
- * **Example** (Returning null from a thunk)
527
- *
528
- * ```ts
529
- * import { Function } from "effect"
530
- * import * as assert from "node:assert"
531
- *
532
- * assert.deepStrictEqual(Function.constNull(), null)
533
- * ```
534
- *
535
- * @category constants
536
- * @since 2.0.0
537
- */
538
277
  const constNull = constant(null);
539
- /**
540
- * Returns `undefined` when called.
541
- *
542
- * **When to use**
543
- *
544
- * Use when you need a thunk that returns `undefined` on every invocation.
545
- *
546
- * **Example** (Returning undefined from a thunk)
547
- *
548
- * ```ts
549
- * import { Function } from "effect"
550
- * import * as assert from "node:assert"
551
- *
552
- * assert.deepStrictEqual(Function.constUndefined(), undefined)
553
- * ```
554
- *
555
- * @category constants
556
- * @since 2.0.0
557
- */
558
278
  const constUndefined = constant(void 0);
559
- /**
560
- * 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`.
561
- * The result is obtained by first applying the `ab` function to `a` and then applying the `bc` function to the result of `ab`.
562
- *
563
- * **When to use**
564
- *
565
- * Use to compose exactly two unary functions into a reusable unary function.
566
- *
567
- * **Example** (Composing two functions)
568
- *
569
- * ```ts
570
- * import { Function } from "effect"
571
- * import * as assert from "node:assert"
572
- *
573
- * const increment = (n: number) => n + 1
574
- * const square = (n: number) => n * n
575
- *
576
- * assert.strictEqual(Function.compose(increment, square)(2), 9)
577
- * ```
578
- *
579
- * @see {@link flow} for composing a left-to-right sequence of functions
580
- * @see {@link pipe} for applying a value through a left-to-right sequence immediately
581
- *
582
- * @category combinators
583
- * @since 2.0.0
584
- */
585
279
  const compose = dual(2, (ab, bc) => (a) => bc(ab(a)));
586
- /**
587
- * Marks an impossible branch by accepting a `never` value and returning any
588
- * type.
589
- *
590
- * **When to use**
591
- *
592
- * Use when you need a return value in a branch that exhaustive checks prove
593
- * cannot be reached.
594
- *
595
- * **Gotchas**
596
- *
597
- * Calling `absurd` throws, because a value of type `never` should be
598
- * impossible at runtime.
599
- *
600
- * **Example** (Handling impossible values)
601
- *
602
- * ```ts
603
- * import { absurd } from "effect"
604
- *
605
- * const handleNever = (value: never) => {
606
- * return absurd(value) // This will throw an error if called
607
- * }
608
- * ```
609
- *
610
- * @category utility types
611
- * @since 2.0.0
612
- */
613
280
  const absurd = (_) => {
614
281
  throw new Error("Called `absurd` function which should be uncallable");
615
282
  };
616
- /**
617
- * Creates a compile-time placeholder for a value of any type.
618
- *
619
- * **When to use**
620
- *
621
- * Use as a temporary typed placeholder while developing incomplete code.
622
- *
623
- * **Gotchas**
624
- *
625
- * `hole` is intended for temporary development use. If the placeholder is
626
- * evaluated at runtime, it throws.
627
- *
628
- * **Example** (Creating a development placeholder)
629
- *
630
- * ```ts
631
- * import { hole } from "effect"
632
- *
633
- * // Intentionally not called: `hole` throws if the placeholder is evaluated.
634
- * const buildUser = (id: number): { readonly id: number; readonly name: string } => ({
635
- * id,
636
- * name: hole<string>()
637
- * })
638
- *
639
- * console.log(typeof buildUser) // "function"
640
- * ```
641
- *
642
- * @category utility types
643
- * @since 2.0.0
644
- */
645
283
  const hole = cast(absurd);
646
- /**
647
- * Drops the longest prefix of elements from an array that satisfy the given predicate.
648
- *
649
- * Supports both data-first and data-last (`pipe`-friendly) call styles.
650
- *
651
- * @param pred - The predicate to test each element with.
652
- * @returns A new array without the matching prefix.
653
- * @example
654
- * ```ts
655
- * import * as assert from "node:assert"
656
- * import { dropWhile, pipe } from "@local/eff"
657
- *
658
- * // data-first
659
- * assert.deepStrictEqual(dropWhile([1, 2, 3, 2, 1], (n: number) => n < 3), [3, 2, 1])
660
- *
661
- * // data-last
662
- * assert.deepStrictEqual(pipe([1, 2, 3, 2, 1], dropWhile((n: number) => n < 3)), [3, 2, 1])
663
- * ```
664
- * @category array
665
- */
666
- const dropWhile = dual(2, (xs, pred) => {
667
- const len = xs.length;
284
+ const and = dual(2, (a, b) => (data) => a(data) && b(data));
285
+ const or = dual(2, (a, b) => (data) => a(data) || b(data));
286
+ const xor = dual(2, (a, b) => (data) => a(data) !== b(data));
287
+ const eqv = dual(2, (a, b) => (data) => a(data) === b(data));
288
+ const implies = dual(2, (antecedent, consequent) => (data) => !antecedent(data) || consequent(data));
289
+ const nor = dual(2, (a, b) => (data) => !a(data) && !b(data));
290
+ const nand = dual(2, (a, b) => (data) => !a(data) || !b(data));
291
+ function isString(input) {
292
+ return typeof input === "string";
293
+ }
294
+ function isFunction(input) {
295
+ return typeof input === "function";
296
+ }
297
+ function isObjectKeyword(input) {
298
+ return typeof input === "object" && input !== null || isFunction(input);
299
+ }
300
+ const hasProperty = dual(2, (data, property) => isObjectKeyword(data) && property in data);
301
+ const dropWhile = dual(2, (self, predicate) => {
302
+ const input = Array.isArray(self) ? self : Array.from(self);
303
+ const len = input.length;
668
304
  let idx = 0;
669
- while (idx < len && pred(xs[idx])) idx++;
670
- return xs.slice(idx);
305
+ while (idx < len && predicate(input[idx], idx)) idx++;
306
+ return input.slice(idx);
671
307
  });
672
- /**
673
- * Takes the longest prefix of elements from an array that satisfy the given predicate.
674
- *
675
- * Supports both data-first and data-last (`pipe`-friendly) call styles.
676
- *
677
- * @param pred - The predicate to test each element with.
678
- * @returns A new array containing only the matching prefix.
679
- * @example
680
- * ```ts
681
- * import * as assert from "node:assert"
682
- * import { pipe, takeWhile } from "@local/eff"
683
- *
684
- * // data-first
685
- * assert.deepStrictEqual(takeWhile([1, 2, 3, 2, 1], (n: number) => n < 3), [1, 2])
686
- *
687
- * // data-last
688
- * assert.deepStrictEqual(pipe([1, 2, 3, 2, 1], takeWhile((n: number) => n < 3)), [1, 2])
689
- * ```
690
- * @category array
691
- */
692
- const takeWhile = dual(2, (xs, pred) => {
693
- const len = xs.length;
308
+ const takeWhile = dual(2, (self, predicate) => {
309
+ const input = Array.isArray(self) ? self : Array.from(self);
310
+ const len = input.length;
694
311
  let idx = 0;
695
- while (idx < len && pred(xs[idx])) idx++;
696
- return xs.slice(0, idx);
312
+ while (idx < len && predicate(input[idx], idx)) idx++;
313
+ return input.slice(0, idx);
697
314
  });
698
315
 
699
316
  //#endregion
700
317
  //#region src/utils/create-jsx-element-resolver.ts
701
- /**
702
- * Creates a resolver for JSX elements that determines the underlying DOM element type.
703
- *
704
- * This resolver handles:
705
- * 1. Regular HTML elements (div, span, etc.)
706
- * 2. Polymorphic components (components that render as a different element via a prop,
707
- * ex: `<Box as="a">`). Only static string values of the polymorphic prop are
708
- * supported; `<Box as={Component}>` cannot be resolved statically and falls back
709
- * to the JSX element's own name.
710
- *
711
- * @param context The ESLint rule context
712
- * @returns An object with a resolve method to determine the element type
713
- */
714
318
  function createJsxElementResolver(context) {
715
319
  const { polymorphicPropName } = getSettingsFromContext(context);
716
- return {
717
- /**
718
- * Resolves the JSX element to determine its type and the underlying DOM element type
719
- *
720
- * @param node The JSX element node to resolve
721
- * @returns An object containing the JSX element type and DOM element type
722
- */
723
- resolve(node) {
320
+ return { resolve(node) {
724
321
  const elementName = getElementFullType(node);
725
322
  const result = {
726
323
  domElementType: elementName,
@@ -994,9 +591,6 @@ function create$5(context) {
994
591
 
995
592
  //#endregion
996
593
  //#region src/rules/no-unknown-property/lib.ts
997
- /**
998
- * Map of standard HTML attributes to their React counterparts
999
- */
1000
594
  const DOM_ATTRIBUTE_NAMES = {
1001
595
  "accept-charset": "acceptCharset",
1002
596
  class: "className",
@@ -1005,9 +599,6 @@ const DOM_ATTRIBUTE_NAMES = {
1005
599
  "http-equiv": "httpEquiv",
1006
600
  nomodule: "noModule"
1007
601
  };
1008
- /**
1009
- * Map of SVG attributes to their React camelCase equivalents
1010
- */
1011
602
  const SVGDOM_ATTRIBUTE_NAMES = {
1012
603
  "accent-height": "accentHeight",
1013
604
  "alignment-baseline": "alignmentBaseline",
@@ -1092,9 +683,6 @@ const SVGDOM_ATTRIBUTE_NAMES = {
1092
683
  "xml:lang": "xmlLang",
1093
684
  "xml:space": "xmlSpace"
1094
685
  };
1095
- /**
1096
- * Map of attributes that are only valid on specific HTML tags
1097
- */
1098
686
  const ATTRIBUTE_TAGS_MAP = {
1099
687
  abbr: ["th", "td"],
1100
688
  align: [
@@ -1240,9 +828,6 @@ const ATTRIBUTE_TAGS_MAP = {
1240
828
  webkitAllowFullScreen: ["iframe", "video"],
1241
829
  webkitDirectory: ["input"]
1242
830
  };
1243
- /**
1244
- * Single-word HTML/DOM properties
1245
- */
1246
831
  const DOM_PROPERTY_NAMES_ONE_WORD = [
1247
832
  "dir",
1248
833
  "draggable",
@@ -1435,9 +1020,6 @@ const DOM_PROPERTY_NAMES_ONE_WORD = [
1435
1020
  "security",
1436
1021
  "controls"
1437
1022
  ];
1438
- /**
1439
- * Multi-word (camelCase) HTML/DOM properties
1440
- */
1441
1023
  const DOM_PROPERTY_NAMES_TWO_WORDS = [
1442
1024
  "accessKey",
1443
1025
  "autoCapitalize",
@@ -1801,9 +1383,6 @@ const DOM_PROPERTY_NAMES_TWO_WORDS = [
1801
1383
  "disablePictureInPicture",
1802
1384
  "disableRemotePlayback"
1803
1385
  ];
1804
- /**
1805
- * DOM properties that are exempt from case sensitivity checks
1806
- */
1807
1386
  const DOM_PROPERTIES_IGNORE_CASE = [
1808
1387
  "charset",
1809
1388
  "allowFullScreen",
@@ -1811,9 +1390,6 @@ const DOM_PROPERTIES_IGNORE_CASE = [
1811
1390
  "mozAllowFullScreen",
1812
1391
  "webkitDirectory"
1813
1392
  ];
1814
- /**
1815
- * List of ARIA attributes
1816
- */
1817
1393
  const ARIA_PROPERTIES = [
1818
1394
  "aria-atomic",
1819
1395
  "aria-braillelabel",
@@ -1869,9 +1445,6 @@ const ARIA_PROPERTIES = [
1869
1445
  "aria-rowspan",
1870
1446
  "aria-setsize"
1871
1447
  ];
1872
- /**
1873
- * React-specific pointer event handlers added in React 16.4
1874
- */
1875
1448
  const REACT_ON_PROPS = [
1876
1449
  "onGotPointerCapture",
1877
1450
  "onGotPointerCaptureCapture",
@@ -1895,9 +1468,6 @@ const REACT_ON_PROPS = [
1895
1468
  "onPointerUp",
1896
1469
  "onPointerUpCapture"
1897
1470
  ];
1898
- /**
1899
- * Popover API properties added in React 19
1900
- */
1901
1471
  const POPOVER_API_PROPS = [
1902
1472
  "popover",
1903
1473
  "popoverTarget",
@@ -1906,9 +1476,6 @@ const POPOVER_API_PROPS = [
1906
1476
  "onBeforeToggle"
1907
1477
  ];
1908
1478
  const REACT_19_PROPS = [...POPOVER_API_PROPS];
1909
- /**
1910
- * Tag-specific attributes added in React 19
1911
- */
1912
1479
  const REACT_19_ATTRIBUTE_TAGS_MAP = {
1913
1480
  blocking: [
1914
1481
  "link",
@@ -1917,9 +1484,6 @@ const REACT_19_ATTRIBUTE_TAGS_MAP = {
1917
1484
  ],
1918
1485
  precedence: ["link", "style"]
1919
1486
  };
1920
- /**
1921
- * DOM properties added in React 19.3
1922
- */
1923
1487
  const REACT_19_3_PROPS = [
1924
1488
  "credentialless",
1925
1489
  "maskType",
@@ -1928,30 +1492,12 @@ const REACT_19_3_PROPS = [
1928
1492
  "onFullscreenError",
1929
1493
  "onFullscreenErrorCapture"
1930
1494
  ];
1931
- /**
1932
- * Tag-specific attributes added in React 19.3
1933
- */
1934
1495
  const REACT_19_3_ATTRIBUTE_TAGS_MAP = { credentialless: ["iframe"] };
1935
- /**
1936
- * SVG attribute mappings added in React 19.3
1937
- */
1938
1496
  const REACT_19_3_SVGDOM_ATTRIBUTE_NAMES = { "mask-type": "maskType" };
1939
- /**
1940
- * Tests React version against a comparator
1941
- * @param context ESLint context
1942
- * @param comparator Comparison operator
1943
- * @param version Version to compare against
1944
- * @returns Comparison result
1945
- */
1946
1497
  function testReactVersion(context, comparator, version) {
1947
1498
  const { version: localVersion } = getSettingsFromContext(context);
1948
1499
  return compare(localVersion, version, comparator);
1949
1500
  }
1950
- /**
1951
- * Gets all valid DOM property names based on React version
1952
- * @param context ESLint rule context
1953
- * @returns Array of valid DOM property names
1954
- */
1955
1501
  function getDOMPropertyNames(context) {
1956
1502
  const ALL_DOM_PROPERTY_NAMES = DOM_PROPERTY_NAMES_TWO_WORDS.concat(DOM_PROPERTY_NAMES_ONE_WORD);
1957
1503
  if (testReactVersion(context, "<=", "16.1.0")) {
@@ -1964,11 +1510,6 @@ function getDOMPropertyNames(context) {
1964
1510
  if (testReactVersion(context, ">=", "19.3.0")) ALL_DOM_PROPERTY_NAMES.push(...REACT_19_3_PROPS);
1965
1511
  return ALL_DOM_PROPERTY_NAMES;
1966
1512
  }
1967
- /**
1968
- * Gets the map of attributes to their allowed tags based on React version
1969
- * @param context ESLint rule context
1970
- * @returns Map of attributes to allowed tags
1971
- */
1972
1513
  function getAttributeTagsMap(context) {
1973
1514
  let attributeTagsMap = ATTRIBUTE_TAGS_MAP;
1974
1515
  if (testReactVersion(context, ">=", "19.0.0-rc.0")) attributeTagsMap = {
@@ -1981,80 +1522,32 @@ function getAttributeTagsMap(context) {
1981
1522
  };
1982
1523
  return attributeTagsMap;
1983
1524
  }
1984
- /**
1985
- * Check if a node's parent is a JSX tag that is written with lowercase letters,
1986
- * and is not a custom web component.
1987
- * @param childNode JSX element being tested
1988
- * @returns Whether the node is a valid HTML tag in JSX
1989
- */
1990
1525
  function isValidHTMLTagInJSX(childNode) {
1991
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");
1992
1527
  return false;
1993
1528
  }
1994
- /**
1995
- * Normalizes attribute names that should be case-insensitive
1996
- * @param name Attribute name to normalize
1997
- * @returns Normalized attribute name
1998
- */
1999
1529
  function normalizeAttributeCase(name) {
2000
1530
  return DOM_PROPERTIES_IGNORE_CASE.find((element) => element.toLowerCase() === name.toLowerCase()) ?? name;
2001
1531
  }
2002
- /**
2003
- * Check if an attribute name is a valid data-* attribute
2004
- * @param name Attribute name to test
2005
- * @returns Whether the attribute is a valid data attribute
2006
- */
2007
1532
  function isValidDataAttribute(name) {
2008
1533
  return !/^data-xml/i.test(name) && /^data-[^:]*$/.test(name);
2009
1534
  }
2010
- /**
2011
- * Check if an attribute name has uppercase characters
2012
- * @param name Attribute name to test
2013
- * @returns Whether the name has uppercase characters
2014
- */
2015
1535
  function hasUpperCaseCharacter(name) {
2016
1536
  return name.toLowerCase() !== name;
2017
1537
  }
2018
- /**
2019
- * Check if an attribute is a valid ARIA attribute
2020
- * @param name Attribute name to test
2021
- * @returns Whether the attribute is a valid ARIA attribute
2022
- */
2023
1538
  function isValidAriaAttribute(name) {
2024
1539
  return ARIA_PROPERTIES.some((element) => element === name);
2025
1540
  }
2026
- /**
2027
- * Gets the tag name for a JSXAttribute
2028
- * @param node JSXAttribute to get tag name from
2029
- * @returns Tag name or null
2030
- */
2031
1541
  function getTagName(node) {
2032
1542
  if (node.parent.name.type === AST_NODE_TYPES.JSXIdentifier) return node.parent.name.name;
2033
1543
  return null;
2034
1544
  }
2035
- /**
2036
- * Check if the tag name has a dot (member expression)
2037
- * @param node JSXAttribute to check
2038
- * @returns Whether the tag name has a dot
2039
- */
2040
1545
  function tagNameHasDot(node) {
2041
1546
  return node.parent.name.type === AST_NODE_TYPES.JSXMemberExpression;
2042
1547
  }
2043
- /**
2044
- * Check if an object has a property
2045
- * @param obj Object to check
2046
- * @param key Key to check for
2047
- * @returns Whether the object has the property
2048
- */
2049
1548
  function has(obj, key) {
2050
1549
  return Object.hasOwn(obj, key);
2051
1550
  }
2052
- /**
2053
- * Gets the standard name of an attribute
2054
- * @param name Attribute name
2055
- * @param context ESLint context
2056
- * @returns Standard name or undefined
2057
- */
2058
1551
  function getStandardName(name, context) {
2059
1552
  if (has(DOM_ATTRIBUTE_NAMES, name)) return DOM_ATTRIBUTE_NAMES[name] ?? null;
2060
1553
  const svgAttributeNames = testReactVersion(context, ">=", "19.3.0") ? {
@@ -2064,12 +1557,6 @@ function getStandardName(name, context) {
2064
1557
  if (has(svgAttributeNames, name)) return svgAttributeNames[name] ?? null;
2065
1558
  return getDOMPropertyNames(context).find((element) => element.toLowerCase() === name.toLowerCase()) ?? null;
2066
1559
  }
2067
- /**
2068
- * Gets text of a node
2069
- * @param context ESLint context
2070
- * @param node Node to get text from
2071
- * @returns Node's text
2072
- */
2073
1560
  function getText(context, node) {
2074
1561
  return context.sourceCode.getText(node);
2075
1562
  }
@@ -2213,22 +1700,10 @@ function create$3(context) {
2213
1700
 
2214
1701
  //#endregion
2215
1702
  //#region src/rules/no-unsafe-target-blank/lib.ts
2216
- /**
2217
- * Check if a value appears to be an external link.
2218
- * External links typically start with http(s):// or have protocol-relative format.
2219
- * @param value The value to check
2220
- * @returns Whether the value represents an external link
2221
- */
2222
1703
  function isExternalLinkLike(value) {
2223
1704
  if (!isString(value)) return false;
2224
1705
  return value.startsWith("https://") || /^(?:\w+:|\/\/)/u.test(value);
2225
1706
  }
2226
- /**
2227
- * Check if a rel prop value contains the necessary security attributes.
2228
- * At minimum, it should contain "noreferrer".
2229
- * @param value The rel prop value to check
2230
- * @returns Whether the rel value is considered secure
2231
- */
2232
1707
  function isSafeRel(value) {
2233
1708
  if (!isString(value)) return false;
2234
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.0",
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.0",
41
- "@eslint-react/eslint": "5.24.0",
42
- "@eslint-react/jsx": "5.24.0",
43
- "@eslint-react/shared": "5.24.0",
44
- "@eslint-react/var": "5.24.0",
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",
@@ -54,7 +54,7 @@
54
54
  "@types/react": "^19.3.0",
55
55
  "@types/react-dom": "^19.3.0",
56
56
  "dedent": "^1.7.2",
57
- "eslint": "^10.11.0",
57
+ "eslint": "^10.12.0",
58
58
  "tsdown": "^0.23.0",
59
59
  "typescript": "6.0.3"
60
60
  },