eslint-plugin-react-dom 2.0.0-next.165 → 2.0.0-next.167

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 +9 -15
  2. package/package.json +7 -7
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.165";
50
+ var version = "2.0.0-next.167";
51
51
 
52
52
  //#endregion
53
53
  //#region src/utils/create-jsx-element-resolver.ts
@@ -686,25 +686,19 @@ var no_string_style_prop_default = createRule({
686
686
  defaultOptions: []
687
687
  });
688
688
  function create$5(context) {
689
- return { JSXAttribute(node) {
690
- if (node.name.name !== "style") return;
691
- const styleText = getAttributeValueText(context, node.value);
692
- if (styleText == null) return;
689
+ const resolver = createJsxElementResolver(context);
690
+ return { JSXElement(node) {
691
+ const { attributes } = resolver.resolve(node);
692
+ const { attribute, attributeName, attributeValue, attributeValueString } = resolveAttribute(context, attributes, node, "style");
693
+ if (attributeName !== "style") return;
694
+ if (attribute == null || attributeValue?.node == null) return;
695
+ if (attributeValueString == null) return;
693
696
  context.report({
694
697
  messageId: "noStringStyleProp",
695
- node
698
+ node: attributeValue.node
696
699
  });
697
700
  } };
698
701
  }
699
- function getAttributeValueText(context, node) {
700
- if (node == null) return null;
701
- switch (true) {
702
- case node.type === AST_NODE_TYPES.Literal && typeof node.value === "string": return context.sourceCode.getText(node);
703
- case node.type === AST_NODE_TYPES.JSXExpressionContainer && node.expression.type === AST_NODE_TYPES.Literal && typeof node.expression.value === "string": return context.sourceCode.getText(node.expression);
704
- case node.type === AST_NODE_TYPES.JSXExpressionContainer && node.expression.type === AST_NODE_TYPES.TemplateLiteral: return context.sourceCode.getText(node.expression);
705
- default: return null;
706
- }
707
- }
708
702
 
709
703
  //#endregion
710
704
  //#region src/rules/no-unknown-property.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-react-dom",
3
- "version": "2.0.0-next.165",
3
+ "version": "2.0.0-next.167",
4
4
  "description": "ESLint React's ESLint plugin for React DOM related rules.",
5
5
  "keywords": [
6
6
  "react",
@@ -41,12 +41,12 @@
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.165",
45
- "@eslint-react/eff": "2.0.0-next.165",
46
- "@eslint-react/kit": "2.0.0-next.165",
47
- "@eslint-react/core": "2.0.0-next.165",
48
- "@eslint-react/shared": "2.0.0-next.165",
49
- "@eslint-react/var": "2.0.0-next.165"
44
+ "@eslint-react/ast": "2.0.0-next.167",
45
+ "@eslint-react/eff": "2.0.0-next.167",
46
+ "@eslint-react/kit": "2.0.0-next.167",
47
+ "@eslint-react/core": "2.0.0-next.167",
48
+ "@eslint-react/shared": "2.0.0-next.167",
49
+ "@eslint-react/var": "2.0.0-next.167"
50
50
  },
51
51
  "devDependencies": {
52
52
  "@types/react": "^19.1.12",