fix(template-no-template-lint-directives): unquote rule names when converting - #2832
Merged
NullVoxPopuli merged 1 commit intoAug 2, 2026
Conversation
…nverting
ember-template-lint accepts quoted rule names in its directives — it maps
`unquote` over every name in a `template-lint-disable` / `-enable` list — so
`{{! template-lint-disable "no-log" }}` is a live directive, not a typo.
The conversion fixer pasted the name through verbatim and emitted
`ember/template-"no-log"`, a rule name that matches nothing. Running `--fix`
over a codebase that used quoted names therefore silently dropped those
suppressions.
Mirror upstream's `unquote`: strip only when the first and last character are
the same quote character, so a mismatched quote is still passed through
unchanged.
johanrd
marked this pull request as draft
July 31, 2026 13:21
johanrd
marked this pull request as ready for review
July 31, 2026 13:33
NullVoxPopuli
approved these changes
Aug 2, 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.
Reported during an ember-template-lint → eslint-plugin-ember migration.
Quoted rule names are valid in both linters
unquotehelper over every name in atemplate-lint-disable/template-lint-enablelist (_base.js). Verified against 7.9.3:{{! template-lint-disable "no-invalid-role" }}suppressesno-invalid-role, while{{! template-lint-disable "no-positive-tabindex" }}does not — so quotes really are stripped before matching, and this isn't the "no arguments disables everything" path./* eslint-disable "no-console" */suppressesno-console,/* eslint-disable "no-debugger" */does not, and/* eslint-disable "zzz-nope" */reportsDefinition for rule 'zzz-nope' was not found— quotes already stripped in the message.So this isn't an exotic ember-template-lint-ism being dragged into ESLint; both sides accept it.
It also occurs in the wild. A narrow GitHub code search for the quoted form in
.hbsreturns 16 files (a floor — code search only indexes public repos), including the officialember-learn/ember-website:Problem
The conversion fixer passed the name through verbatim, so the
ember/template-prefix landed outside the quotes:That name is quoted in the middle, so neither linter's unquoting applies. Verified — it does not suppress:
eslint --fixover a codebase using quoted names therefore silently converted working suppressions into dead ones, re-reporting violations the author had deliberately disabled. That is the exact failure this rule exists to prevent.Fix
Unquote each name before prefixing, mirroring upstream's
unquotesemantics: strip only when the first and last character are the same quote character (single or double), so"no-log'and other mismatched-quote inputs still pass through unchanged.Tests
Double-quoted, single-quoted, mixed quoted/unquoted lists,
template-lint-enable, and the mismatched-quote pass-through case.