eslint-plugin-react-x 5.26.4 → 5.26.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.
Files changed (2) hide show
  1. package/dist/index.js +7 -3
  2. package/package.json +7 -7
package/dist/index.js CHANGED
@@ -135,7 +135,7 @@ const rules$6 = {
135
135
  //#endregion
136
136
  //#region package.json
137
137
  var name$6 = "eslint-plugin-react-x";
138
- var version = "5.26.4";
138
+ var version = "5.26.5";
139
139
  //#endregion
140
140
  //#region src/utils/create-rule.ts
141
141
  function getDocsUrl(ruleName) {
@@ -6489,7 +6489,8 @@ function createFactCollector$3(additionalStateHooks, additionalEffectHooks) {
6489
6489
  if (entry == null || entry.node.async) return;
6490
6490
  if (isUseStateCall(node)) return;
6491
6491
  if (isUseEffectCall(node)) {
6492
- if (!Check.isFunction(node.arguments.at(0))) facts.setupIdentifiers.push(...getNestedIdentifiers(node));
6492
+ const setup = node.arguments.at(0);
6493
+ if (setup != null && !Check.isFunction(setup)) facts.setupIdentifiers.push(...getNestedIdentifiers(setup));
6493
6494
  return;
6494
6495
  }
6495
6496
  facts.calls.push({
@@ -6503,7 +6504,7 @@ function createFactCollector$3(additionalStateHooks, additionalEffectHooks) {
6503
6504
  if (node.parent.type === AST_NODE_TYPES.CallExpression && node.parent.callee === node) return;
6504
6505
  switch (node.parent.type) {
6505
6506
  case AST_NODE_TYPES.ArrowFunctionExpression:
6506
- facts.setStateReferences.push({
6507
+ if (node === node.parent.body) facts.setStateReferences.push({
6507
6508
  kind: "callback-body",
6508
6509
  node
6509
6510
  });
@@ -6665,6 +6666,9 @@ function isRefGatedContext(context, node, refParams) {
6665
6666
  if (current.type === AST_NODE_TYPES.ConditionalExpression) {
6666
6667
  if (isRefInExpression(context, current.test, refParams)) return true;
6667
6668
  }
6669
+ if (current.type === AST_NODE_TYPES.LogicalExpression && child === current.right) {
6670
+ if (isRefInExpression(context, current.left, refParams)) return true;
6671
+ }
6668
6672
  if (current.type === AST_NODE_TYPES.BlockStatement) {
6669
6673
  const index = current.body.findIndex((statement) => statement === child);
6670
6674
  for (const statement of current.body.slice(0, Math.max(0, index))) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-react-x",
3
- "version": "5.26.4",
3
+ "version": "5.26.5",
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.26.4",
40
- "@eslint-react/core": "5.26.4",
41
- "@eslint-react/eslint": "5.26.4",
42
- "@eslint-react/jsx": "5.26.4",
43
- "@eslint-react/shared": "5.26.4",
44
- "@eslint-react/var": "5.26.4",
39
+ "@eslint-react/ast": "5.26.5",
40
+ "@eslint-react/core": "5.26.5",
41
+ "@eslint-react/eslint": "5.26.5",
42
+ "@eslint-react/jsx": "5.26.5",
43
+ "@eslint-react/shared": "5.26.5",
44
+ "@eslint-react/var": "5.26.5",
45
45
  "@typescript-eslint/scope-manager": "^8.71.2",
46
46
  "@typescript-eslint/types": "^8.71.2",
47
47
  "@typescript-eslint/typescript-estree": "^8.71.2",