Extract rule: template-no-passed-in-event-handlers#2562
Conversation
NullVoxPopuli-ai-agent
left a comment
There was a problem hiding this comment.
Review: template-no-passed-in-event-handlers
Compared against the original ember-template-lint rule no-passed-in-event-handlers.
What looks good
- The event handler set matches the original exactly (including
mouseMove,mouseEnter,mouseLeavewhich the original groups under "Mouse events" rather than having a separate section). InputandTextareaexclusions are correctly handled for both angle-bracket and curly invocations.- The
ignoreoption schema is implemented and mirrors the original's config shape. - Both
.gjsand.hbsparsers are tested, with good coverage of the valid/invalid cases from the original test suite. originallyFrommetadata is present.
Items worth attention
-
ignoreconfig shape differs from original: The original rule'signoreconfig expects attribute names without the@prefix (e.g.,{ ignore: { Foo: ['click'] } }), but the ESLint rule's schema/docs show values with the@prefix (e.g.,['@click', '@submit']). The implementation checksignoredAttrs.includes(attr.name)whereattr.nameincludes@. This means the config format is intentionally different from the original. This is fine as a design choice, but worth calling out explicitly in the docs or a migration note so users porting configs know. The original even validates that ignore values do not start with@. -
Original also checks the
isIgnoredfor curly MustacheStatement: The original rule'sisIgnoredis called for bothElementNodeandMustacheStatement. In this PR, theGlimmerMustacheStatementhandler does not check theignoreconfig at all. This means users cannot configure ignores for curly-style component invocations ({{foo click=...}}). -
Missing
mouseMove,mouseEnter,mouseLeavein original's event set note: Minor -- the original hasfocusInandfocusOutlisted in both the "Mouse events" and "Form events" sections (duplicated in the Set). Your implementation correctly has them only once in the Set, which is fine. -
No tests for the
ignoreoption: The original test suite includes test cases for theignoreconfig (both angle-bracket and curly). The PR tests don't exercise theignoreoption at all.
Suggestions
- Add tests exercising the
ignoreoption for both<Component>and{{component}}invocations. - Add ignore support to the
GlimmerMustacheStatementhandler to match the original. - Clarify in the docs that the ignore config uses
@-prefixed names (unlike the original).
Overall a solid migration. The core detection logic is faithful to the original.
🤖 Automated review comparing with ember-template-lint source
The `ignore` option was only applied to angle bracket invocations (GlimmerElementNode) but not to curly-style invocations (GlimmerMustacheStatement). This adds the same ignore lookup using `path.original` as the component name for curly invocations. Also adds tests for the `ignore` option covering both angle bracket and curly invocations in both gjs and hbs test suites. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
bafc999 to
cff1c83
Compare
Split from #2371.