eslint-plugin-react-x 5.24.0-beta.2 → 5.24.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 +12 -4
  2. package/package.json +7 -7
package/dist/index.js CHANGED
@@ -145,7 +145,7 @@ const rules$6 = {
145
145
  //#endregion
146
146
  //#region package.json
147
147
  var name$6 = "eslint-plugin-react-x";
148
- var version = "5.24.0-beta.2";
148
+ var version = "5.24.0";
149
149
 
150
150
  //#endregion
151
151
  //#region src/utils/create-rule.ts
@@ -3455,6 +3455,12 @@ function create$24(context) {
3455
3455
  */
3456
3456
  function visitItemExpression(node) {
3457
3457
  switch (node.type) {
3458
+ case AST_NODE_TYPES.ChainExpression:
3459
+ case AST_NODE_TYPES.TSAsExpression:
3460
+ case AST_NODE_TYPES.TSTypeAssertion:
3461
+ case AST_NODE_TYPES.TSNonNullExpression:
3462
+ case AST_NODE_TYPES.TSSatisfiesExpression:
3463
+ case AST_NODE_TYPES.TSInstantiationExpression: return visitItemExpression(node.expression);
3458
3464
  case AST_NODE_TYPES.JSXElement: return hasAttribute(context, node, "key") ? [] : [{
3459
3465
  messageId: "default",
3460
3466
  node
@@ -8232,6 +8238,7 @@ function inferViolations$2(context, facts) {
8232
8238
  const resolver = createSetStateResolver$1(context);
8233
8239
  const getText = (n) => context.sourceCode.getText(n);
8234
8240
  const isUseEffectCall = (node) => core.isUseEffectLikeCall(node, additionalEffectHooks);
8241
+ const isUseStateOrThenCall = or(resolver.isUseStateCall, isThenCall);
8235
8242
  const setStateCallsByFn = /* @__PURE__ */ new Map();
8236
8243
  const setStateInHookCallbacks = /* @__PURE__ */ new Map();
8237
8244
  const setStateInEffectArg = /* @__PURE__ */ new Map();
@@ -8239,7 +8246,7 @@ function inferViolations$2(context, facts) {
8239
8246
  const trackedFnCalls = [];
8240
8247
  const violations = [];
8241
8248
  for (const { enclosingFunction, enclosingFunctionKind, node, setupFunction } of facts.calls) {
8242
- if (resolver.isUseStateCall(node) || isThenCall(node)) continue;
8249
+ if (isUseStateOrThenCall(node)) continue;
8243
8250
  if (!resolver.isSetStateCall(node)) {
8244
8251
  if (setupFunction != null && enclosingFunction === setupFunction) trackedFnCalls.push(node);
8245
8252
  continue;
@@ -8355,11 +8362,12 @@ function create$5(context) {
8355
8362
 
8356
8363
  //#endregion
8357
8364
  //#region src/rules/set-state-in-render/helpers.ts
8365
+ const isComponentOrHookName = or(core.isFunctionComponentName, core.isHookName);
8358
8366
  function isComponentOrHookLikeFunction(node) {
8359
8367
  const id = core.getFunctionId(node);
8360
8368
  if (id == null) return false;
8361
- if (Check.isIdentifier(id)) return core.isFunctionComponentName(id.name) || core.isHookName(id.name);
8362
- if (id.type === AST_NODE_TYPES.MemberExpression && Check.isIdentifier(id.property)) return core.isFunctionComponentName(id.property.name) || core.isHookName(id.property.name);
8369
+ if (Check.isIdentifier(id)) return isComponentOrHookName(id.name);
8370
+ if (id.type === AST_NODE_TYPES.MemberExpression && Check.isIdentifier(id.property)) return isComponentOrHookName(id.property.name);
8363
8371
  return false;
8364
8372
  }
8365
8373
  function isInsideConditional(node, stopAt) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-react-x",
3
- "version": "5.24.0-beta.2",
3
+ "version": "5.24.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.24.0-beta.2",
40
- "@eslint-react/core": "5.24.0-beta.2",
41
- "@eslint-react/eslint": "5.24.0-beta.2",
42
- "@eslint-react/jsx": "5.24.0-beta.2",
43
- "@eslint-react/shared": "5.24.0-beta.2",
44
- "@eslint-react/var": "5.24.0-beta.2",
39
+ "@eslint-react/ast": "5.24.0",
40
+ "@eslint-react/core": "5.24.0",
41
+ "@eslint-react/eslint": "5.24.0",
42
+ "@eslint-react/jsx": "5.24.0",
43
+ "@eslint-react/shared": "5.24.0",
44
+ "@eslint-react/var": "5.24.0",
45
45
  "@typescript-eslint/scope-manager": "^8.71.0",
46
46
  "@typescript-eslint/types": "^8.71.0",
47
47
  "@typescript-eslint/typescript-estree": "^8.71.0",