Repository navigation
fix(js,ts): a function inside an object literal's method is a local, not a member - #3161
Merged
Merged
Conversation
…not a member
A bare call between two functions declared in a method of an object behind
`satisfies` or `as const` linked to nothing: 34 calls in react's ESLint rules,
where `const rule = {...} satisfies Rule.RuleModule` holds everything in
`create`, like `reportProblem(...)` from `visitCallExpression`. 1.6.2 linked
them. Regression from f40db4b (PR #2363), which never shipped.
Traced: the extractor makes a literal's direct function members nodes only
when the initializer is the literal itself, so behind `satisfies` the method
`create` has no node, and what it declares is qualified under the constant:
`rule::reportProblem`. objectLiteralOwnerOf took any function qualified under
a holder whose initializer opens with `{` for a member of the literal, and a
member is never reached by a bare name. So the shape is wider than the report
says: a method of a nested object, a computed key, a function a member's value
passes on, and a literal read through `[key]` all lost the same calls, in
Vue and Svelte script blocks too.
Fix (resolver only): a holder's own text is read once for its `{...}` blocks.
A function directly in the literal's braces is a member. One deeper down is a
local of the block it is written in: reachable by name from inside that block
and from nowhere else, which is tighter than 1.6.2, where such a function
answered a bare name from anywhere. No extraction change, so no kernel change.
Validation: object-literal tests red on main (16), green here, on both
engines. A/B against 4499d00: react +35 (34 calls and 1
reference, all in the two ESLint rules), outline +5 (its oxlint rules);
excalidraw, vscode-be, taxonomy, express, vben, flask, gin identical. All 40
read against source. Index CPU: level (see the PR).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A bare call between two functions declared in a method of an object behind
satisfiesoras constlinked to nothing: 34 calls in react's ESLint rules,where
const rule = {...} satisfies Rule.RuleModuleholds everything increate, likereportProblem(...)fromvisitCallExpression. 1.6.2 linkedthem. Regression from f40db4b (PR #2363), which never shipped.
Traced: the extractor makes a literal's direct function members nodes only
when the initializer is the literal itself, so behind
satisfiesthe methodcreatehas no node, and what it declares is qualified under the constant:rule::reportProblem. objectLiteralOwnerOf took any function qualified undera holder whose initializer opens with
{for a member of the literal, and amember is never reached by a bare name. So the shape is wider than the report
says: a method of a nested object, a computed key, a function a member's value
passes on, and a literal read through
[key]all lost the same calls, inVue and Svelte script blocks too.
Fix (resolver only): a holder's own text is read once for its
{...}blocks.A function directly in the literal's braces is a member. One deeper down is a
local of the block it is written in: reachable by name from inside that block
and from nowhere else, which is tighter than 1.6.2, where such a function
answered a bare name from anywhere. No extraction change, so no kernel change.
Validation
4499d007:All 40 read against source. react's 34 calls are the ones REG listed, in
ExhaustiveDeps.tsandRulesOfHooks.ts, plus thevisitCallExpressionreference; outline's 5 are its oxlint rules, a literal'srules: { x: { create(context) { const check = …; … } } }.1.6.2 linked one more reference at each such site, from the file as well as from the constant. That was a duplicate main dropped on purpose and it stays dropped.
97cd3800, all six on4499d007: 853 files passed, 6 skipped; 10,610 tests passed, 2 expected fail, 87 skipped, 0 failed; 4 workers, Vitest 4.1.11,CODEGRAPH_KERNEL_EXPECT=1. This PR's own test files pass on this head.🤖 Generated with Claude Code