eslint-plugin-react-dom
Advanced tools
Comparing version
@@ -5,3 +5,2 @@ import { getDocsUrl, getSettingsFromContext, DEFAULT_ESLINT_REACT_SETTINGS } from '@eslint-react/shared'; | ||
import { unit } from '@eslint-react/eff'; | ||
import * as AST from '@eslint-react/ast'; | ||
import { AST_NODE_TYPES } from '@typescript-eslint/types'; | ||
@@ -48,3 +47,3 @@ import { compare } from 'compare-versions'; | ||
var name2 = "eslint-plugin-react-dom"; | ||
var version = "2.0.0-next.120"; | ||
var version = "2.0.0-next.121"; | ||
function createJsxElementResolver(context) { | ||
@@ -191,3 +190,3 @@ const { components, polymorphicPropName } = getSettingsFromContext(context); | ||
const initialScope = context.sourceCode.getScope(node); | ||
const hasChildren = hasChildrenWithin(node) || ER.hasAttribute(context, "children", attributes, initialScope); | ||
const hasChildren = node.children.some(isSignificantChildren) || ER.hasAttribute(context, "children", attributes, initialScope); | ||
if (hasChildren && ER.hasAttribute(context, dangerouslySetInnerHTML2, attributes, initialScope)) { | ||
@@ -202,5 +201,11 @@ context.report({ | ||
} | ||
function hasChildrenWithin(node) { | ||
return node.children.length > 0 && node.children[0] != null && !AST.isLineBreak(node.children[0]); | ||
function isWhiteSpace(node) { | ||
return typeof node.value === "string" && node.raw.trim() === ""; | ||
} | ||
function isPaddingSpaces(node) { | ||
return ER.isJsxText(node) && isWhiteSpace(node) && node.raw.includes("\n"); | ||
} | ||
function isSignificantChildren(node) { | ||
return node.type !== AST_NODE_TYPES.JSXText || !isPaddingSpaces(node); | ||
} | ||
var RULE_NAME3 = "no-find-dom-node"; | ||
@@ -207,0 +212,0 @@ var RULE_FEATURES3 = []; |
{ | ||
"name": "eslint-plugin-react-dom", | ||
"version": "2.0.0-next.120", | ||
"version": "2.0.0-next.121", | ||
"description": "ESLint React's ESLint plugin for React DOM related rules.", | ||
@@ -44,8 +44,8 @@ "keywords": [ | ||
"ts-pattern": "^5.8.0", | ||
"@eslint-react/ast": "2.0.0-next.120", | ||
"@eslint-react/core": "2.0.0-next.120", | ||
"@eslint-react/eff": "2.0.0-next.120", | ||
"@eslint-react/shared": "2.0.0-next.120", | ||
"@eslint-react/kit": "2.0.0-next.120", | ||
"@eslint-react/var": "2.0.0-next.120" | ||
"@eslint-react/ast": "2.0.0-next.121", | ||
"@eslint-react/core": "2.0.0-next.121", | ||
"@eslint-react/kit": "2.0.0-next.121", | ||
"@eslint-react/eff": "2.0.0-next.121", | ||
"@eslint-react/shared": "2.0.0-next.121", | ||
"@eslint-react/var": "2.0.0-next.121" | ||
}, | ||
@@ -52,0 +52,0 @@ "devDependencies": { |
68141
0.24%2138
0.23%+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed