eslint-plugin-react-dom 2.0.0-next.120 → 2.0.0-next.121

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 +10 -5
  2. package/package.json +7 -7
package/dist/index.js CHANGED
@@ -2,7 +2,6 @@ import { getDocsUrl, getSettingsFromContext, DEFAULT_ESLINT_REACT_SETTINGS } fro
2
2
  import * as ER from '@eslint-react/core';
3
3
  import { ESLintUtils } from '@typescript-eslint/utils';
4
4
  import { unit } from '@eslint-react/eff';
5
- import * as AST from '@eslint-react/ast';
6
5
  import { AST_NODE_TYPES } from '@typescript-eslint/types';
7
6
  import { compare } from 'compare-versions';
8
7
  import { RegExp, Reporter } from '@eslint-react/kit';
@@ -44,7 +43,7 @@ var settings = {
44
43
 
45
44
  // package.json
46
45
  var name2 = "eslint-plugin-react-dom";
47
- var version = "2.0.0-next.120";
46
+ var version = "2.0.0-next.121";
48
47
  function createJsxElementResolver(context) {
49
48
  const { components, polymorphicPropName } = getSettingsFromContext(context);
50
49
  return {
@@ -186,7 +185,7 @@ function create2(context) {
186
185
  JSXElement(node) {
187
186
  const attributes = node.openingElement.attributes;
188
187
  const initialScope = context.sourceCode.getScope(node);
189
- const hasChildren = hasChildrenWithin(node) || ER.hasAttribute(context, "children", attributes, initialScope);
188
+ const hasChildren = node.children.some(isSignificantChildren) || ER.hasAttribute(context, "children", attributes, initialScope);
190
189
  if (hasChildren && ER.hasAttribute(context, dangerouslySetInnerHTML2, attributes, initialScope)) {
191
190
  context.report({
192
191
  messageId: "noDangerouslySetInnerhtmlWithChildren",
@@ -196,8 +195,14 @@ function create2(context) {
196
195
  }
197
196
  };
198
197
  }
199
- function hasChildrenWithin(node) {
200
- return node.children.length > 0 && node.children[0] != null && !AST.isLineBreak(node.children[0]);
198
+ function isWhiteSpace(node) {
199
+ return typeof node.value === "string" && node.raw.trim() === "";
200
+ }
201
+ function isPaddingSpaces(node) {
202
+ return ER.isJsxText(node) && isWhiteSpace(node) && node.raw.includes("\n");
203
+ }
204
+ function isSignificantChildren(node) {
205
+ return node.type !== AST_NODE_TYPES.JSXText || !isPaddingSpaces(node);
201
206
  }
202
207
  var RULE_NAME3 = "no-find-dom-node";
203
208
  var RULE_FEATURES3 = [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-react-dom",
3
- "version": "2.0.0-next.120",
3
+ "version": "2.0.0-next.121",
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.120",
45
- "@eslint-react/core": "2.0.0-next.120",
46
- "@eslint-react/eff": "2.0.0-next.120",
47
- "@eslint-react/shared": "2.0.0-next.120",
48
- "@eslint-react/kit": "2.0.0-next.120",
49
- "@eslint-react/var": "2.0.0-next.120"
44
+ "@eslint-react/ast": "2.0.0-next.121",
45
+ "@eslint-react/core": "2.0.0-next.121",
46
+ "@eslint-react/kit": "2.0.0-next.121",
47
+ "@eslint-react/eff": "2.0.0-next.121",
48
+ "@eslint-react/shared": "2.0.0-next.121",
49
+ "@eslint-react/var": "2.0.0-next.121"
50
50
  },
51
51
  "devDependencies": {
52
52
  "@types/react": "^19.1.9",