eslint-plugin-react-dom 5.30.0-rc.1 → 5.30.0

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 +38 -14
  2. package/package.json +7 -7
package/dist/index.js CHANGED
@@ -8,18 +8,18 @@ import { createImportLookup } from "@eslint-react/var";
8
8
  import { compare } from "compare-versions";
9
9
  // \0rolldown/runtime.js
10
10
  var __defProp = Object.defineProperty;
11
- var __exportAll = (all, no_symbols) => {
12
- let target = {};
11
+ var __exportAll = (all, flags) => {
12
+ let target = Object.setPrototypeOf({}, null);
13
13
  for (var name in all) __defProp(target, name, {
14
14
  get: all[name],
15
15
  enumerable: true
16
16
  });
17
- if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
18
- return target;
17
+ if (!(flags & 1)) __defProp(target, Symbol.toStringTag, { value: "Module" });
18
+ return flags & 2 ? target : Object.preventExtensions(target);
19
19
  };
20
20
  // package.json
21
21
  var name$2 = "eslint-plugin-react-dom";
22
- var version = "5.30.0-rc.1";
22
+ var version = "5.30.0";
23
23
  // src/utils/create-rule.ts
24
24
  function getDocsUrl(ruleName) {
25
25
  return `https://eslint-react.xyz/docs/rules/dom-${ruleName}`;
@@ -140,20 +140,41 @@ function addImportFix(context, fixer, name, source) {
140
140
  for (const specifier of statement.specifiers) {
141
141
  if (specifier.type === AST_NODE_TYPES.ImportSpecifier && specifier.importKind === "type") continue;
142
142
  if (specifier.local.name !== name) continue;
143
- return null;
143
+ return isNamedImportOf(specifier, statement, name, source) ? { kind: "exists" } : { kind: "conflict" };
144
144
  }
145
145
  if (statement.source.value !== source) continue;
146
146
  sameSourceImport ??= statement;
147
147
  }
148
148
  const lastNamedSpecifier = (sameSourceImport?.specifiers.filter((s) => s.type === AST_NODE_TYPES.ImportSpecifier) ?? []).at(-1);
149
- if (lastNamedSpecifier != null) return fixer.insertTextAfter(lastNamedSpecifier, `, ${name}`);
149
+ if (lastNamedSpecifier != null) return {
150
+ kind: "add",
151
+ fix: fixer.insertTextAfter(lastNamedSpecifier, `, ${name}`)
152
+ };
150
153
  const text = `import { ${name} } from "${source}";`;
151
154
  const eol = context.sourceCode.text.includes("\r\n") ? "\r\n" : "\n";
152
- if (lastImport != null) return fixer.insertTextAfterRange(getLineEndAnchor(context, lastImport), `${eol}${text}`);
153
- if (lastDirective != null) return fixer.insertTextAfterRange(getLineEndAnchor(context, lastDirective), `${eol}${text}`);
155
+ if (lastImport != null) return {
156
+ kind: "add",
157
+ fix: fixer.insertTextAfterRange(getLineEndAnchor(context, lastImport), `${eol}${text}`)
158
+ };
159
+ if (lastDirective != null) return {
160
+ kind: "add",
161
+ fix: fixer.insertTextAfterRange(getLineEndAnchor(context, lastDirective), `${eol}${text}`)
162
+ };
154
163
  const lastComment = (ast.body[0] == null ? ast.comments : context.sourceCode.getCommentsBefore(ast.body[0])).at(-1);
155
- if (lastComment != null) return fixer.insertTextAfter(lastComment, `${eol}${text}`);
156
- return fixer.insertTextBefore(ast, `${text}${eol}`);
164
+ if (lastComment != null) return {
165
+ kind: "add",
166
+ fix: fixer.insertTextAfter(lastComment, `${eol}${text}`)
167
+ };
168
+ return {
169
+ kind: "add",
170
+ fix: fixer.insertTextBefore(ast, `${text}${eol}`)
171
+ };
172
+ }
173
+ function isNamedImportOf(specifier, statement, name, source) {
174
+ if (statement.source.value !== source) return false;
175
+ if (specifier.type !== AST_NODE_TYPES.ImportSpecifier) return false;
176
+ const { imported } = specifier;
177
+ return (imported.type === AST_NODE_TYPES.Identifier ? imported.name : imported.value) === name;
157
178
  }
158
179
  function getLineEndAnchor(context, node) {
159
180
  let anchor = node;
@@ -200,7 +221,8 @@ function buildFix$2(context, node) {
200
221
  if (arg1.type === AST_NODE_TYPES.SpreadElement) return null;
201
222
  if (node.parent.type !== AST_NODE_TYPES.ExpressionStatement) return null;
202
223
  const importFix = addImportFix(context, fixer, "hydrateRoot", "react-dom/client");
203
- return [...importFix == null ? [] : [importFix], fixer.replaceText(node, `hydrateRoot(${getText(context, arg1)}, ${getText(context, arg0)})`)];
224
+ if (importFix.kind === "conflict") return null;
225
+ return [...importFix.kind === "add" ? [importFix.fix] : [], fixer.replaceText(node, `hydrateRoot(${getText(context, arg1)}, ${getText(context, arg0)})`)];
204
226
  };
205
227
  }
206
228
  // ../../.pkgs/eff/dist/index.js
@@ -489,7 +511,8 @@ function buildFix$1(context, node) {
489
511
  if (arg1.type === AST_NODE_TYPES.SpreadElement) return null;
490
512
  if (node.parent.type !== AST_NODE_TYPES.ExpressionStatement) return null;
491
513
  const importFix = addImportFix(context, fixer, "createRoot", "react-dom/client");
492
- return [...importFix == null ? [] : [importFix], fixer.replaceText(node, `createRoot(${getText(context, arg1)}).render(${getText(context, arg0)})`)];
514
+ if (importFix.kind === "conflict") return null;
515
+ return [...importFix.kind === "add" ? [importFix.fix] : [], fixer.replaceText(node, `createRoot(${getText(context, arg1)}).render(${getText(context, arg0)})`)];
493
516
  };
494
517
  }
