Skip to content

Add scope tracker#29

Open
NullVoxPopuli-ai-agent wants to merge 1 commit into
NullVoxPopuli:mainfrom
NullVoxPopuli-ai-agent:scope-tracker
Open

Add scope tracker#29
NullVoxPopuli-ai-agent wants to merge 1 commit into
NullVoxPopuli:mainfrom
NullVoxPopuli-ai-agent:scope-tracker

Conversation

@NullVoxPopuli-ai-agent
Copy link
Copy Markdown

@NullVoxPopuli-ai-agent NullVoxPopuli-ai-agent commented Apr 11, 2026

Summary

  • Adds two new entry points for scope analysis:
    • ember-estree/scope — standalone analyze(ast) returning a lightweight ScopeManager with full JS + Glimmer scope info. For codemods, tools, zmod-ember.
    • ember-estree/eslint-scoperegisterGlimmerScopes(scopeManager) that augments an existing eslint-scope ScopeManager with Glimmer bindings. One function, one argument.
  • Both share internal Glimmer walking logic (scope-shared.js) for path expressions, component references, and block params
  • Each entry point composes visitor keys from oxc-parser + glimmerVisitorKeys, so the shared walk always has complete coverage — no Object.keys fallbacks
  • Simplifies the eslint-parser example by replacing ~80 lines of hand-rolled scope helpers with registerGlimmerScopes(scopeManager)
  • eslint-scope is an optional peer dependency (only needed for the eslint-scope entry point)

Rebased on main following the v0.5.x/v0.6.x releases (visitor-keys outer walk, in-place splicing, setParent helper, tokens split into tokens.js).

Test plan

  • 36 new tests (28 standalone scope + 8 eslint-scope integration)
  • All 225 tests pass
  • Zero lint warnings
  • publint passes
  • Existing eslint-parser example tests still pass with simplified code

🤖 Generated with Claude Code

- `ember-estree/scope`: standalone scope analysis (JS + Glimmer) with
  lightweight built-in classes. For codemods, tools, zmod-ember.
- `ember-estree/eslint-scope`: augments an eslint-scope ScopeManager with
  Glimmer bindings. One function, one argument: `registerGlimmerScopes(scopeManager)`.

Both share internal Glimmer walking logic (scope-shared.js) that handles
path expressions, component references, and block params. Each entry
point merges oxc-parser's visitor keys with glimmer's so the shared walk
always has complete coverage — no Object.keys fallbacks needed.

Simplifies the eslint-parser example to use `registerGlimmerScopes` from
the new entry point, removing ~80 lines of hand-rolled scope helpers.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.

2 participants