eslint-plugin-react-dom 2.0.0-next.175 → 2.0.0-next.177

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 +13 -25
  2. package/package.json +11 -11
package/dist/index.js CHANGED
@@ -46,7 +46,7 @@ const settings = { "react-x": DEFAULT_ESLINT_REACT_SETTINGS };
46
46
  //#endregion
47
47
  //#region package.json
48
48
  var name = "eslint-plugin-react-dom";
49
- var version = "2.0.0-next.175";
49
+ var version = "2.0.0-next.177";
50
50
 
51
51
  //#endregion
52
52
  //#region src/utils/create-jsx-element-resolver.ts
@@ -70,11 +70,9 @@ function createJsxElementResolver(context) {
70
70
  jsxElementType: elementName
71
71
  };
72
72
  if (elementName === elementName.toLowerCase() || polymorphicPropName == null) return result;
73
- const getAttribute = ER.getAttribute(context, node.openingElement.attributes, context.sourceCode.getScope(node));
74
- const polymorphicProp = getAttribute(polymorphicPropName);
73
+ const polymorphicProp = ER.getAttribute(context, node.openingElement.attributes, context.sourceCode.getScope(node))(polymorphicPropName);
75
74
  if (polymorphicProp != null) {
76
- const polymorphicPropValue = ER.resolveAttributeValue(context, polymorphicProp);
77
- const staticValue = polymorphicPropValue.toStatic(polymorphicPropName);
75
+ const staticValue = ER.resolveAttributeValue(context, polymorphicProp).toStatic(polymorphicPropName);
78
76
  if (typeof staticValue === "string") return {
79
77
  ...result,
80
78
  domElementType: staticValue
@@ -110,8 +108,7 @@ const dangerouslySetInnerHTML$1 = "dangerouslySetInnerHTML";
110
108
  function create$16(context) {
111
109
  if (!context.sourceCode.text.includes(dangerouslySetInnerHTML$1)) return {};
112
110
  return { JSXElement(node) {
113
- const getAttribute = ER.getAttribute(context, node.openingElement.attributes, context.sourceCode.getScope(node));
114
- const attribute = getAttribute(dangerouslySetInnerHTML$1);
111
+ const attribute = ER.getAttribute(context, node.openingElement.attributes, context.sourceCode.getScope(node))(dangerouslySetInnerHTML$1);
115
112
  if (attribute == null) return;
116
113
  context.report({
117
114
  messageId: "noDangerouslySetInnerhtml",
@@ -144,8 +141,7 @@ function create$15(context) {
144
141
  return { JSXElement(node) {
145
142
  const attributes = node.openingElement.attributes;
146
143
  const initialScope = context.sourceCode.getScope(node);
147
- const hasChildren = node.children.some(isSignificantChildren) || ER.hasAttribute(context, "children", attributes, initialScope);
148
- if (hasChildren && ER.hasAttribute(context, dangerouslySetInnerHTML, attributes, initialScope)) context.report({
144
+ if ((node.children.some(isSignificantChildren) || ER.hasAttribute(context, "children", attributes, initialScope)) && ER.hasAttribute(context, dangerouslySetInnerHTML, attributes, initialScope)) context.report({
149
145
  messageId: "noDangerouslySetInnerhtmlWithChildren",
150
146
  node
151
147
  });
@@ -353,8 +349,7 @@ function create$11(context) {
353
349
  return { JSXElement(node) {
354
350
  const { domElementType } = resolver.resolve(node);
355
351
  if (domElementType !== "button") return;
356
- const getAttribute = ER.getAttribute(context, node.openingElement.attributes, context.sourceCode.getScope(node));
357
- const typeAttribute = getAttribute("type");
352
+ const typeAttribute = ER.getAttribute(context, node.openingElement.attributes, context.sourceCode.getScope(node))("type");
358
353
  if (typeAttribute == null) {
359
354
  context.report({
360
355
  messageId: "noMissingButtonType",
@@ -411,8 +406,7 @@ function create$10(context) {
411
406
  return { JSXElement(node) {
412
407
  const { domElementType } = resolver.resolve(node);
413
408
  if (domElementType !== "iframe") return;
414
- const getAttribute = ER.getAttribute(context, node.openingElement.attributes, context.sourceCode.getScope(node));
415
- const sandboxAttribute = getAttribute("sandbox");
409
+ const sandboxAttribute = ER.getAttribute(context, node.openingElement.attributes, context.sourceCode.getScope(node))("sandbox");
416
410
  if (sandboxAttribute == null) {
417
411
  context.report({
418
412
  messageId: "noMissingIframeSandbox",
@@ -655,8 +649,7 @@ var no_string_style_prop_default = createRule({
655
649
  function create$5(context) {
656
650
  return { JSXElement(node) {
657
651
  if (!ER.isHostElement(context, node)) return;
658
- const getAttribute = ER.getAttribute(context, node.openingElement.attributes, context.sourceCode.getScope(node));
659
- const attribute = getAttribute("style");
652
+ const attribute = ER.getAttribute(context, node.openingElement.attributes, context.sourceCode.getScope(node))("style");
660
653
  if (attribute == null) return;
661
654
  const attributeValue = ER.resolveAttributeValue(context, attribute);
662
655
  if (typeof attributeValue.toStatic() === "string") context.report({
@@ -1598,8 +1591,7 @@ function getDOMPropertyNames(context) {
1598
1591
  * @returns Whether the node is a valid HTML tag in JSX
1599
1592
  */
1600
1593
  function isValidHTMLTagInJSX(childNode) {
1601
- const tagConvention = /^[a-z][^-]*$/;
1602
- if (tagConvention.test(childNode.parent.name.name)) return !childNode.parent.attributes.some((attrNode) => attrNode.type === "JSXAttribute" && attrNode.name.type === "JSXIdentifier" && attrNode.name.name === "is");
1594
+ 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");
1603
1595
  return false;
1604
1596
  }
1605
1597
  /**
@@ -1660,8 +1652,7 @@ function tagNameHasDot(node) {
1660
1652
  function getStandardName(name$2, context) {
1661
1653
  if (has(DOM_ATTRIBUTE_NAMES, name$2)) return DOM_ATTRIBUTE_NAMES[name$2];
1662
1654
  if (has(SVGDOM_ATTRIBUTE_NAMES, name$2)) return SVGDOM_ATTRIBUTE_NAMES[name$2];
1663
- const names = getDOMPropertyNames(context);
1664
- return names.find((element) => element.toLowerCase() === name$2.toLowerCase());
1655
+ return getDOMPropertyNames(context).find((element) => element.toLowerCase() === name$2.toLowerCase());
1665
1656
  }
1666
1657
  /**
1667
1658
  * Checks if an object has a property
@@ -1780,8 +1771,7 @@ function create$4(context) {
1780
1771
  }
1781
1772
  const standardName = getStandardName(name$2, context);
1782
1773
  const hasStandardNameButIsNotUsed = !!standardName && standardName !== name$2;
1783
- const usesStandardName = !!standardName && standardName === name$2;
1784
- if (usesStandardName) return;
1774
+ if (!!standardName && standardName === name$2) return;
1785
1775
  if (hasStandardNameButIsNotUsed) {
1786
1776
  report.send({
1787
1777
  node,
@@ -1834,8 +1824,7 @@ function create$3(context) {
1834
1824
  return { JSXElement(node) {
1835
1825
  const { domElementType } = resolver.resolve(node);
1836
1826
  if (domElementType !== "iframe") return;
1837
- const getAttribute = ER.getAttribute(context, node.openingElement.attributes, context.sourceCode.getScope(node));
1838
- const sandboxAttribute = getAttribute("sandbox");
1827
+ const sandboxAttribute = ER.getAttribute(context, node.openingElement.attributes, context.sourceCode.getScope(node))("sandbox");
1839
1828
  if (sandboxAttribute == null) return;
1840
1829
  const sandboxValue = ER.resolveAttributeValue(context, sandboxAttribute);
1841
1830
  const sandboxValueStatic = sandboxValue.toStatic("sandbox");
@@ -1897,8 +1886,7 @@ function create$2(context) {
1897
1886
  const getAttributes = ER.getAttribute(context, node.openingElement.attributes, context.sourceCode.getScope(node));
1898
1887
  const targetAttribute = getAttributes("target");
1899
1888
  if (targetAttribute == null) return;
1900
- const targetAttributeValue = ER.resolveAttributeValue(context, targetAttribute).toStatic("target");
1901
- if (targetAttributeValue !== "_blank") return;
1889
+ if (ER.resolveAttributeValue(context, targetAttribute).toStatic("target") !== "_blank") return;
1902
1890
  const hrefAttribute = getAttributes("href");
1903
1891
  if (hrefAttribute == null) return;
1904
1892
  const hrefAttributeValue = ER.resolveAttributeValue(context, hrefAttribute).toStatic("href");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-react-dom",
3
- "version": "2.0.0-next.175",
3
+ "version": "2.0.0-next.177",
4
4
  "description": "ESLint React's ESLint plugin for React DOM related rules.",
5
5
  "keywords": [
6
6
  "react",
@@ -35,23 +35,23 @@
35
35
  "./package.json"
36
36
  ],
37
37
  "dependencies": {
38
- "@typescript-eslint/scope-manager": "^8.42.0",
39
- "@typescript-eslint/types": "^8.42.0",
40
- "@typescript-eslint/utils": "^8.42.0",
38
+ "@typescript-eslint/scope-manager": "^8.43.0",
39
+ "@typescript-eslint/types": "^8.43.0",
40
+ "@typescript-eslint/utils": "^8.43.0",
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.175",
45
- "@eslint-react/core": "2.0.0-next.175",
46
- "@eslint-react/eff": "2.0.0-next.175",
47
- "@eslint-react/kit": "2.0.0-next.175",
48
- "@eslint-react/shared": "2.0.0-next.175",
49
- "@eslint-react/var": "2.0.0-next.175"
44
+ "@eslint-react/ast": "2.0.0-next.177",
45
+ "@eslint-react/core": "2.0.0-next.177",
46
+ "@eslint-react/eff": "2.0.0-next.177",
47
+ "@eslint-react/shared": "2.0.0-next.177",
48
+ "@eslint-react/kit": "2.0.0-next.177",
49
+ "@eslint-react/var": "2.0.0-next.177"
50
50
  },
51
51
  "devDependencies": {
52
52
  "@types/react": "^19.1.12",
53
53
  "@types/react-dom": "^19.1.9",
54
- "tsdown": "^0.14.2",
54
+ "tsdown": "^0.15.0",
55
55
  "@local/configs": "0.0.0"
56
56
  },
57
57
  "peerDependencies": {