eslint-plugin-react-dom 2.0.0-next.153 → 2.0.0-next.155

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/dist/index.d.ts CHANGED
@@ -1,55 +1,15 @@
1
+ import * as _eslint_react_shared0 from "@eslint-react/shared";
1
2
  import { RulePreset } from "@eslint-react/kit";
2
- import * as _typescript_eslint_utils_ts_eslint0 from "@typescript-eslint/utils/ts-eslint";
3
- import { CamelCase } from "string-ts";
4
3
 
5
- //#region src/rules/no-missing-button-type.d.ts
6
- declare const RULE_NAME$2 = "no-missing-button-type";
7
- type MessageID$2 = CamelCase<typeof RULE_NAME$2> | RuleSuggestMessageID$2;
8
- type RuleSuggestMessageID$2 = "addButtonType";
9
- //#endregion
10
- //#region src/rules/no-missing-iframe-sandbox.d.ts
11
- declare const RULE_NAME$1 = "no-missing-iframe-sandbox";
12
- type MessageID$1 = CamelCase<typeof RULE_NAME$1> | RuleSuggestMessageID$1;
13
- type RuleSuggestMessageID$1 = "addIframeSandbox";
14
- //#endregion
15
- //#region src/rules/no-unsafe-target-blank.d.ts
16
- declare const RULE_NAME = "no-unsafe-target-blank";
17
- type MessageID = CamelCase<typeof RULE_NAME> | RuleSuggestMessageID;
18
- type RuleSuggestMessageID = "addRelNoreferrerNoopener";
19
- //#endregion
20
4
  //#region src/index.d.ts
21
5
  declare const _default: {
22
6
  configs: {
23
7
  recommended: {
24
8
  plugins: {
25
- "react-dom": {
26
- readonly meta: {
27
- readonly name: string;
28
- readonly version: string;
29
- };
30
- readonly rules: {
31
- readonly "no-dangerously-set-innerhtml": _typescript_eslint_utils_ts_eslint0.RuleModule<"noDangerouslySetInnerhtml", [], unknown, _typescript_eslint_utils_ts_eslint0.RuleListener>;
32
- readonly "no-dangerously-set-innerhtml-with-children": _typescript_eslint_utils_ts_eslint0.RuleModule<"noDangerouslySetInnerhtmlWithChildren", [], unknown, _typescript_eslint_utils_ts_eslint0.RuleListener>;
33
- readonly "no-find-dom-node": _typescript_eslint_utils_ts_eslint0.RuleModule<"noFindDomNode", [], unknown, _typescript_eslint_utils_ts_eslint0.RuleListener>;
34
- readonly "no-flush-sync": _typescript_eslint_utils_ts_eslint0.RuleModule<"noFlushSync", [], unknown, _typescript_eslint_utils_ts_eslint0.RuleListener>;
35
- readonly "no-hydrate": _typescript_eslint_utils_ts_eslint0.RuleModule<"noHydrate", [], unknown, _typescript_eslint_utils_ts_eslint0.RuleListener>;
36
- readonly "no-missing-button-type": _typescript_eslint_utils_ts_eslint0.RuleModule<MessageID$2, [], unknown, _typescript_eslint_utils_ts_eslint0.RuleListener>;
37
- readonly "no-missing-iframe-sandbox": _typescript_eslint_utils_ts_eslint0.RuleModule<MessageID$1, [], unknown, _typescript_eslint_utils_ts_eslint0.RuleListener>;
38
- readonly "no-namespace": _typescript_eslint_utils_ts_eslint0.RuleModule<"noNamespace", [], unknown, _typescript_eslint_utils_ts_eslint0.RuleListener>;
39
- readonly "no-render": _typescript_eslint_utils_ts_eslint0.RuleModule<"noRender", [], unknown, _typescript_eslint_utils_ts_eslint0.RuleListener>;
40
- readonly "no-render-return-value": _typescript_eslint_utils_ts_eslint0.RuleModule<"noRenderReturnValue", [], unknown, _typescript_eslint_utils_ts_eslint0.RuleListener>;
41
- readonly "no-script-url": _typescript_eslint_utils_ts_eslint0.RuleModule<"noScriptUrl", [], unknown, _typescript_eslint_utils_ts_eslint0.RuleListener>;
42
- readonly "no-string-style-prop": _typescript_eslint_utils_ts_eslint0.RuleModule<"noStringStyleProp", [], unknown, _typescript_eslint_utils_ts_eslint0.RuleListener>;
43
- readonly "no-unknown-property": _typescript_eslint_utils_ts_eslint0.RuleModule<"dataLowercaseRequired" | "invalidPropOnTag" | "unknownProp" | "unknownPropWithStandardName", unknown[], unknown, _typescript_eslint_utils_ts_eslint0.RuleListener>;
44
- readonly "no-unsafe-iframe-sandbox": _typescript_eslint_utils_ts_eslint0.RuleModule<"noUnsafeIframeSandbox", [], unknown, _typescript_eslint_utils_ts_eslint0.RuleListener>;
45
- readonly "no-unsafe-target-blank": _typescript_eslint_utils_ts_eslint0.RuleModule<MessageID, [], unknown, _typescript_eslint_utils_ts_eslint0.RuleListener>;
46
- readonly "no-use-form-state": _typescript_eslint_utils_ts_eslint0.RuleModule<"noUseFormState", [], unknown, _typescript_eslint_utils_ts_eslint0.RuleListener>;
47
- readonly "no-void-elements-with-children": _typescript_eslint_utils_ts_eslint0.RuleModule<"noVoidElementsWithChildren", [], unknown, _typescript_eslint_utils_ts_eslint0.RuleListener>;
48
- };
49
- };
9
+ "react-dom": _eslint_react_shared0.CompatiblePlugin;
50
10
  };
51
- name: string;
52
- rules: RulePreset;
11
+ name?: string;
12
+ rules?: Record<string, any>;
53
13
  };
54
14
  "recommended-legacy": {
55
15
  plugins: string[];
@@ -57,28 +17,10 @@ declare const _default: {
57
17
  };
58
18
  };
59
19
  meta: {
60
- readonly name: string;
61
- readonly version: string;
62
- };
63
- rules: {
64
- readonly "no-dangerously-set-innerhtml": _typescript_eslint_utils_ts_eslint0.RuleModule<"noDangerouslySetInnerhtml", [], unknown, _typescript_eslint_utils_ts_eslint0.RuleListener>;
65
- readonly "no-dangerously-set-innerhtml-with-children": _typescript_eslint_utils_ts_eslint0.RuleModule<"noDangerouslySetInnerhtmlWithChildren", [], unknown, _typescript_eslint_utils_ts_eslint0.RuleListener>;
66
- readonly "no-find-dom-node": _typescript_eslint_utils_ts_eslint0.RuleModule<"noFindDomNode", [], unknown, _typescript_eslint_utils_ts_eslint0.RuleListener>;
67
- readonly "no-flush-sync": _typescript_eslint_utils_ts_eslint0.RuleModule<"noFlushSync", [], unknown, _typescript_eslint_utils_ts_eslint0.RuleListener>;
68
- readonly "no-hydrate": _typescript_eslint_utils_ts_eslint0.RuleModule<"noHydrate", [], unknown, _typescript_eslint_utils_ts_eslint0.RuleListener>;
69
- readonly "no-missing-button-type": _typescript_eslint_utils_ts_eslint0.RuleModule<MessageID$2, [], unknown, _typescript_eslint_utils_ts_eslint0.RuleListener>;
70
- readonly "no-missing-iframe-sandbox": _typescript_eslint_utils_ts_eslint0.RuleModule<MessageID$1, [], unknown, _typescript_eslint_utils_ts_eslint0.RuleListener>;
71
- readonly "no-namespace": _typescript_eslint_utils_ts_eslint0.RuleModule<"noNamespace", [], unknown, _typescript_eslint_utils_ts_eslint0.RuleListener>;
72
- readonly "no-render": _typescript_eslint_utils_ts_eslint0.RuleModule<"noRender", [], unknown, _typescript_eslint_utils_ts_eslint0.RuleListener>;
73
- readonly "no-render-return-value": _typescript_eslint_utils_ts_eslint0.RuleModule<"noRenderReturnValue", [], unknown, _typescript_eslint_utils_ts_eslint0.RuleListener>;
74
- readonly "no-script-url": _typescript_eslint_utils_ts_eslint0.RuleModule<"noScriptUrl", [], unknown, _typescript_eslint_utils_ts_eslint0.RuleListener>;
75
- readonly "no-string-style-prop": _typescript_eslint_utils_ts_eslint0.RuleModule<"noStringStyleProp", [], unknown, _typescript_eslint_utils_ts_eslint0.RuleListener>;
76
- readonly "no-unknown-property": _typescript_eslint_utils_ts_eslint0.RuleModule<"dataLowercaseRequired" | "invalidPropOnTag" | "unknownProp" | "unknownPropWithStandardName", unknown[], unknown, _typescript_eslint_utils_ts_eslint0.RuleListener>;
77
- readonly "no-unsafe-iframe-sandbox": _typescript_eslint_utils_ts_eslint0.RuleModule<"noUnsafeIframeSandbox", [], unknown, _typescript_eslint_utils_ts_eslint0.RuleListener>;
78
- readonly "no-unsafe-target-blank": _typescript_eslint_utils_ts_eslint0.RuleModule<MessageID, [], unknown, _typescript_eslint_utils_ts_eslint0.RuleListener>;
79
- readonly "no-use-form-state": _typescript_eslint_utils_ts_eslint0.RuleModule<"noUseFormState", [], unknown, _typescript_eslint_utils_ts_eslint0.RuleListener>;
80
- readonly "no-void-elements-with-children": _typescript_eslint_utils_ts_eslint0.RuleModule<"noVoidElementsWithChildren", [], unknown, _typescript_eslint_utils_ts_eslint0.RuleListener>;
20
+ name: string;
21
+ version: string;
81
22
  };
23
+ rules: Record<string, any>;
82
24
  };
83
25
  //#endregion
84
26
  export { _default as default };
package/dist/index.js CHANGED
@@ -47,7 +47,7 @@ const settings = { "react-x": DEFAULT_ESLINT_REACT_SETTINGS };
47
47
  //#endregion
48
48
  //#region package.json
49
49
  var name = "eslint-plugin-react-dom";
50
- var version = "2.0.0-next.153";
50
+ var version = "2.0.0-next.155";
51
51
 
52
52
  //#endregion
53
53
  //#region src/utils/create-jsx-element-resolver.ts
@@ -706,6 +706,9 @@ const DEFAULTS = {
706
706
  ignore: [],
707
707
  requireDataLowercase: false
708
708
  };
709
+ /**
710
+ * Map of standard HTML attributes to their React counterparts
711
+ */
709
712
  const DOM_ATTRIBUTE_NAMES = {
710
713
  "accept-charset": "acceptCharset",
711
714
  class: "className",
@@ -714,6 +717,96 @@ const DOM_ATTRIBUTE_NAMES = {
714
717
  "http-equiv": "httpEquiv",
715
718
  nomodule: "noModule"
716
719
  };
720
+ /**
721
+ * Map of SVG attributes to their React camelCase equivalents
722
+ */
723
+ const SVGDOM_ATTRIBUTE_NAMES = {
724
+ "accent-height": "accentHeight",
725
+ "alignment-baseline": "alignmentBaseline",
726
+ "arabic-form": "arabicForm",
727
+ "baseline-shift": "baselineShift",
728
+ "cap-height": "capHeight",
729
+ "clip-path": "clipPath",
730
+ "clip-rule": "clipRule",
731
+ "color-interpolation": "colorInterpolation",
732
+ "color-interpolation-filters": "colorInterpolationFilters",
733
+ "color-profile": "colorProfile",
734
+ "color-rendering": "colorRendering",
735
+ "dominant-baseline": "dominantBaseline",
736
+ "enable-background": "enableBackground",
737
+ "fill-opacity": "fillOpacity",
738
+ "fill-rule": "fillRule",
739
+ "flood-color": "floodColor",
740
+ "flood-opacity": "floodOpacity",
741
+ "font-family": "fontFamily",
742
+ "font-size": "fontSize",
743
+ "font-size-adjust": "fontSizeAdjust",
744
+ "font-stretch": "fontStretch",
745
+ "font-style": "fontStyle",
746
+ "font-variant": "fontVariant",
747
+ "font-weight": "fontWeight",
748
+ "glyph-name": "glyphName",
749
+ "glyph-orientation-horizontal": "glyphOrientationHorizontal",
750
+ "glyph-orientation-vertical": "glyphOrientationVertical",
751
+ "horiz-adv-x": "horizAdvX",
752
+ "horiz-origin-x": "horizOriginX",
753
+ "image-rendering": "imageRendering",
754
+ "letter-spacing": "letterSpacing",
755
+ "lighting-color": "lightingColor",
756
+ "marker-end": "markerEnd",
757
+ "marker-mid": "markerMid",
758
+ "marker-start": "markerStart",
759
+ "overline-position": "overlinePosition",
760
+ "overline-thickness": "overlineThickness",
761
+ "paint-order": "paintOrder",
762
+ "panose-1": "panose1",
763
+ "pointer-events": "pointerEvents",
764
+ "rendering-intent": "renderingIntent",
765
+ "shape-rendering": "shapeRendering",
766
+ "stop-color": "stopColor",
767
+ "stop-opacity": "stopOpacity",
768
+ "strikethrough-position": "strikethroughPosition",
769
+ "strikethrough-thickness": "strikethroughThickness",
770
+ "stroke-dasharray": "strokeDasharray",
771
+ "stroke-dashoffset": "strokeDashoffset",
772
+ "stroke-linecap": "strokeLinecap",
773
+ "stroke-linejoin": "strokeLinejoin",
774
+ "stroke-miterlimit": "strokeMiterlimit",
775
+ "stroke-opacity": "strokeOpacity",
776
+ "stroke-width": "strokeWidth",
777
+ "text-anchor": "textAnchor",
778
+ "text-decoration": "textDecoration",
779
+ "text-rendering": "textRendering",
780
+ "underline-position": "underlinePosition",
781
+ "underline-thickness": "underlineThickness",
782
+ "unicode-bidi": "unicodeBidi",
783
+ "unicode-range": "unicodeRange",
784
+ "units-per-em": "unitsPerEm",
785
+ "v-alphabetic": "vAlphabetic",
786
+ "v-hanging": "vHanging",
787
+ "v-ideographic": "vIdeographic",
788
+ "v-mathematical": "vMathematical",
789
+ "vector-effect": "vectorEffect",
790
+ "vert-adv-y": "vertAdvY",
791
+ "vert-origin-x": "vertOriginX",
792
+ "vert-origin-y": "vertOriginY",
793
+ "word-spacing": "wordSpacing",
794
+ "writing-mode": "writingMode",
795
+ "x-height": "xHeight",
796
+ "xlink:actuate": "xlinkActuate",
797
+ "xlink:arcrole": "xlinkArcrole",
798
+ "xlink:href": "xlinkHref",
799
+ "xlink:role": "xlinkRole",
800
+ "xlink:show": "xlinkShow",
801
+ "xlink:title": "xlinkTitle",
802
+ "xlink:type": "xlinkType",
803
+ "xml:base": "xmlBase",
804
+ "xml:lang": "xmlLang",
805
+ "xml:space": "xmlSpace"
806
+ };
807
+ /**
808
+ * Map of attributes that are only valid on specific HTML tags
809
+ */
717
810
  const ATTRIBUTE_TAGS_MAP = {
718
811
  as: ["link"],
719
812
  abbr: ["th", "td"],
@@ -853,90 +946,9 @@ const ATTRIBUTE_TAGS_MAP = {
853
946
  webkitAllowFullScreen: ["iframe", "video"],
854
947
  webkitDirectory: ["input"]
855
948
  };
856
- const SVGDOM_ATTRIBUTE_NAMES = {
857
- "accent-height": "accentHeight",
858
- "alignment-baseline": "alignmentBaseline",
859
- "arabic-form": "arabicForm",
860
- "baseline-shift": "baselineShift",
861
- "cap-height": "capHeight",
862
- "clip-path": "clipPath",
863
- "clip-rule": "clipRule",
864
- "color-interpolation": "colorInterpolation",
865
- "color-interpolation-filters": "colorInterpolationFilters",
866
- "color-profile": "colorProfile",
867
- "color-rendering": "colorRendering",
868
- "dominant-baseline": "dominantBaseline",
869
- "enable-background": "enableBackground",
870
- "fill-opacity": "fillOpacity",
871
- "fill-rule": "fillRule",
872
- "flood-color": "floodColor",
873
- "flood-opacity": "floodOpacity",
874
- "font-family": "fontFamily",
875
- "font-size": "fontSize",
876
- "font-size-adjust": "fontSizeAdjust",
877
- "font-stretch": "fontStretch",
878
- "font-style": "fontStyle",
879
- "font-variant": "fontVariant",
880
- "font-weight": "fontWeight",
881
- "glyph-name": "glyphName",
882
- "glyph-orientation-horizontal": "glyphOrientationHorizontal",
883
- "glyph-orientation-vertical": "glyphOrientationVertical",
884
- "horiz-adv-x": "horizAdvX",
885
- "horiz-origin-x": "horizOriginX",
886
- "image-rendering": "imageRendering",
887
- "letter-spacing": "letterSpacing",
888
- "lighting-color": "lightingColor",
889
- "marker-end": "markerEnd",
890
- "marker-mid": "markerMid",
891
- "marker-start": "markerStart",
892
- "overline-position": "overlinePosition",
893
- "overline-thickness": "overlineThickness",
894
- "paint-order": "paintOrder",
895
- "panose-1": "panose1",
896
- "pointer-events": "pointerEvents",
897
- "rendering-intent": "renderingIntent",
898
- "shape-rendering": "shapeRendering",
899
- "stop-color": "stopColor",
900
- "stop-opacity": "stopOpacity",
901
- "strikethrough-position": "strikethroughPosition",
902
- "strikethrough-thickness": "strikethroughThickness",
903
- "stroke-dasharray": "strokeDasharray",
904
- "stroke-dashoffset": "strokeDashoffset",
905
- "stroke-linecap": "strokeLinecap",
906
- "stroke-linejoin": "strokeLinejoin",
907
- "stroke-miterlimit": "strokeMiterlimit",
908
- "stroke-opacity": "strokeOpacity",
909
- "stroke-width": "strokeWidth",
910
- "text-anchor": "textAnchor",
911
- "text-decoration": "textDecoration",
912
- "text-rendering": "textRendering",
913
- "underline-position": "underlinePosition",
914
- "underline-thickness": "underlineThickness",
915
- "unicode-bidi": "unicodeBidi",
916
- "unicode-range": "unicodeRange",
917
- "units-per-em": "unitsPerEm",
918
- "v-alphabetic": "vAlphabetic",
919
- "v-hanging": "vHanging",
920
- "v-ideographic": "vIdeographic",
921
- "v-mathematical": "vMathematical",
922
- "vector-effect": "vectorEffect",
923
- "vert-adv-y": "vertAdvY",
924
- "vert-origin-x": "vertOriginX",
925
- "vert-origin-y": "vertOriginY",
926
- "word-spacing": "wordSpacing",
927
- "writing-mode": "writingMode",
928
- "x-height": "xHeight",
929
- "xlink:actuate": "xlinkActuate",
930
- "xlink:arcrole": "xlinkArcrole",
931
- "xlink:href": "xlinkHref",
932
- "xlink:role": "xlinkRole",
933
- "xlink:show": "xlinkShow",
934
- "xlink:title": "xlinkTitle",
935
- "xlink:type": "xlinkType",
936
- "xml:base": "xmlBase",
937
- "xml:lang": "xmlLang",
938
- "xml:space": "xmlSpace"
939
- };
949
+ /**
950
+ * Single-word HTML/DOM properties
951
+ */
940
952
  const DOM_PROPERTY_NAMES_ONE_WORD = [
941
953
  "dir",
942
954
  "draggable",
@@ -1129,6 +1141,9 @@ const DOM_PROPERTY_NAMES_ONE_WORD = [
1129
1141
  "security",
1130
1142
  "controls"
1131
1143
  ];
1144
+ /**
1145
+ * Multi-word (camelCase) HTML/DOM properties
1146
+ */
1132
1147
  const DOM_PROPERTY_NAMES_TWO_WORDS = [
1133
1148
  "accessKey",
1134
1149
  "autoCapitalize",
@@ -1490,6 +1505,9 @@ const DOM_PROPERTY_NAMES_TWO_WORDS = [
1490
1505
  "disablePictureInPicture",
1491
1506
  "disableRemotePlayback"
1492
1507
  ];
1508
+ /**
1509
+ * DOM properties that are exempt from case sensitivity checks
1510
+ */
1493
1511
  const DOM_PROPERTIES_IGNORE_CASE = [
1494
1512
  "charset",
1495
1513
  "allowFullScreen",
@@ -1497,6 +1515,9 @@ const DOM_PROPERTIES_IGNORE_CASE = [
1497
1515
  "mozAllowFullScreen",
1498
1516
  "webkitDirectory"
1499
1517
  ];
1518
+ /**
1519
+ * List of ARIA attributes
1520
+ */
1500
1521
  const ARIA_PROPERTIES = [
1501
1522
  "aria-atomic",
1502
1523
  "aria-braillelabel",
@@ -1552,6 +1573,9 @@ const ARIA_PROPERTIES = [
1552
1573
  "aria-rowspan",
1553
1574
  "aria-setsize"
1554
1575
  ];
1576
+ /**
1577
+ * React-specific pointer event handlers added in React 16.4
1578
+ */
1555
1579
  const REACT_ON_PROPS = [
1556
1580
  "onGotPointerCapture",
1557
1581
  "onGotPointerCaptureCapture",
@@ -1575,6 +1599,9 @@ const REACT_ON_PROPS = [
1575
1599
  "onPointerUp",
1576
1600
  "onPointerUpCapture"
1577
1601
  ];
1602
+ /**
1603
+ * Popover API properties added in React 19
1604
+ */
1578
1605
  const POPOVER_API_PROPS = [
1579
1606
  "popover",
1580
1607
  "popoverTarget",
@@ -1582,6 +1609,11 @@ const POPOVER_API_PROPS = [
1582
1609
  "onToggle",
1583
1610
  "onBeforeToggle"
1584
1611
  ];
1612
+ /**
1613
+ * Gets all valid DOM property names based on React version
1614
+ * @param context - ESLint rule context
1615
+ * @returns Array of valid DOM property names
1616
+ */
1585
1617
  function getDOMPropertyNames(context) {
1586
1618
  const ALL_DOM_PROPERTY_NAMES = DOM_PROPERTY_NAMES_TWO_WORDS.concat(DOM_PROPERTY_NAMES_ONE_WORD);
1587
1619
  if (testReactVersion(context, "<=", "16.1.0")) {
@@ -1594,14 +1626,9 @@ function getDOMPropertyNames(context) {
1594
1626
  }
1595
1627
  /**
1596
1628
  * Checks if a node's parent is a JSX tag that is written with lowercase letters,
1597
- * and is not a custom web component. Custom web components have a hyphen in tag name,
1598
- * or have an `is="some-elem"` attribute.
1599
- *
1600
- * Note: does not check if a tag's parent against a list of standard HTML/DOM tags. For example,
1601
- * a `<fake>`'s child would return `true` because "fake" is written only with lowercase letters
1602
- * without a hyphen and does not have a `is="some-elem"` attribute.
1603
- * @param childNode - JSX element being tested.
1604
- * @returns Whether or not the node name match the JSX tag convention.
1629
+ * and is not a custom web component.
1630
+ * @param childNode - JSX element being tested
1631
+ * @returns Whether the node is a valid HTML tag in JSX
1605
1632
  */
1606
1633
  function isValidHTMLTagInJSX(childNode) {
1607
1634
  const tagConvention = /^[a-z][^-]*$/;
@@ -1609,70 +1636,59 @@ function isValidHTMLTagInJSX(childNode) {
1609
1636
  return false;
1610
1637
  }
1611
1638
  /**
1612
- * Checks if the attribute name is included in the attributes that are excluded
1613
- * from the camel casing.
1614
- *
1615
- * // returns 'charSet'
1616
- * @example normalizeAttributeCase('charset')
1617
- *
1618
- * Note - these exclusions are not made by React core team, but `eslint-plugin-react` community.
1619
- * @param name - Attribute name to be normalized
1620
- * @returns Result
1639
+ * Normalizes attribute names that should be case-insensitive
1640
+ * @param name - Attribute name to normalize
1641
+ * @returns Normalized attribute name
1621
1642
  */
1622
1643
  function normalizeAttributeCase(name$2) {
1623
1644
  return DOM_PROPERTIES_IGNORE_CASE.find((element) => element.toLowerCase() === name$2.toLowerCase()) || name$2;
1624
1645
  }
1625
1646
  /**
1626
- * Checks if an attribute name is a valid `data-*` attribute:
1627
- * if the name starts with "data-" and has alphanumeric words (browsers require lowercase, but React and TS lowercase them),
1628
- * not start with any casing of "xml", and separated by hyphens (-) (which is also called "kebab case" or "dash case"),
1629
- * then the attribute is a valid data attribute.
1630
- * @param name - Attribute name to be tested
1631
- * @returns Result
1647
+ * Checks if an attribute name is a valid data-* attribute
1648
+ * @param name - Attribute name to test
1649
+ * @returns Whether the attribute is a valid data attribute
1632
1650
  */
1633
1651
  function isValidDataAttribute(name$2) {
1634
1652
  return !/^data-xml/i.test(name$2) && /^data-[^:]*$/.test(name$2);
1635
1653
  }
1636
1654
  /**
1637
- * Checks if an attribute name has at least one uppercase characters
1638
- * @param name
1639
- * @returns Result
1655
+ * Checks if an attribute name has uppercase characters
1656
+ * @param name - Attribute name to test
1657
+ * @returns Whether the name has uppercase characters
1640
1658
  */
1641
1659
  function hasUpperCaseCharacter(name$2) {
1642
1660
  return name$2.toLowerCase() !== name$2;
1643
1661
  }
1644
1662
  /**
1645
- * Checks if an attribute name is a standard aria attribute by compering it to a list
1646
- * of standard aria property names
1647
- * @param {string} name - Attribute name to be tested
1648
- * @returns {boolean} Result
1663
+ * Checks if an attribute is a valid ARIA attribute
1664
+ * @param name - Attribute name to test
1665
+ * @returns Whether the attribute is a valid ARIA attribute
1649
1666
  */
1650
1667
  function isValidAriaAttribute(name$2) {
1651
1668
  return ARIA_PROPERTIES.some((element) => element === name$2);
1652
1669
  }
1653
1670
  /**
1654
- * Extracts the tag name for the JSXAttribute
1655
- * @param node - JSXAttribute being tested.
1656
- * @returns tag name
1671
+ * Gets the tag name for a JSXAttribute
1672
+ * @param node - JSXAttribute to get tag name from
1673
+ * @returns Tag name or null
1657
1674
  */
1658
1675
  function getTagName(node) {
1659
1676
  if (node?.parent?.name) return node.parent.name.name;
1660
1677
  return null;
1661
1678
  }
1662
1679
  /**
1663
- * Test wether the tag name for the JSXAttribute is
1664
- * something like <Foo.bar />
1665
- * @param node - JSXAttribute being tested.
1666
- * @returns result
1680
+ * Checks if the tag name has a dot (member expression)
1681
+ * @param node - JSXAttribute to check
1682
+ * @returns Whether the tag name has a dot
1667
1683
  */
1668
1684
  function tagNameHasDot(node) {
1669
1685
  return !!(node.parent?.name && node.parent.name.type === "JSXMemberExpression");
1670
1686
  }
1671
1687
  /**
1672
- * Get the standard name of the attribute.
1673
- * @param name - Name of the attribute.
1674
- * @param context - eslint context
1675
- * @returns The standard name of the attribute, or undefined if no standard name was found.
1688
+ * Gets the standard name of an attribute
1689
+ * @param name - Attribute name
1690
+ * @param context - ESLint context
1691
+ * @returns Standard name or undefined
1676
1692
  */
1677
1693
  function getStandardName(name$2, context) {
1678
1694
  if (has(DOM_ATTRIBUTE_NAMES, name$2)) return DOM_ATTRIBUTE_NAMES[name$2];
@@ -1680,6 +1696,35 @@ function getStandardName(name$2, context) {
1680
1696
  const names = getDOMPropertyNames(context);
1681
1697
  return names.find((element) => element.toLowerCase() === name$2.toLowerCase());
1682
1698
  }
1699
+ /**
1700
+ * Checks if an object has a property
1701
+ * @param obj - Object to check
1702
+ * @param key - Key to check for
1703
+ * @returns Whether the object has the property
1704
+ */
1705
+ function has(obj, key) {
1706
+ return Object.hasOwn(obj, key);
1707
+ }
1708
+ /**
1709
+ * Gets text of a node
1710
+ * @param context - ESLint context
1711
+ * @param node - Node to get text from
1712
+ * @returns Node's text
1713
+ */
1714
+ function getText(context, node) {
1715
+ return context.sourceCode.getText(node);
1716
+ }
1717
+ /**
1718
+ * Tests React version against a comparator
1719
+ * @param context - ESLint context
1720
+ * @param comparator - Comparison operator
1721
+ * @param version - Version to compare against
1722
+ * @returns Comparison result
1723
+ */
1724
+ function testReactVersion(context, comparator, version$1) {
1725
+ const { version: localVersion } = getSettingsFromContext(context);
1726
+ return compare(localVersion, version$1, comparator);
1727
+ }
1683
1728
  const messages = {
1684
1729
  dataLowercaseRequired: "React does not recognize data-* props with uppercase characters on a DOM element. Found '{{name}}', use '{{lowerCaseName}}' instead",
1685
1730
  invalidPropOnTag: "Invalid property '{{name}}' found on tag '{{tagName}}', but it is only allowed on: {{allowedTags}}",
@@ -1711,11 +1756,24 @@ var no_unknown_property_default = createRule({
1711
1756
  create: create$4,
1712
1757
  defaultOptions: []
1713
1758
  });
1759
+ /**
1760
+ * Create function for the ESLint rule
1761
+ * @param context - ESLint rule context
1762
+ * @returns Rule listener
1763
+ */
1714
1764
  function create$4(context) {
1715
1765
  const report = Reporter.make(context);
1766
+ /**
1767
+ * Gets the ignore configuration from rule options
1768
+ * @returns Array of attribute names to ignore
1769
+ */
1716
1770
  function getIgnoreConfig() {
1717
1771
  return context.options[0]?.ignore || DEFAULTS.ignore;
1718
1772
  }
1773
+ /**
1774
+ * Gets the requireDataLowercase option from rule options
1775
+ * @returns Whether data attributes must be lowercase
1776
+ */
1719
1777
  function getRequireDataLowercase() {
1720
1778
  return context.options[0] && typeof context.options[0].requireDataLowercase !== "undefined" ? !!context.options[0].requireDataLowercase : DEFAULTS.requireDataLowercase;
1721
1779
  }
@@ -1754,8 +1812,8 @@ function create$4(context) {
1754
1812
  return;
1755
1813
  }
1756
1814
  const standardName = getStandardName(name$2, context);
1757
- const hasStandardNameButIsNotUsed = standardName && standardName !== name$2;
1758
- const usesStandardName = standardName && standardName === name$2;
1815
+ const hasStandardNameButIsNotUsed = !!standardName && standardName !== name$2;
1816
+ const usesStandardName = !!standardName && standardName === name$2;
1759
1817
  if (usesStandardName) return;
1760
1818
  if (hasStandardNameButIsNotUsed) {
1761
1819
  report.send({
@@ -1778,16 +1836,6 @@ function create$4(context) {
1778
1836
  });
1779
1837
  } };
1780
1838
  }
1781
- function has(obj, key) {
1782
- return Object.hasOwn(obj, key);
1783
- }
1784
- function getText(context, node) {
1785
- return context.sourceCode.getText(node);
1786
- }
1787
- function testReactVersion(context, comparator, version$1) {
1788
- const { version: localVersion } = getSettingsFromContext(context);
1789
- return compare(localVersion, version$1, comparator);
1790
- }
1791
1839
 
1792
1840
  //#endregion
1793
1841
  //#region src/rules/no-unsafe-iframe-sandbox.ts
@@ -2050,13 +2098,13 @@ const plugin = {
2050
2098
 
2051
2099
  //#endregion
2052
2100
  //#region src/index.ts
2053
- function makeConfig(config) {
2101
+ function toFlatConfig(config) {
2054
2102
  return {
2055
2103
  ...config,
2056
2104
  plugins: { "react-dom": plugin }
2057
2105
  };
2058
2106
  }
2059
- function makeLegacyConfig({ rules: rules$1 }) {
2107
+ function toLegacyConfig({ rules: rules$1 }) {
2060
2108
  return {
2061
2109
  plugins: ["react-dom"],
2062
2110
  rules: rules$1
@@ -2065,8 +2113,8 @@ function makeLegacyConfig({ rules: rules$1 }) {
2065
2113
  var src_default = {
2066
2114
  ...plugin,
2067
2115
  configs: {
2068
- ["recommended"]: makeConfig(recommended_exports),
2069
- ["recommended-legacy"]: makeLegacyConfig(recommended_exports)
2116
+ ["recommended"]: toFlatConfig(recommended_exports),
2117
+ ["recommended-legacy"]: toLegacyConfig(recommended_exports)
2070
2118
  }
2071
2119
  };
2072
2120
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-react-dom",
3
- "version": "2.0.0-next.153",
3
+ "version": "2.0.0-next.155",
4
4
  "description": "ESLint React's ESLint plugin for React DOM related rules.",
5
5
  "keywords": [
6
6
  "react",
@@ -41,16 +41,16 @@
41
41
  "compare-versions": "^6.1.1",
42
42
  "string-ts": "^2.2.1",
43
43
  "ts-pattern": "^5.8.0",
44
- "@eslint-react/ast": "2.0.0-next.153",
45
- "@eslint-react/core": "2.0.0-next.153",
46
- "@eslint-react/eff": "2.0.0-next.153",
47
- "@eslint-react/kit": "2.0.0-next.153",
48
- "@eslint-react/shared": "2.0.0-next.153",
49
- "@eslint-react/var": "2.0.0-next.153"
44
+ "@eslint-react/ast": "2.0.0-next.155",
45
+ "@eslint-react/core": "2.0.0-next.155",
46
+ "@eslint-react/eff": "2.0.0-next.155",
47
+ "@eslint-react/kit": "2.0.0-next.155",
48
+ "@eslint-react/shared": "2.0.0-next.155",
49
+ "@eslint-react/var": "2.0.0-next.155"
50
50
  },
51
51
  "devDependencies": {
52
52
  "@types/react": "^19.1.12",
53
- "@types/react-dom": "^19.1.8",
53
+ "@types/react-dom": "^19.1.9",
54
54
  "tsdown": "^0.14.2",
55
55
  "@local/configs": "0.0.0"
56
56
  },
@@ -73,7 +73,7 @@
73
73
  "access": "public"
74
74
  },
75
75
  "scripts": {
76
- "build": "tsdown --dts-resolve",
76
+ "build": "tsdown",
77
77
  "lint:publish": "publint",
78
78
  "lint:ts": "tsc --noEmit"
79
79
  }