eslint-plugin-react-x 5.21.2 → 5.22.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 +1 -14
  2. package/package.json +7 -7
package/dist/index.js CHANGED
@@ -144,7 +144,7 @@ const rules$6 = {
144
144
  //#endregion
145
145
  //#region package.json
146
146
  var name$6 = "eslint-plugin-react-x";
147
- var version = "5.21.2";
147
+ var version = "5.22.0";
148
148
 
149
149
  //#endregion
150
150
  //#region src/utils/create-rule.ts
@@ -4912,16 +4912,6 @@ function hasUseClientDirective(program) {
4912
4912
  return program.body.some((stmt) => stmt.type === AST_NODE_TYPES.ExpressionStatement && stmt.directive === "use client");
4913
4913
  }
4914
4914
  /**
4915
- * Check if the node is an argument of a `useRef`-like call, e.g.
4916
- * `useRef(document.createElement("div"))`. The initializer is evaluated on
4917
- * every render but stored only on the first one, which is a widely used idiom
4918
- * (ex: portals), so impure calls in this position are exempted.
4919
- */
4920
- function isUseRefInitializerArgument(node) {
4921
- const { parent } = node;
4922
- return parent.type === AST_NODE_TYPES.CallExpression && parent.arguments.some((arg) => arg === node) && core.isUseRefLikeCall(parent);
4923
- }
4924
- /**
4925
4915
  * Find the property key under which `name` is bound in an object destructuring
4926
4916
  * pattern, e.g. `"random"` for `random` in `const { random } = Math` or for
4927
4917
  * `r` in `const { random: r } = Math`.
@@ -5034,7 +5024,6 @@ function create$7(context) {
5034
5024
  const resolved = resolveBuiltinObjectName(context, expr);
5035
5025
  if (resolved == null) return;
5036
5026
  if (!(resolved.property != null ? IMPURE_FUNCS.get(resolved.object)?.has(resolved.property) ?? false : IMPURE_FUNCS.get("globalThis")?.has(resolved.object) ?? false)) return;
5037
- if (isUseRefInitializerArgument(node)) return;
5038
5027
  const func = Traverse.findParent(node, Check.isFunction);
5039
5028
  if (func == null) return;
5040
5029
  cEntries.push({
@@ -5047,7 +5036,6 @@ function create$7(context) {
5047
5036
  const resolved = resolveBuiltinMember(context, expr);
5048
5037
  if (resolved == null || resolved.property == null) return;
5049
5038
  if (!IMPURE_FUNCS.get(resolved.object)?.has(resolved.property)) return;
5050
- if (isUseRefInitializerArgument(node)) return;
5051
5039
  const func = Traverse.findParent(node, Check.isFunction);
5052
5040
  if (func == null) return;
5053
5041
  cEntries.push({
@@ -5066,7 +5054,6 @@ function create$7(context) {
5066
5054
  const ctorName = resolved.property != null && isCatalogObject(resolved.object) ? resolved.property : resolved.object;
5067
5055
  if (!IMPURE_CTORS.has(ctorName)) return;
5068
5056
  if (ctorName === "Date" && node.arguments.length > 0) return;
5069
- if (isUseRefInitializerArgument(node)) return;
5070
5057
  const func = Traverse.findParent(node, Check.isFunction);
5071
5058
  if (func == null) return;
5072
5059
  nEntries.push({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-react-x",
3
- "version": "5.21.2",
3
+ "version": "5.22.0",
4
4
  "description": "A set of composable ESLint rules for libraries and frameworks that use React as a UI runtime.",
5
5
  "keywords": [
6
6
  "react",
@@ -36,12 +36,12 @@
36
36
  "dist"
37
37
  ],
38
38
  "dependencies": {
39
- "@eslint-react/ast": "5.21.2",
40
- "@eslint-react/core": "5.21.2",
41
- "@eslint-react/eslint": "5.21.2",
42
- "@eslint-react/jsx": "5.21.2",
43
- "@eslint-react/shared": "5.21.2",
44
- "@eslint-react/var": "5.21.2",
39
+ "@eslint-react/ast": "5.22.0",
40
+ "@eslint-react/core": "5.22.0",
41
+ "@eslint-react/eslint": "5.22.0",
42
+ "@eslint-react/jsx": "5.22.0",
43
+ "@eslint-react/shared": "5.22.0",
44
+ "@eslint-react/var": "5.22.0",
45
45
  "@typescript-eslint/scope-manager": "^8.70.1",
46
46
  "@typescript-eslint/types": "^8.70.1",
47
47
  "@typescript-eslint/typescript-estree": "^8.70.1",