eslint-plugin-react-dom 2.12.3-next.0 → 2.12.3-next.1

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 +18 -17
  2. package/package.json +6 -6
package/dist/index.js CHANGED
@@ -23,7 +23,7 @@ var __exportAll = (all, no_symbols) => {
23
23
  //#endregion
24
24
  //#region package.json
25
25
  var name$2 = "eslint-plugin-react-dom";
26
- var version = "2.12.3-next.0";
26
+ var version = "2.12.3-next.1";
27
27
 
28
28
  //#endregion
29
29
  //#region src/utils/create-jsx-element-resolver.ts
@@ -748,9 +748,9 @@ const ATTRIBUTE_TAGS_MAP = {
748
748
  muted: ["audio", "video"],
749
749
  noModule: ["script"],
750
750
  onAbort: ["audio", "video"],
751
+ onCancel: ["dialog"],
751
752
  onCanPlay: ["audio", "video"],
752
753
  onCanPlayThrough: ["audio", "video"],
753
- onCancel: ["dialog"],
754
754
  onClose: ["dialog"],
755
755
  onDurationChange: ["audio", "video"],
756
756
  onEmptied: ["audio", "video"],
@@ -775,9 +775,9 @@ const ATTRIBUTE_TAGS_MAP = {
775
775
  "object",
776
776
  "source"
777
777
  ],
778
- onLoadStart: ["audio", "video"],
779
778
  onLoadedData: ["audio", "video"],
780
779
  onLoadedMetadata: ["audio", "video"],
780
+ onLoadStart: ["audio", "video"],
781
781
  onPause: ["audio", "video"],
782
782
  onPlay: ["audio", "video"],
783
783
  onPlaying: ["audio", "video"],
@@ -1492,7 +1492,8 @@ function getDOMPropertyNames(context) {
1492
1492
  return ALL_DOM_PROPERTY_NAMES;
1493
1493
  }
1494
1494
  if (testReactVersion(context, ">=", "16.4.0")) ALL_DOM_PROPERTY_NAMES.push(...REACT_ON_PROPS);
1495
- testReactVersion(context, ">=", "19.0.0-rc.0") ? ALL_DOM_PROPERTY_NAMES.push(...POPOVER_API_PROPS) : ALL_DOM_PROPERTY_NAMES.push(...POPOVER_API_PROPS.map((prop) => prop.toLowerCase()));
1495
+ if (testReactVersion(context, ">=", "19.0.0-rc.0")) ALL_DOM_PROPERTY_NAMES.push(...POPOVER_API_PROPS);
1496
+ else ALL_DOM_PROPERTY_NAMES.push(...POPOVER_API_PROPS.map((prop) => prop.toLowerCase()));
1496
1497
  return ALL_DOM_PROPERTY_NAMES;
1497
1498
  }
1498
1499
  /**
@@ -1502,7 +1503,7 @@ function getDOMPropertyNames(context) {
1502
1503
  * @returns Whether the node is a valid HTML tag in JSX
1503
1504
  */
1504
1505
  function isValidHTMLTagInJSX(childNode) {
1505
- if (/^[a-z][^-]*$/.test(childNode.parent.name.name)) return !childNode.parent.attributes.some((attrNode) => attrNode.type === "JSXAttribute" && attrNode.name.type === "JSXIdentifier" && attrNode.name.name === "is");
1506
+ 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");
1506
1507
  return false;
1507
1508
  }
1508
1509
  /**
@@ -1511,7 +1512,7 @@ function isValidHTMLTagInJSX(childNode) {
1511
1512
  * @returns Normalized attribute name
1512
1513
  */
1513
1514
  function normalizeAttributeCase(name) {
1514
- return DOM_PROPERTIES_IGNORE_CASE.find((element) => element.toLowerCase() === name.toLowerCase()) || name;
1515
+ return DOM_PROPERTIES_IGNORE_CASE.find((element) => element.toLowerCase() === name.toLowerCase()) ?? name;
1515
1516
  }
1516
1517
  /**
1517
1518
  * Check if an attribute name is a valid data-* attribute
@@ -1543,7 +1544,7 @@ function isValidAriaAttribute(name) {
1543
1544
  * @returns Tag name or null
1544
1545
  */
1545
1546
  function getTagName(node) {
1546
- if (node?.parent?.name) return node.parent.name.name;
1547
+ if (node.parent.name.type === AST_NODE_TYPES.JSXIdentifier) return node.parent.name.name;
1547
1548
  return null;
1548
1549
  }
1549
1550
  /**
@@ -1552,7 +1553,7 @@ function getTagName(node) {
1552
1553
  * @returns Whether the tag name has a dot
1553
1554
  */
1554
1555
  function tagNameHasDot(node) {
1555
- return !!(node.parent?.name && node.parent.name.type === "JSXMemberExpression");
1556
+ return node.parent.name.type === AST_NODE_TYPES.JSXMemberExpression;
1556
1557
  }
1557
1558
  /**
1558
1559
  * Gets the standard name of an attribute
@@ -1636,14 +1637,14 @@ function create$5(context) {
1636
1637
  * @returns Array of attribute names to ignore
1637
1638
  */
1638
1639
  function getIgnoreConfig() {
1639
- return context.options[0]?.ignore || DEFAULTS.ignore;
1640
+ return context.options[0]?.ignore ?? DEFAULTS.ignore;
1640
1641
  }
1641
1642
  /**
1642
1643
  * Gets the requireDataLowercase option from rule options
1643
1644
  * @returns Whether data attributes must be lowercase
1644
1645
  */
1645
1646
  function getRequireDataLowercase() {
1646
- return context.options[0] && typeof context.options[0].requireDataLowercase !== "undefined" ? !!context.options[0].requireDataLowercase : DEFAULTS.requireDataLowercase;
1647
+ return context.options[0]?.requireDataLowercase ?? DEFAULTS.requireDataLowercase;
1647
1648
  }
1648
1649
  return { JSXAttribute(node) {
1649
1650
  const ignoreNames = getIgnoreConfig();
@@ -1653,8 +1654,8 @@ function create$5(context) {
1653
1654
  if (tagNameHasDot(node)) return;
1654
1655
  if (isValidDataAttribute(name)) {
1655
1656
  if (getRequireDataLowercase() && hasUpperCaseCharacter(name)) context.report({
1656
- node,
1657
1657
  messageId: "dataLowercaseRequired",
1658
+ node,
1658
1659
  data: {
1659
1660
  name: actualName,
1660
1661
  lowerCaseName: actualName.toLowerCase()
@@ -1667,10 +1668,10 @@ function create$5(context) {
1667
1668
  if (tagName === "fbt" || tagName === "fbs") return;
1668
1669
  if (!isValidHTMLTagInJSX(node)) return;
1669
1670
  const allowedTags = has(ATTRIBUTE_TAGS_MAP, name) ? ATTRIBUTE_TAGS_MAP[name] : null;
1670
- if (tagName && allowedTags) {
1671
+ if (tagName != null && allowedTags != null) {
1671
1672
  if (allowedTags.indexOf(tagName) === -1) context.report({
1672
- node,
1673
1673
  messageId: "invalidPropOnTag",
1674
+ node,
1674
1675
  data: {
1675
1676
  name: actualName,
1676
1677
  allowedTags: allowedTags.join(", "),
@@ -1680,12 +1681,12 @@ function create$5(context) {
1680
1681
  return;
1681
1682
  }
1682
1683
  const standardName = getStandardName(name, context);
1683
- const hasStandardNameButIsNotUsed = !!standardName && standardName !== name;
1684
- if (!!standardName && standardName === name) return;
1684
+ const hasStandardNameButIsNotUsed = standardName != null && standardName !== name;
1685
+ if (standardName != null && standardName === name) return;
1685
1686
  if (hasStandardNameButIsNotUsed) {
1686
1687
  context.report({
1687
- node,
1688
1688
  messageId: "unknownPropWithStandardName",
1689
+ node,
1689
1690
  data: {
1690
1691
  name: actualName,
1691
1692
  standardName
@@ -1697,8 +1698,8 @@ function create$5(context) {
1697
1698
  return;
1698
1699
  }
1699
1700
  context.report({
1700
- node,
1701
1701
  messageId: "unknownProp",
1702
+ node,
1702
1703
  data: { name: actualName }
1703
1704
  });
1704
1705
  } };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-react-dom",
3
- "version": "2.12.3-next.0",
3
+ "version": "2.12.3-next.1",
4
4
  "description": "ESLint React's ESLint plugin for DOM related rules.",
5
5
  "keywords": [
6
6
  "react",
@@ -43,11 +43,11 @@
43
43
  "@typescript-eslint/utils": "^8.54.0",
44
44
  "compare-versions": "^6.1.1",
45
45
  "ts-pattern": "^5.9.0",
46
- "@eslint-react/ast": "2.12.3-next.0",
47
- "@eslint-react/core": "2.12.3-next.0",
48
- "@eslint-react/eff": "2.12.3-next.0",
49
- "@eslint-react/shared": "2.12.3-next.0",
50
- "@eslint-react/var": "2.12.3-next.0"
46
+ "@eslint-react/ast": "2.12.3-next.1",
47
+ "@eslint-react/eff": "2.12.3-next.1",
48
+ "@eslint-react/shared": "2.12.3-next.1",
49
+ "@eslint-react/var": "2.12.3-next.1",
50
+ "@eslint-react/core": "2.12.3-next.1"
51
51
  },
52
52
  "devDependencies": {
53
53
  "@types/react": "^19.2.13",