Skip to content

Post-merge-review: Fix template-no-passed-in-event-handlers: correct event list, fix ignore-config format, broaden component detection#2662

Open
johanrd wants to merge 1 commit intoember-cli:masterfrom
johanrd:night_fix/template-no-passed-in-event-handlers
Open

Post-merge-review: Fix template-no-passed-in-event-handlers: correct event list, fix ignore-config format, broaden component detection#2662
johanrd wants to merge 1 commit intoember-cli:masterfrom
johanrd:night_fix/template-no-passed-in-event-handlers

Conversation

@johanrd
Copy link
Copy Markdown
Contributor

@johanrd johanrd commented Apr 13, 2026

What's broken on master

Two independent issues:

  1. ignore config format broken for angle-bracket invocations. The port compares ignoredAttrs.includes(attr.name) where attr.name === '@click'. The docs say to configure { Foo: ['click'] } (bare name, no @) — but with the current code that never matches. Upstream slices the @ off first (no-passed-in-event-handlers.js L107–112) and explicitly rejects @-prefixed ignore entries as invalid config (L58).
  2. Component detection misses non-PascalCase component forms. Master's /^[A-Z]/.test(node.tag) gate silently skips <this.X>, <@x>, and <ns.X> — all valid GTS component invocations per the template tag format guide. The port needs some HTML-vs-component discrimination because it has no JS scope tracker.

Fix

  • Match ignore config against argName (the @-stripped form).
  • Replace the PascalCase gate with: PascalCase OR starts with @ OR starts with this. OR contains .. Lowercase/kebab-case tags (<my-button>) are treated as HTML — correct in GTS (imports can't have dashes) and a reasonable approximation in HBS (@arg={{handler}} on a true HTML element is nonsensical).

Test plan

  • 75/75 tests pass on the branch
  • 3 new invalid tests for <this.MyComponent>, <@someComponent>, <ns.Widget> fail on master (PascalCase gate silently skips them)
  • 2 new valid tests for <my-button> / <custom-el> confirm HTML elements are not checked
  • 8 existing tests changed from ['@click'] to ['click'] (the documented format). All 8 fail on master with the format fix reverted.

Co-written by Claude.

…e config with upstream

- Remove mouseMove, mouseEnter, mouseLeave from event list (not in upstream)
- Use bare names (without @) in ignore config for angle bracket invocations
- Remove unnecessary PascalCase gate on ElementNode visitor
@johanrd johanrd force-pushed the night_fix/template-no-passed-in-event-handlers branch from be7fce9 to 050d2bf Compare April 13, 2026 10:01
@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