495
518
  var no_script_url_default = createRule({
@@ -1754,7 +1777,8 @@ function create$1(context) {
1754
1777
  function buildFix(context, node, importSource) {
1755
1778
  return (fixer) => {
1756
1779
  const importFix = addImportFix(context, fixer, "useActionState", importSource);
1757
- return [...importFix == null ? [] : [importFix], fixer.replaceText(node.callee, "useActionState")];
1780
+ if (importFix.kind === "conflict") return null;
1781
+ return [...importFix.kind === "add" ? [importFix.fix] : [], fixer.replaceText(node.callee, "useActionState")];
1758
1782
  };
1759
1783
  }
1760
1784
  // src/rules/no-void-elements-with-children/lib.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-react-dom",
3
- "version": "5.30.0-rc.1",
3
+ "version": "5.30.0",
4
4
  "description": "ESLint React's ESLint plugin for DOM related rules.",
5
5
  "keywords": [
6
6
  "react",
@@ -37,11 +37,11 @@
37
37
  "dist"
38
38
  ],
39
39
  "dependencies": {
40
- "@eslint-react/ast": "5.30.0-rc.1",
41
- "@eslint-react/eslint": "5.30.0-rc.1",
42
- "@eslint-react/jsx": "5.30.0-rc.1",
43
- "@eslint-react/shared": "5.30.0-rc.1",
44
- "@eslint-react/var": "5.30.0-rc.1",
40
+ "@eslint-react/ast": "5.30.0",
41
+ "@eslint-react/eslint": "5.30.0",
42
+ "@eslint-react/jsx": "5.30.0",
43
+ "@eslint-react/shared": "5.30.0",
44
+ "@eslint-react/var": "5.30.0",
45
45
  "@typescript-eslint/types": "^8.72.1",
46
46
  "@typescript-eslint/utils": "^8.72.1",
47
47
  "compare-versions": "^6.1.1",
@@ -57,7 +57,7 @@
57
57
  "@types/react-dom": "^19.3.0",
58
58
  "dedent": "^1.7.2",
59
59
  "eslint": "^10.14.0",
60
- "tsdown": "^0.23.5",
60
+ "tsdown": "^0.23.7",
61
61
  "typescript": "6.0.3"
62
62
  },
63
63
  "peerDependencies": {