Skip to content

Post-merge-review: Fix template-no-chained-this autofix: also update the closing tag#2656

Merged
NullVoxPopuli merged 1 commit intoember-cli:masterfrom
johanrd:night_fix/template-no-chained-this
Apr 13, 2026
Merged

Post-merge-review: Fix template-no-chained-this autofix: also update the closing tag#2656
NullVoxPopuli merged 1 commit intoember-cli:masterfrom
johanrd:night_fix/template-no-chained-this

Conversation

@johanrd
Copy link
Copy Markdown
Contributor

@johanrd johanrd commented Apr 13, 2026

What's broken on master

For GlimmerElementNode autofix, master replaces only the opening tag name. For non-self-closing elements this produces invalid HTML:

<this.this.Component>content</this.this.Component>
→ <this.Component>content</this.this.Component>   ❌

Fix

When !node.selfClosing, return a second replaceTextRange for the closing tag name. Upstream gets this for free because it mutates node.tag directly and ember-template-recast serializes both tags from the single property (no-chained-this.js L28). The port's ESLint fixer operates on text ranges, so both tags need explicit handling.

Test plan

  • 13/13 tests pass on the branch
  • 1 new invalid test (<this.this.Foo>text</this.this.Foo>) fails on master with a parse error in the autofix output

Co-written by Claude.

…g elements

The GlimmerElementNode fixer only replaced the opening tag name but not
the closing tag, causing a parse error in autofix output for elements
like <this.this.Component>content</this.this.Component>. Now both tags
are fixed correctly.
@johanrd johanrd marked this pull request as ready for review April 13, 2026 10:28
@NullVoxPopuli NullVoxPopuli merged commit f812d80 into ember-cli:master Apr 13, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants