Skip to content

Commit caf46da

Browse files
committed
Fix collectChildNodes to include parts during node traversal
1 parent 4ec102b commit caf46da

2 files changed

Lines changed: 10 additions & 0 deletions

File tree

lib/rules/template-no-unused-block-params.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@ function collectChildNodes(n) {
2424
if (n.children) {
2525
children.push(...n.children);
2626
}
27+
// GlimmerPathExpression also has 'parts', so make sure we're not treating
28+
// concat'd path string parts as AST nodes.
29+
if (n.type === 'GlimmerConcatStatement' && n.parts) {
30+
children.push(...n.parts);
31+
}
2732
return children;
2833
}
2934

tests/lib/rules/template-no-unused-block-params.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,11 @@ const invalidHbs = [
118118
output: null,
119119
errors: [{ messageId: 'unusedBlockParam', data: { param: 'cat' } }],
120120
},
121+
{
122+
code: `{{#each cats as |cat|}}{{a.different.cat}}{{/each}}`,
123+
output: null,
124+
errors: [{ messageId: 'unusedBlockParam', data: { param: 'cat' } }],
125+
},
121126
];
122127

123128
function wrapTemplate(entry) {

0 commit comments

Comments
 (0)