Repository navigation
fix(template-no-shadowed-elements): report tags shadowed by a JS binding - #2917
Merged
NullVoxPopuli merged 4 commits intoDec 1, 2026
Merged
Conversation
…js/gts In gjs/gts the template compiler resolves a tag against the JS scope around the template, so a tag named like a const, import or parameter is compiled as a component invocation. The rule only tracks block params and misses it.
A module-level `const code = ...` turns `<code>` into an invocation of that value, which fails at render time. Walk the scope chain of the element as well as the block params.
Review follow-up. Configured globals and type-only names (type aliases, interfaces, type imports, type parameters) are not bindings the template compiler sees, so they no longer count. A lowercase binding that is not an element name is a deliberate invocation and is left alone.
ember-eslint-parser already resolves a tag against the JS scope and registers the reference, so the rule asks for that reference and no longer walks the scope chain itself.
NullVoxPopuli
approved these changes
Dec 1, 2026
Contributor
|
tyty! |
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.
In gjs/gts the template compiler resolves a tag against the JS scope around the template: a tag whose name is bound there is a component invocation, whatever its case (
classifyTagin@glimmer/syntax: "In strict mode, values are always elements unless they are in scope"; RFC 779 givesconst foo = <template>...</template>invoked as<foo />; confirmed as intended in glimmerjs/glimmer-vm#1637).So a binding named like an element silently turns that element into an invocation:
This fails at render ("Attempted to load a component, but there wasn't a component manager associated with the definition"), and the rule did not report it because it only tracked block params.
ember-eslint-parseralready resolves for the tag, so there is no scope walk in the rule.ELEMENT_TAGSfromis-native-element). Configured globals, type-only names and a deliberateconst item = Item; <item />are left alone.Verified: the new cases fail before the fix;
pnpm vitest runandpnpm lintpass.