feat: skip Ember 7.1 built-in template keywords in scope registration#211
Merged
NullVoxPopuli merged 2 commits intoMay 15, 2026
Merged
Conversation
ember-source 7.1 ships 14 built-in template keywords (and, array, element, eq, fn, gt, gte, hash, lt, lte, neq, not, on, or) that can be referenced in strict-mode templates without an explicit import. @glimmer/syntax's isKeyword table predates these, so registerPathExpression was lifting them into JS scope and ESLint's no-undef would flag bare references like {{eq}} or {{on "click" handler}}.
Add a small helper that gates on the consumer's resolved ember-source version (>=7.1) and bails out of scope registration for the 14 names. Pre-7.1 projects keep their existing behaviour, so typos still surface as no-undef. The version probe is wrapped in try/catch and cached, so per-identifier cost is a Set lookup.
b2966ab to
dcd1227
Compare
Per upstream review: when a user explicitly imports a 7.1 built-in (e.g. `import { eq } from 'ember-truth-helpers'`) or otherwise binds the name in JS scope, the import must still be marked as used. Previously the bail-out fired before `findVarInParentScopes`, so `no-unused-vars` would flag the import.
Move the keyword bail-out below the scope lookup and only skip registration when there is no local binding. Add a test-only `_setEmberSourceVersionForTesting` helper plus end-to-end Linter coverage for: bare 7.1 keyword on >=7.1 (no no-undef), imported 7.1 keyword (no no-unused-vars + no no-undef), unrelated free identifier (still no-undef), bare 7.1 keyword on <7.1 (still no-undef), and bare 7.1 keyword when ember-source is unresolvable (still no-undef).
NullVoxPopuli
approved these changes
May 15, 2026
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.
ember-source 7.1 ships 14 built-in template keywords (and, array, element, eq, fn, gt, gte, hash, lt, lte, neq, not, on, or) that can be referenced in strict-mode templates without an explicit import. @glimmer/syntax's isKeyword table predates these, so registerPathExpression was lifting them into JS scope and ESLint's no-undef would flag bare references like {{eq}} or {{on "click" handler}}.
Add a small helper that gates on the consumer's resolved ember-source version (>=7.1) and bails out of scope registration for the 14 names. Pre-7.1 projects keep their existing behaviour, so typos still surface as no-undef. The version probe is wrapped in try/catch and cached, so per-identifier cost is a Set lookup.