Skip to content

Post-merge-review: Fix template-no-at-ember-render-modifiers: detect GJS/GTS imports#2664

Open
johanrd wants to merge 1 commit intoember-cli:masterfrom
johanrd:night_fix/template-no-at-ember-render-modifiers
Open

Post-merge-review: Fix template-no-at-ember-render-modifiers: detect GJS/GTS imports#2664
johanrd wants to merge 1 commit intoember-cli:masterfrom
johanrd:night_fix/template-no-at-ember-render-modifiers

Conversation

@johanrd
Copy link
Copy Markdown
Contributor

@johanrd johanrd commented Apr 13, 2026

What's broken on master

The rule matches a hardcoded kebab-case list (did-insert, did-update, will-destroy). That works for classic .hbs where the resolver exposes modifiers by their canonical name, but it misses the GJS/GTS usage entirely:

import didInsert from '@ember/render-modifiers/modifiers/did-insert';

<template>
  <div {{didInsert this.setup}}></div>
</template>

Here the local name is user-chosen (could be didInsert, onInsert, myInsert, anything). The rule has no way to match the user's identifier against the render-modifier import.

Fix

In .gjs/.gts files, track ImportDeclaration nodes whose source is one of @ember/render-modifiers/modifiers/did-insert / did-update / will-destroy, recording the default-import local name → canonical kebab name. Flag modifier usages whose identifier matches a tracked local name. In .hbs, keep the kebab-case matching (matches upstream ember-template-lint exactly — upstream is HBS-only).

Pattern is the same as template-no-builtin-form-components, which already tracks @ember/component imports in strict mode.

Test plan

  • 30/30 tests pass on the branch
  • 4 new invalid GJS tests covering didInsert / didUpdate / willDestroy imports (and a renamed myInsert) fail on master — master silently ignores them all
  • 2 new valid GJS tests confirm that (a) a bare kebab-looking identifier without an import is not flagged, and (b) an unrelated local import named didInsert from a non-render-modifiers path is not flagged
  • Existing HBS tests unchanged (the kebab-case HBS path is preserved)

Co-written by Claude.

In GJS/GTS, @ember/render-modifiers is consumed via per-modifier default
imports (e.g. 'import didInsert from "@ember/render-modifiers/modifiers/did-insert"').
The local name is user-chosen, so the rule can't match on a hardcoded
kebab-case list. Track ImportDeclaration nodes in strict-mode files and
flag modifier usages based on the local import name.

HBS behavior is unchanged: the canonical kebab-case names (did-insert,
did-update, will-destroy) are still flagged via resolver-style matching,
matching upstream ember-template-lint.
@johanrd johanrd marked this pull request as ready for review April 13, 2026 10:29
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.

1 participant