Skip to content

Commit 434be3b

Browse files
committed
revert: drop component detection broadening in template-no-passed-in-event-handlers
Removes the PascalCase-OR-@-OR-this.-OR-dot heuristic and the associated tests for <this.MyComponent>, <@someComponent>, <ns.Widget>, <my-button>, <custom-el>. Reverts to master's PascalCase-only gate. Better addressed by scope analysis once ember-eslint-parser exposes richer HBS scope — revisit as a separate PR then. Keeps the ignore-config format fix (argName without @) and the event list alignment with upstream.
1 parent 11c6e20 commit 434be3b

File tree

2 files changed

+2
-31
lines changed

2 files changed

+2
-31
lines changed

lib/rules/template-no-passed-in-event-handlers.js

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -77,19 +77,10 @@ module.exports = {
7777

7878
return {
7979
GlimmerElementNode(node) {
80-
// Only check component invocations. In GTS, dashed tags like <my-button>
81-
// are HTML (imports can't have dashes); lowercase non-dashed tags are
82-
// HTML. Components are PascalCase, @-prefixed args, this.-prefixed
83-
// references, or dot-paths (re-exports).
84-
const isComponent =
85-
/^[A-Z]/.test(node.tag) ||
86-
node.tag.startsWith('@') ||
87-
node.tag.startsWith('this.') ||
88-
node.tag.includes('.');
89-
if (!isComponent) {
80+
// Only check component invocations (PascalCase)
81+
if (!/^[A-Z]/.test(node.tag)) {
9082
return;
9183
}
92-
9384
// Skip built-in Input/Textarea
9485
if (node.tag === 'Input' || node.tag === 'Textarea') {
9586
return;

tests/lib/rules/template-no-passed-in-event-handlers.js

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,6 @@ ruleTester.run('template-no-passed-in-event-handlers', rule, {
3636
'<template><Input @click={{this.handleClick}} /></template>',
3737
'<template><Textarea @click={{this.handleClick}} /></template>',
3838

39-
// HTML elements are not checked (in GTS <my-button> is HTML, not a component)
40-
'<template><my-button @click={{this.handleClick}} /></template>',
41-
'<template><custom-el @submit={{this.handleSubmit}} /></template>',
42-
4339
// mouseMove/mouseEnter/mouseLeave are not Ember classic-event aliases
4440
'<template><Foo @mouseMove={{this.handleMove}} /></template>',
4541
'<template><Foo @mouseEnter={{this.handleEnter}} /></template>',
@@ -105,22 +101,6 @@ ruleTester.run('template-no-passed-in-event-handlers', rule, {
105101
output: null,
106102
errors: [{ messageId: 'unexpected' }],
107103
},
108-
// Non-PascalCase component forms: this.-prefixed, @-prefixed, dot-path
109-
{
110-
code: '<template><this.MyComponent @click={{this.handleClick}} /></template>',
111-
output: null,
112-
errors: [{ messageId: 'unexpected' }],
113-
},
114-
{
115-
code: '<template><@someComponent @click={{this.handleClick}} /></template>',
116-
output: null,
117-
errors: [{ messageId: 'unexpected' }],
118-
},
119-
{
120-
code: '<template><ns.Widget @submit={{this.handleSubmit}} /></template>',
121-
output: null,
122-
errors: [{ messageId: 'unexpected' }],
123-
},
124104
{
125105
code: '<template>{{foo click=this.handleClick}}</template>',
126106
output: null,

0 commit comments

Comments
 (0)