eslint-plugin-react-dom 1.52.3 → 1.52.4-beta.1

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 CHANGED
@@ -3,7 +3,6 @@
3
3
  var shared = require('@eslint-react/shared');
4
4
  var ER = require('@eslint-react/core');
5
5
  var utils = require('@typescript-eslint/utils');
6
- var AST = require('@eslint-react/ast');
7
6
  var types = require('@typescript-eslint/types');
8
7
  var compareVersions = require('compare-versions');
9
8
  var kit = require('@eslint-react/kit');
@@ -28,7 +27,6 @@ function _interopNamespace(e) {
28
27
  }
29
28
 
30
29
  var ER__namespace = /*#__PURE__*/_interopNamespace(ER);
31
- var AST__namespace = /*#__PURE__*/_interopNamespace(AST);
32
30
 
33
31
  var __defProp = Object.defineProperty;
34
32
  var __export = (target, all) => {
@@ -67,7 +65,7 @@ var settings = {
67
65
 
68
66
  // package.json
69
67
  var name2 = "eslint-plugin-react-dom";
70
- var version = "1.52.3";
68
+ var version = "1.52.4-beta.1";
71
69
  function createJsxElementResolver(context) {
72
70
  const { components, polymorphicPropName } = shared.getSettingsFromContext(context);
73
71
  return {
@@ -176,7 +174,7 @@ function create2(context) {
176
174
  JSXElement(node) {
177
175
  const attributes = node.openingElement.attributes;
178
176
  const initialScope = context.sourceCode.getScope(node);
179
- const hasChildren = hasChildrenWithin(node) || ER__namespace.hasAttribute(context, "children", attributes, initialScope);
177
+ const hasChildren = node.children.some(isSignificantChildren) || ER__namespace.hasAttribute(context, "children", attributes, initialScope);
180
178
  if (hasChildren && ER__namespace.hasAttribute(context, dangerouslySetInnerHTML2, attributes, initialScope)) {
181
179
  context.report({
182
180
  messageId: "noDangerouslySetInnerhtmlWithChildren",
@@ -186,8 +184,14 @@ function create2(context) {
186
184
  }
187
185
  };
188
186
  }
189
- function hasChildrenWithin(node) {
190
- return node.children.length > 0 && node.children[0] != null && !AST__namespace.isLineBreak(node.children[0]);
187
+ function isWhiteSpace(node) {
188
+ return typeof node.value === "string" && node.raw.trim() === "";
189
+ }
190
+ function isPaddingSpaces(node) {
191
+ return ER__namespace.isJsxText(node) && isWhiteSpace(node) && node.raw.includes("\n");
192
+ }
193
+ function isSignificantChildren(node) {
194
+ return node.type !== types.AST_NODE_TYPES.JSXText || !isPaddingSpaces(node);
191
195
  }
192
196
  var RULE_NAME3 = "no-find-dom-node";
193
197
  var RULE_FEATURES3 = [];
package/dist/index.mjs CHANGED
@@ -1,7 +1,6 @@
1
1
  import { getDocsUrl, getSettingsFromContext, DEFAULT_ESLINT_REACT_SETTINGS } from '@eslint-react/shared';
2
2
  import * as ER from '@eslint-react/core';
3
3
  import { ESLintUtils } from '@typescript-eslint/utils';
4
- import * as AST from '@eslint-react/ast';
5
4
  import { AST_NODE_TYPES } from '@typescript-eslint/types';
6
5
  import { compare } from 'compare-versions';
7
6
  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 = "1.52.3";
46
+ var version = "1.52.4-beta.1";
48
47
  function createJsxElementResolver(context) {
49
48
  const { components, polymorphicPropName } = getSettingsFromContext(context);
50
49
  return {
@@ -153,7 +152,7 @@ function create2(context) {
153
152
  JSXElement(node) {
154
153
  const attributes = node.openingElement.attributes;
155
154
  const initialScope = context.sourceCode.getScope(node);
156
- const hasChildren = hasChildrenWithin(node) || ER.hasAttribute(context, "children", attributes, initialScope);
155
+ const hasChildren = node.children.some(isSignificantChildren) || ER.hasAttribute(context, "children", attributes, initialScope);
157
156
  if (hasChildren && ER.hasAttribute(context, dangerouslySetInnerHTML2, attributes, initialScope)) {
158
157
  context.report({
159
158
  messageId: "noDangerouslySetInnerhtmlWithChildren",
@@ -163,8 +162,14 @@ function create2(context) {
163
162
  }
164
163
  };
165
164
  }
166
- function hasChildrenWithin(node) {
167
- return node.children.length > 0 && node.children[0] != null && !AST.isLineBreak(node.children[0]);
165
+ function isWhiteSpace(node) {
166
+ return typeof node.value === "string" && node.raw.trim() === "";
167
+ }
168
+ function isPaddingSpaces(node) {
169
+ return ER.isJsxText(node) && isWhiteSpace(node) && node.raw.includes("\n");
170
+ }
171
+ function isSignificantChildren(node) {
172
+ return node.type !== AST_NODE_TYPES.JSXText || !isPaddingSpaces(node);
168
173
  }
169
174
  var RULE_NAME3 = "no-find-dom-node";
170
175
  var RULE_FEATURES3 = [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-react-dom",
3
- "version": "1.52.3",
3
+ "version": "1.52.4-beta.1",
4
4
  "description": "ESLint React's ESLint plugin for React DOM related rules.",
5
5
  "keywords": [
6
6
  "react",
@@ -43,22 +43,22 @@
43
43
  "./package.json"
44
44
  ],
45
45
  "dependencies": {
46
- "@typescript-eslint/scope-manager": "^8.36.0",
47
- "@typescript-eslint/types": "^8.36.0",
48
- "@typescript-eslint/utils": "^8.36.0",
46
+ "@typescript-eslint/scope-manager": "^8.38.0",
47
+ "@typescript-eslint/types": "^8.38.0",
48
+ "@typescript-eslint/utils": "^8.38.0",
49
49
  "compare-versions": "^6.1.1",
50
50
  "string-ts": "^2.2.1",
51
- "ts-pattern": "^5.7.1",
52
- "@eslint-react/ast": "1.52.3",
53
- "@eslint-react/core": "1.52.3",
54
- "@eslint-react/eff": "1.52.3",
55
- "@eslint-react/shared": "1.52.3",
56
- "@eslint-react/var": "1.52.3",
57
- "@eslint-react/kit": "1.52.3"
51
+ "ts-pattern": "^5.8.0",
52
+ "@eslint-react/ast": "1.52.4-beta.1",
53
+ "@eslint-react/core": "1.52.4-beta.1",
54
+ "@eslint-react/var": "1.52.4-beta.1",
55
+ "@eslint-react/kit": "1.52.4-beta.1",
56
+ "@eslint-react/shared": "1.52.4-beta.1",
57
+ "@eslint-react/eff": "1.52.4-beta.1"
58
58
  },
59
59
  "devDependencies": {
60
- "@types/react": "^19.1.8",
61
- "@types/react-dom": "^19.1.6",
60
+ "@types/react": "^19.1.9",
61
+ "@types/react-dom": "^19.1.7",
62
62
  "tsup": "^8.5.0",
63
63
  "@local/configs": "0.0.0"
64
64
  },