eslint-plugin-react-dom 3.0.0-beta.65 → 3.0.0-beta.67

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 +15 -9
  2. package/package.json +6 -6
package/dist/index.js CHANGED
@@ -3,6 +3,7 @@ import * as core from "@eslint-react/core";
3
3
  import { ESLintUtils } from "@typescript-eslint/utils";
4
4
  import { AST_NODE_TYPES } from "@typescript-eslint/types";
5
5
  import { compare } from "compare-versions";
6
+ import "ts-pattern";
6
7
 
7
8
  //#region \0rolldown/runtime.js
8
9
  var __defProp = Object.defineProperty;
@@ -23,7 +24,7 @@ var __exportAll = (all, no_symbols) => {
23
24
  //#endregion
24
25
  //#region package.json
25
26
  var name$2 = "eslint-plugin-react-dom";
26
- var version = "3.0.0-beta.65";
27
+ var version = "3.0.0-beta.67";
27
28
 
28
29
  //#endregion
29
30
  //#region src/utils/create-jsx-element-resolver.ts
@@ -49,10 +50,11 @@ function createJsxElementResolver(context) {
49
50
  if (elementName === elementName.toLowerCase() || polymorphicPropName == null) return result;
50
51
  const polymorphicProp = core.getJsxAttribute(context, node)(polymorphicPropName);
51
52
  if (polymorphicProp != null) {
52
- const staticValue = core.resolveJsxAttributeValue(context, polymorphicProp).toStatic(polymorphicPropName);
53
- if (typeof staticValue === "string") return {
53
+ const polyPropValue = core.resolveJsxAttributeValue(context, polymorphicProp);
54
+ const polyPropValueString = polyPropValue.kind === "spreadProps" ? polyPropValue.getProperty(polymorphicPropName) : polyPropValue.toStatic();
55
+ if (typeof polyPropValueString === "string") return {
54
56
  ...result,
55
- domElementType: staticValue
57
+ domElementType: polyPropValueString
56
58
  };
57
59
  }
58
60
  return result;
@@ -348,7 +350,8 @@ function create$11(context) {
348
350
  return;
349
351
  }
350
352
  const sandboxValue = core.resolveJsxAttributeValue(context, sandboxProp);
351
- if (typeof sandboxValue.toStatic("sandbox") === "string") return;
353
+ if (typeof sandboxValue.toStatic() === "string") return;
354
+ if (sandboxValue.kind === "spreadProps" && typeof sandboxValue.getProperty("sandbox") === "string") return;
352
355
  context.report({
353
356
  messageId: "missingSandboxAttribute",
354
357
  node: sandboxValue.node ?? sandboxProp,
@@ -1738,7 +1741,7 @@ function create$4(context) {
1738
1741
  const sandboxProp = core.getJsxAttribute(context, node)("sandbox");
1739
1742
  if (sandboxProp == null) return;
1740
1743
  const sandboxValue = core.resolveJsxAttributeValue(context, sandboxProp);
1741
- if (isUnsafeSandboxCombination(sandboxValue.toStatic("sandbox"))) context.report({
1744
+ if (isUnsafeSandboxCombination(sandboxValue.kind === "spreadProps" ? sandboxValue.getProperty("sandbox") : sandboxValue.toStatic())) context.report({
1742
1745
  messageId: "default",
1743
1746
  node: sandboxValue.node ?? sandboxProp
1744
1747
  });
@@ -1792,10 +1795,12 @@ function create$3(context) {
1792
1795
  const findAttribute = core.getJsxAttribute(context, node);
1793
1796
  const targetProp = findAttribute("target");
1794
1797
  if (targetProp == null) return;
1795
- if (core.resolveJsxAttributeValue(context, targetProp).toStatic("target") !== "_blank") return;
1798
+ const targetValue = core.resolveJsxAttributeValue(context, targetProp);
1799
+ if ((targetValue.kind === "spreadProps" ? targetValue.getProperty("target") : targetValue.toStatic()) !== "_blank") return;
1796
1800
  const hrefProp = findAttribute("href");
1797
1801
  if (hrefProp == null) return;
1798
- if (!isExternalLinkLike(core.resolveJsxAttributeValue(context, hrefProp).toStatic("href"))) return;
1802
+ const hrefValue = core.resolveJsxAttributeValue(context, hrefProp);
1803
+ if (!isExternalLinkLike(hrefValue.kind === "spreadProps" ? hrefValue.getProperty("href") : hrefValue.toStatic())) return;
1799
1804
  const relProp = findAttribute("rel");
1800
1805
  if (relProp == null) {
1801
1806
  context.report({
@@ -1810,7 +1815,8 @@ function create$3(context) {
1810
1815
  });
1811
1816
  return;
1812
1817
  }
1813
- if (isSafeRel(core.resolveJsxAttributeValue(context, relProp).toStatic("rel"))) return;
1818
+ const relValue = core.resolveJsxAttributeValue(context, relProp);
1819
+ if (isSafeRel(relValue.kind === "spreadProps" ? relValue.getProperty("rel") : relValue.toStatic())) return;
1814
1820
  context.report({
1815
1821
  messageId: "default",
1816
1822
  node: relProp,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-react-dom",
3
- "version": "3.0.0-beta.65",
3
+ "version": "3.0.0-beta.67",
4
4
  "description": "ESLint React's ESLint plugin for DOM related rules.",
5
5
  "keywords": [
6
6
  "react",
@@ -43,11 +43,11 @@
43
43
  "@typescript-eslint/utils": "canary",
44
44
  "compare-versions": "^6.1.1",
45
45
  "ts-pattern": "^5.9.0",
46
- "@eslint-react/ast": "3.0.0-beta.65",
47
- "@eslint-react/core": "3.0.0-beta.65",
48
- "@eslint-react/var": "3.0.0-beta.65",
49
- "@eslint-react/shared": "3.0.0-beta.65",
50
- "@eslint-react/eff": "3.0.0-beta.65"
46
+ "@eslint-react/ast": "3.0.0-beta.67",
47
+ "@eslint-react/core": "3.0.0-beta.67",
48
+ "@eslint-react/eff": "3.0.0-beta.67",
49
+ "@eslint-react/var": "3.0.0-beta.67",
50
+ "@eslint-react/shared": "3.0.0-beta.67"
51
51
  },
52
52
  "devDependencies": {
53
53
  "@types/react": "^19.2.14",