Skip to content

refactor: simplify callee name checks and remove getPropertyName - #1905

Merged
Rel1cx merged 2 commits into
mainfrom
refactor/remove-get-property-name
Jul 14, 2026
Merged

refactor: simplify callee name checks and remove getPropertyName#1905
Rel1cx merged 2 commits into
mainfrom
refactor/remove-get-property-name

Conversation

@Rel1cx

@Rel1cx Rel1cx commented Jul 14, 2026

Copy link
Copy Markdown
Owner
  • Remove Extract.getPropertyName; member expression properties and object keys are now only matched when they are non-computed identifiers, so computed string/template-literal keys are no longer statically resolved.
  • Add Extract.getCalleeName and use it to unify isHookCall, isUseEffectLikeCall and isUseStateLikeCall in @eslint-react/core, replacing the duplicated local helper in the react-x refs rule.
  • Update affected rule tests and regenerate @eslint-react/ast docs.Update "[ ]" to "[x]" to check a box

What kind of change does this PR introduce?

Check at least one. If you are introducing a new binding, you must reference an issue where this binding has been proposed, discussed and approved by the maintainers.

  • Bugfix
  • Feature
  • Perf
  • Docs
  • Test
  • Chore
  • Enhancement
  • New Binding issue #___
  • Code style update
  • Refactor
  • Build-related changes
  • Other, please describe:

Does this PR introduce a breaking change?

If yes, please describe the impact and migration path for existing applications in an attached issue.

  • Yes, and the changes were approved in issue #___
  • No

Checklist

  • When resolving issues, they are referenced in the PR's title (e.g fix: remove a typo, closes #___, #___)
  • I have added a convincing reason for adding this feature, if necessary

Other information

Rel1cx added 2 commits July 14, 2026 23:45
- Remove `Extract.getPropertyName`; member expression properties and object keys are now only matched when they are non-computed identifiers, so computed string/template-literal keys are no longer statically resolved.
- Add `Extract.getCalleeName` and use it to unify `isHookCall`, `isUseEffectLikeCall` and `isUseStateLikeCall` in `@eslint-react/core`, replacing the duplicated local helper in the react-x `refs` rule.
- Update affected rule tests and regenerate `@eslint-react/ast` docs.
Replace hand-rolled identifier/member-expression callee name checks with the new `Extract.getCalleeName` helper across packages and plugins.

- Collapse duplicated Identifier/MemberExpression branches where the call form does not matter: `isJsxLike` in `@eslint-react/core`, `no-find-dom-node`, `no-flush-sync`, the `getCallKind` helpers of all six `no-leaked-*` rules in react-web-api, and `isHookDecl` in react-x `set-state-in-effect`.
- Keep structural constraints (member call, receiver object) and simplify only the property name check: `isThisSetStateCall` and array `map`/`flatMap` callback detection in `@eslint-react/core`, static factory methods in `@eslint-react/var`, `ReactDOM.*` calls in `no-hydrate`/`no-render`/`no-render-return-value`/`no-use-form-state`, and `globals`, `immutability`, `no-array-index-key`, `no-duplicate-key`, `set-state-in-effect`/`set-state-in-render` in react-x.
- `no-find-dom-node` and `no-flush-sync` now unwrap the callee, so calls wrapped in type assertions (e.g. `(findDOMNode as any)()`) are also detected.
- `unsupported-syntax` (needs the `!computed` constraint), `require` detection, and `new (Intersection|Resize)Observer` checks are intentionally left unchanged since their semantics differ from `getCalleeName`.
- Remove now-unused `AST_NODE_TYPES` imports.
@vercel

vercel Bot commented Jul 14, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
eslint-react Building Building Preview, Comment Jul 14, 2026 4:08pm

@Rel1cx
Rel1cx marked this pull request as ready for review July 14, 2026 16:08
@Rel1cx
Rel1cx merged commit 392c738 into main Jul 14, 2026
11 of 12 checks passed
@Rel1cx
Rel1cx deleted the refactor/remove-get-property-name branch July 14, 2026 16:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant