eslint-plugin-react-dom 2.0.5-next.1 → 2.0.5-next.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.
- package/dist/index.js +8 -16
- package/package.json +8 -8
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.5-next.
|
|
50
|
+
var version = "2.0.5-next.2";
|
|
51
51
|
|
|
52
52
|
//#endregion
|
|
53
53
|
//#region src/utils/create-jsx-element-resolver.ts
|
|
@@ -129,7 +129,7 @@ var no_dangerously_set_innerhtml_with_children_default = createRule({
|
|
|
129
129
|
description: "Disallow `dangerouslySetInnerHTML` and `children` at the same time.",
|
|
130
130
|
[Symbol.for("rule_features")]: RULE_FEATURES$15
|
|
131
131
|
},
|
|
132
|
-
messages: { noDangerouslySetInnerhtmlWithChildren: "A DOM component cannot use both
|
|
132
|
+
messages: { noDangerouslySetInnerhtmlWithChildren: "A DOM component cannot use both children and 'dangerouslySetInnerHTML'." },
|
|
133
133
|
schema: []
|
|
134
134
|
},
|
|
135
135
|
name: RULE_NAME$16,
|
|
@@ -146,24 +146,16 @@ function isSignificantChildren(node) {
|
|
|
146
146
|
if (!isJsxText(node)) return true;
|
|
147
147
|
return !(node.raw.trim() === "" && node.raw.includes("\n"));
|
|
148
148
|
}
|
|
149
|
-
/**
|
|
150
|
-
* Checks if a JSX element has children, either through the `children` prop or as JSX children.
|
|
151
|
-
* @param context The rule context.
|
|
152
|
-
* @param node The JSX element to check.
|
|
153
|
-
* @returns `true` if the element has children, `false` otherwise.
|
|
154
|
-
*/
|
|
155
|
-
function hasChildren(context, node) {
|
|
156
|
-
if (getJsxAttribute(context, node.openingElement.attributes, context.sourceCode.getScope(node))("children") != null) return true;
|
|
157
|
-
return node.children.some(isSignificantChildren);
|
|
158
|
-
}
|
|
159
149
|
function create$16(context) {
|
|
160
150
|
if (!context.sourceCode.text.includes(DSIH)) return {};
|
|
161
151
|
return { JSXElement(node) {
|
|
162
|
-
const
|
|
163
|
-
if (
|
|
164
|
-
|
|
152
|
+
const findJsxAttribute = getJsxAttribute(context, node.openingElement.attributes, context.sourceCode.getScope(node));
|
|
153
|
+
if (findJsxAttribute(DSIH) == null) return;
|
|
154
|
+
const children = findJsxAttribute("children") ?? node.children.find(isSignificantChildren);
|
|
155
|
+
if (children == null) return;
|
|
156
|
+
context.report({
|
|
165
157
|
messageId: "noDangerouslySetInnerhtmlWithChildren",
|
|
166
|
-
node:
|
|
158
|
+
node: children
|
|
167
159
|
});
|
|
168
160
|
} };
|
|
169
161
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-react-dom",
|
|
3
|
-
"version": "2.0.5-next.
|
|
3
|
+
"version": "2.0.5-next.2",
|
|
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/
|
|
45
|
-
"@eslint-react/kit": "2.0.5-next.
|
|
46
|
-
"@eslint-react/
|
|
47
|
-
"@eslint-react/
|
|
48
|
-
"@eslint-react/
|
|
49
|
-
"@eslint-react/
|
|
44
|
+
"@eslint-react/core": "2.0.5-next.2",
|
|
45
|
+
"@eslint-react/kit": "2.0.5-next.2",
|
|
46
|
+
"@eslint-react/shared": "2.0.5-next.2",
|
|
47
|
+
"@eslint-react/var": "2.0.5-next.2",
|
|
48
|
+
"@eslint-react/ast": "2.0.5-next.2",
|
|
49
|
+
"@eslint-react/eff": "2.0.5-next.2"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"@types/react": "^19.1.16",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
},
|
|
57
57
|
"peerDependencies": {
|
|
58
58
|
"eslint": "^9.36.0",
|
|
59
|
-
"typescript": "^5.9.
|
|
59
|
+
"typescript": "^5.9.3"
|
|
60
60
|
},
|
|
61
61
|
"engines": {
|
|
62
62
|
"node": ">=20.19.0"
|