eslint-plugin-react-dom 1.23.2 → 1.23.3-beta.5

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
@@ -32,7 +32,7 @@ var AST__namespace = /*#__PURE__*/_interopNamespace(AST);
32
32
 
33
33
  // package.json
34
34
  var name = "eslint-plugin-react-dom";
35
- var version = "1.23.2";
35
+ var version = "1.23.3-beta.5";
36
36
  var createRule = shared.createRuleForPlugin("dom");
37
37
  function findAttrInCustomAttributes(name2, attributes) {
38
38
  return eff.F.pipe(
@@ -102,7 +102,9 @@ var no_dangerously_set_innerhtml_with_children_default = createRule({
102
102
  const hasChildrenWithIn = () => node.children.length > 0 && firstChildIsText(node);
103
103
  const hasChildrenProp = () => JSX8__namespace.hasProp(node.openingElement.attributes, "children", initialScope);
104
104
  const hasDanger = () => JSX8__namespace.hasProp(node.openingElement.attributes, "dangerouslySetInnerHTML", initialScope);
105
- if (!(hasChildrenWithIn() || hasChildrenProp()) || !hasDanger()) return;
105
+ if (!(hasChildrenWithIn() || hasChildrenProp()) || !hasDanger()) {
106
+ return;
107
+ }
106
108
  context.report({
107
109
  messageId: "noDangerouslySetInnerhtmlWithChildren",
108
110
  node
@@ -171,11 +173,15 @@ var no_missing_button_type_default = createRule({
171
173
  return {
172
174
  JSXElement(node) {
173
175
  const elementName = core.getElementRepresentName(node.openingElement, context);
174
- if (elementName !== "button") return;
176
+ if (elementName !== "button") {
177
+ return;
178
+ }
175
179
  const { attributes } = node.openingElement;
176
180
  const initialScope = context.sourceCode.getScope(node);
177
181
  const mbProp = JSX8__namespace.findPropInAttributes(attributes, initialScope)("type");
178
- if (eff.O.isSome(mbProp)) return;
182
+ if (eff.O.isSome(mbProp)) {
183
+ return;
184
+ }
179
185
  context.report({
180
186
  messageId: "noMissingButtonType",
181
187
  node
@@ -224,7 +230,9 @@ var no_missing_iframe_sandbox_default = createRule({
224
230
  return {
225
231
  JSXElement(node) {
226
232
  const elementName = core.getElementRepresentName(node.openingElement, context);
227
- if (elementName !== "iframe") return;
233
+ if (elementName !== "iframe") {
234
+ return;
235
+ }
228
236
  const { attributes } = node.openingElement;
229
237
  const initialScope = context.sourceCode.getScope(node);
230
238
  const mbProp = JSX8__namespace.findPropInAttributes(attributes, initialScope)("sandbox");
@@ -242,7 +250,9 @@ var no_missing_iframe_sandbox_default = createRule({
242
250
  eff.O.map((value) => value.split(" ")),
243
251
  eff.O.exists((values) => values.every((value) => validTypes.some((validType) => validType === value)))
244
252
  );
245
- if (hasValidSandbox) return;
253
+ if (hasValidSandbox) {
254
+ return;
255
+ }
246
256
  context.report({
247
257
  messageId: "noMissingIframeSandbox",
248
258
  node: prop
@@ -273,7 +283,9 @@ var no_namespace_default = createRule({
273
283
  return {
274
284
  JSXOpeningElement(node) {
275
285
  const name2 = JSX8__namespace.getElementName(node);
276
- if (!eff.isString(name2) || !name2.includes(":")) return;
286
+ if (!eff.isString(name2) || !name2.includes(":")) {
287
+ return;
288
+ }
277
289
  context.report({
278
290
  messageId: "noNamespace",
279
291
  node,
@@ -314,9 +326,15 @@ var no_render_return_value_default = createRule({
314
326
  return {
315
327
  CallExpression(node) {
316
328
  const { callee, parent } = node;
317
- if (callee.type !== types.AST_NODE_TYPES.MemberExpression) return;
318
- if (callee.object.type !== types.AST_NODE_TYPES.Identifier) return;
319
- if (!("name" in callee.object)) return;
329
+ if (callee.type !== types.AST_NODE_TYPES.MemberExpression) {
330
+ return;
331
+ }
332
+ if (callee.object.type !== types.AST_NODE_TYPES.Identifier) {
333
+ return;
334
+ }
335
+ if (!("name" in callee.object)) {
336
+ return;
337
+ }
320
338
  const objectName = callee.object.name;
321
339
  if (objectName.toLowerCase() !== "reactdom" || callee.property.type !== types.AST_NODE_TYPES.Identifier || callee.property.name !== "render" || !AST__namespace.isOneOf(banParentTypes)(parent)) {
322
340
  return;
@@ -353,7 +371,9 @@ var no_script_url_default = createRule({
353
371
  create(context) {
354
372
  return {
355
373
  JSXAttribute(node) {
356
- if (node.name.type !== types.AST_NODE_TYPES.JSXIdentifier || !node.value) return;
374
+ if (node.name.type !== types.AST_NODE_TYPES.JSXIdentifier || !node.value) {
375
+ return;
376
+ }
357
377
  const isJavaScript = eff.F.pipe(
358
378
  JSX8__namespace.getPropValue(node, context.sourceCode.getScope(node)),
359
379
  eff.O.filter(eff.isString),
@@ -1452,11 +1472,15 @@ var no_unsafe_iframe_sandbox_default = createRule({
1452
1472
  return {
1453
1473
  JSXElement(node) {
1454
1474
  const elementName = core.getElementRepresentName(node.openingElement, context);
1455
- if (elementName !== "iframe") return;
1475
+ if (elementName !== "iframe") {
1476
+ return;
1477
+ }
1456
1478
  const { attributes } = node.openingElement;
1457
1479
  const initialScope = context.sourceCode.getScope(node);
1458
1480
  const mbProp = JSX8__namespace.findPropInAttributes(attributes, initialScope)("sandbox");
1459
- if (eff.O.isNone(mbProp)) return;
1481
+ if (eff.O.isNone(mbProp)) {
1482
+ return;
1483
+ }
1460
1484
  const prop = mbProp.value;
1461
1485
  const isSafeSandboxValue = !eff.F.pipe(
1462
1486
  JSX8__namespace.getPropValue(prop, context.sourceCode.getScope(prop)),
@@ -1469,7 +1493,9 @@ var no_unsafe_iframe_sandbox_default = createRule({
1469
1493
  (values) => unsafeCombinations.some((combinations) => combinations.every((unsafeValue) => values.includes(unsafeValue)))
1470
1494
  )
1471
1495
  );
1472
- if (isSafeSandboxValue) return;
1496
+ if (isSafeSandboxValue) {
1497
+ return;
1498
+ }
1473
1499
  context.report({
1474
1500
  messageId: "noUnsafeIframeSandbox",
1475
1501
  node: prop
@@ -1508,7 +1534,9 @@ var no_unsafe_target_blank_default = createRule({
1508
1534
  function getReportDescriptor(node) {
1509
1535
  const name2 = JSX8__namespace.getElementName(node.openingElement);
1510
1536
  const elementName = core.getElementRepresentName(node.openingElement, context);
1511
- if (elementName !== "a" && !additionalComponents.some((c) => c.re.test(name2))) return eff.O.none();
1537
+ if (elementName !== "a" && !additionalComponents.some((c) => c.re.test(name2))) {
1538
+ return eff.O.none();
1539
+ }
1512
1540
  const { attributes } = node.openingElement;
1513
1541
  const initialScope = context.sourceCode.getScope(node);
1514
1542
  const additionalAttributes = additionalComponents.findLast((c) => c.re.test(name2))?.attributes ?? [];
@@ -1525,7 +1553,9 @@ var no_unsafe_target_blank_default = createRule({
1525
1553
  ),
1526
1554
  eff.O.filter(eff.isString)
1527
1555
  );
1528
- if (!eff.O.exists(targetPropValue, (t) => t === "_blank")) return eff.O.none();
1556
+ if (!eff.O.exists(targetPropValue, (t) => t === "_blank")) {
1557
+ return eff.O.none();
1558
+ }
1529
1559
  const [
1530
1560
  hrefPropName,
1531
1561
  hrefPropDefaultValue
@@ -1539,7 +1569,9 @@ var no_unsafe_target_blank_default = createRule({
1539
1569
  ),
1540
1570
  eff.O.filter(eff.isString)
1541
1571
  );
1542
- if (!eff.O.exists(hrefPropValue, isExternalLinkLike)) return eff.O.none();
1572
+ if (!eff.O.exists(hrefPropValue, isExternalLinkLike)) {
1573
+ return eff.O.none();
1574
+ }
1543
1575
  const [
1544
1576
  relPropName,
1545
1577
  relPropDefaultValue
@@ -1553,7 +1585,9 @@ var no_unsafe_target_blank_default = createRule({
1553
1585
  ),
1554
1586
  eff.O.filter(eff.isString)
1555
1587
  );
1556
- if (eff.O.exists(relPropValue, isSafeRel)) return eff.O.none();
1588
+ if (eff.O.exists(relPropValue, isSafeRel)) {
1589
+ return eff.O.none();
1590
+ }
1557
1591
  return eff.O.some({
1558
1592
  messageId: "noUnsafeTargetBlank",
1559
1593
  node
@@ -1604,7 +1638,9 @@ var no_void_elements_with_children_default = createRule({
1604
1638
  return {
1605
1639
  JSXElement(node) {
1606
1640
  const elementName = JSX8__namespace.getElementName(node.openingElement);
1607
- if (!elementName || !voidElements.has(elementName)) return;
1641
+ if (!elementName || !voidElements.has(elementName)) {
1642
+ return;
1643
+ }
1608
1644
  if (node.children.length > 0) {
1609
1645
  context.report({
1610
1646
  messageId: "noVoidElementsWithChildren",
package/dist/index.mjs CHANGED
@@ -9,7 +9,7 @@ import { match, P } from 'ts-pattern';
9
9
 
10
10
  // package.json
11
11
  var name = "eslint-plugin-react-dom";
12
- var version = "1.23.2";
12
+ var version = "1.23.3-beta.5";
13
13
  var createRule = createRuleForPlugin("dom");
14
14
  function findAttrInCustomAttributes(name2, attributes) {
15
15
  return F.pipe(
@@ -79,7 +79,9 @@ var no_dangerously_set_innerhtml_with_children_default = createRule({
79
79
  const hasChildrenWithIn = () => node.children.length > 0 && firstChildIsText(node);
80
80
  const hasChildrenProp = () => JSX8.hasProp(node.openingElement.attributes, "children", initialScope);
81
81
  const hasDanger = () => JSX8.hasProp(node.openingElement.attributes, "dangerouslySetInnerHTML", initialScope);
82
- if (!(hasChildrenWithIn() || hasChildrenProp()) || !hasDanger()) return;
82
+ if (!(hasChildrenWithIn() || hasChildrenProp()) || !hasDanger()) {
83
+ return;
84
+ }
83
85
  context.report({
84
86
  messageId: "noDangerouslySetInnerhtmlWithChildren",
85
87
  node
@@ -148,11 +150,15 @@ var no_missing_button_type_default = createRule({
148
150
  return {
149
151
  JSXElement(node) {
150
152
  const elementName = getElementRepresentName(node.openingElement, context);
151
- if (elementName !== "button") return;
153
+ if (elementName !== "button") {
154
+ return;
155
+ }
152
156
  const { attributes } = node.openingElement;
153
157
  const initialScope = context.sourceCode.getScope(node);
154
158
  const mbProp = JSX8.findPropInAttributes(attributes, initialScope)("type");
155
- if (O.isSome(mbProp)) return;
159
+ if (O.isSome(mbProp)) {
160
+ return;
161
+ }
156
162
  context.report({
157
163
  messageId: "noMissingButtonType",
158
164
  node
@@ -201,7 +207,9 @@ var no_missing_iframe_sandbox_default = createRule({
201
207
  return {
202
208
  JSXElement(node) {
203
209
  const elementName = getElementRepresentName(node.openingElement, context);
204
- if (elementName !== "iframe") return;
210
+ if (elementName !== "iframe") {
211
+ return;
212
+ }
205
213
  const { attributes } = node.openingElement;
206
214
  const initialScope = context.sourceCode.getScope(node);
207
215
  const mbProp = JSX8.findPropInAttributes(attributes, initialScope)("sandbox");
@@ -219,7 +227,9 @@ var no_missing_iframe_sandbox_default = createRule({
219
227
  O.map((value) => value.split(" ")),
220
228
  O.exists((values) => values.every((value) => validTypes.some((validType) => validType === value)))
221
229
  );
222
- if (hasValidSandbox) return;
230
+ if (hasValidSandbox) {
231
+ return;
232
+ }
223
233
  context.report({
224
234
  messageId: "noMissingIframeSandbox",
225
235
  node: prop
@@ -250,7 +260,9 @@ var no_namespace_default = createRule({
250
260
  return {
251
261
  JSXOpeningElement(node) {
252
262
  const name2 = JSX8.getElementName(node);
253
- if (!isString(name2) || !name2.includes(":")) return;
263
+ if (!isString(name2) || !name2.includes(":")) {
264
+ return;
265
+ }
254
266
  context.report({
255
267
  messageId: "noNamespace",
256
268
  node,
@@ -291,9 +303,15 @@ var no_render_return_value_default = createRule({
291
303
  return {
292
304
  CallExpression(node) {
293
305
  const { callee, parent } = node;
294
- if (callee.type !== AST_NODE_TYPES.MemberExpression) return;
295
- if (callee.object.type !== AST_NODE_TYPES.Identifier) return;
296
- if (!("name" in callee.object)) return;
306
+ if (callee.type !== AST_NODE_TYPES.MemberExpression) {
307
+ return;
308
+ }
309
+ if (callee.object.type !== AST_NODE_TYPES.Identifier) {
310
+ return;
311
+ }
312
+ if (!("name" in callee.object)) {
313
+ return;
314
+ }
297
315
  const objectName = callee.object.name;
298
316
  if (objectName.toLowerCase() !== "reactdom" || callee.property.type !== AST_NODE_TYPES.Identifier || callee.property.name !== "render" || !AST.isOneOf(banParentTypes)(parent)) {
299
317
  return;
@@ -330,7 +348,9 @@ var no_script_url_default = createRule({
330
348
  create(context) {
331
349
  return {
332
350
  JSXAttribute(node) {
333
- if (node.name.type !== AST_NODE_TYPES.JSXIdentifier || !node.value) return;
351
+ if (node.name.type !== AST_NODE_TYPES.JSXIdentifier || !node.value) {
352
+ return;
353
+ }
334
354
  const isJavaScript = F.pipe(
335
355
  JSX8.getPropValue(node, context.sourceCode.getScope(node)),
336
356
  O.filter(isString),
@@ -1429,11 +1449,15 @@ var no_unsafe_iframe_sandbox_default = createRule({
1429
1449
  return {
1430
1450
  JSXElement(node) {
1431
1451
  const elementName = getElementRepresentName(node.openingElement, context);
1432
- if (elementName !== "iframe") return;
1452
+ if (elementName !== "iframe") {
1453
+ return;
1454
+ }
1433
1455
  const { attributes } = node.openingElement;
1434
1456
  const initialScope = context.sourceCode.getScope(node);
1435
1457
  const mbProp = JSX8.findPropInAttributes(attributes, initialScope)("sandbox");
1436
- if (O.isNone(mbProp)) return;
1458
+ if (O.isNone(mbProp)) {
1459
+ return;
1460
+ }
1437
1461
  const prop = mbProp.value;
1438
1462
  const isSafeSandboxValue = !F.pipe(
1439
1463
  JSX8.getPropValue(prop, context.sourceCode.getScope(prop)),
@@ -1446,7 +1470,9 @@ var no_unsafe_iframe_sandbox_default = createRule({
1446
1470
  (values) => unsafeCombinations.some((combinations) => combinations.every((unsafeValue) => values.includes(unsafeValue)))
1447
1471
  )
1448
1472
  );
1449
- if (isSafeSandboxValue) return;
1473
+ if (isSafeSandboxValue) {
1474
+ return;
1475
+ }
1450
1476
  context.report({
1451
1477
  messageId: "noUnsafeIframeSandbox",
1452
1478
  node: prop
@@ -1485,7 +1511,9 @@ var no_unsafe_target_blank_default = createRule({
1485
1511
  function getReportDescriptor(node) {
1486
1512
  const name2 = JSX8.getElementName(node.openingElement);
1487
1513
  const elementName = getElementRepresentName(node.openingElement, context);
1488
- if (elementName !== "a" && !additionalComponents.some((c) => c.re.test(name2))) return O.none();
1514
+ if (elementName !== "a" && !additionalComponents.some((c) => c.re.test(name2))) {
1515
+ return O.none();
1516
+ }
1489
1517
  const { attributes } = node.openingElement;
1490
1518
  const initialScope = context.sourceCode.getScope(node);
1491
1519
  const additionalAttributes = additionalComponents.findLast((c) => c.re.test(name2))?.attributes ?? [];
@@ -1502,7 +1530,9 @@ var no_unsafe_target_blank_default = createRule({
1502
1530
  ),
1503
1531
  O.filter(isString)
1504
1532
  );
1505
- if (!O.exists(targetPropValue, (t) => t === "_blank")) return O.none();
1533
+ if (!O.exists(targetPropValue, (t) => t === "_blank")) {
1534
+ return O.none();
1535
+ }
1506
1536
  const [
1507
1537
  hrefPropName,
1508
1538
  hrefPropDefaultValue
@@ -1516,7 +1546,9 @@ var no_unsafe_target_blank_default = createRule({
1516
1546
  ),
1517
1547
  O.filter(isString)
1518
1548
  );
1519
- if (!O.exists(hrefPropValue, isExternalLinkLike)) return O.none();
1549
+ if (!O.exists(hrefPropValue, isExternalLinkLike)) {
1550
+ return O.none();
1551
+ }
1520
1552
  const [
1521
1553
  relPropName,
1522
1554
  relPropDefaultValue
@@ -1530,7 +1562,9 @@ var no_unsafe_target_blank_default = createRule({
1530
1562
  ),
1531
1563
  O.filter(isString)
1532
1564
  );
1533
- if (O.exists(relPropValue, isSafeRel)) return O.none();
1565
+ if (O.exists(relPropValue, isSafeRel)) {
1566
+ return O.none();
1567
+ }
1534
1568
  return O.some({
1535
1569
  messageId: "noUnsafeTargetBlank",
1536
1570
  node
@@ -1581,7 +1615,9 @@ var no_void_elements_with_children_default = createRule({
1581
1615
  return {
1582
1616
  JSXElement(node) {
1583
1617
  const elementName = JSX8.getElementName(node.openingElement);
1584
- if (!elementName || !voidElements.has(elementName)) return;
1618
+ if (!elementName || !voidElements.has(elementName)) {
1619
+ return;
1620
+ }
1585
1621
  if (node.children.length > 0) {
1586
1622
  context.report({
1587
1623
  messageId: "noVoidElementsWithChildren",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-react-dom",
3
- "version": "1.23.2",
3
+ "version": "1.23.3-beta.5",
4
4
  "description": "ESLint React's ESLint plugin for React DOM related rules.",
5
5
  "keywords": [
6
6
  "react",
@@ -47,16 +47,16 @@
47
47
  "compare-versions": "^6.1.1",
48
48
  "string-ts": "^2.2.0",
49
49
  "ts-pattern": "^5.6.0",
50
- "@eslint-react/core": "1.23.2",
51
- "@eslint-react/ast": "1.23.2",
52
- "@eslint-react/eff": "1.23.2",
53
- "@eslint-react/jsx": "1.23.2",
54
- "@eslint-react/shared": "1.23.2",
55
- "@eslint-react/var": "1.23.2",
56
- "@eslint-react/types": "1.23.2"
50
+ "@eslint-react/ast": "1.23.3-beta.5",
51
+ "@eslint-react/core": "1.23.3-beta.5",
52
+ "@eslint-react/eff": "1.23.3-beta.5",
53
+ "@eslint-react/jsx": "1.23.3-beta.5",
54
+ "@eslint-react/types": "1.23.3-beta.5",
55
+ "@eslint-react/shared": "1.23.3-beta.5",
56
+ "@eslint-react/var": "1.23.3-beta.5"
57
57
  },
58
58
  "devDependencies": {
59
- "@types/react": "^19.0.3",
59
+ "@types/react": "^19.0.4",
60
60
  "@types/react-dom": "^19.0.2",
61
61
  "tsup": "^8.3.5",
62
62
  "@workspace/configs": "0.0.0"