@@ -24,6 +24,11 @@ ruleTester.run('template-no-model-argument-in-route-templates', rule, {
2424 filename : 'app/components/user-card.gjs' ,
2525 code : '<template>{{@model}}</template>' ,
2626 } ,
27+ // Partial templates (basename starts with '-') are skipped.
28+ {
29+ filename : 'app/templates/-partial.hbs' ,
30+ code : '<template>{{@model.foo}}</template>' ,
31+ } ,
2732
2833 '<template>{{model}}</template>' ,
2934 '<template>{{@modelythingy}}</template>' ,
@@ -60,6 +65,19 @@ ruleTester.run('template-no-model-argument-in-route-templates', rule, {
6065 output : '<template>{{this.model.foo.bar}}</template>' ,
6166 errors : [ { messageId : 'noModelArgumentInRouteTemplates' } ] ,
6267 } ,
68+ // .gjs route templates are also linted (not gated to .hbs).
69+ {
70+ filename : 'app/routes/posts.gjs' ,
71+ code : '<template>{{@model.foo}}</template>' ,
72+ output : '<template>{{this.model.foo}}</template>' ,
73+ errors : [ { messageId : 'noModelArgumentInRouteTemplates' } ] ,
74+ } ,
75+ // Unknown path defaults to lint (matches upstream).
76+ {
77+ code : '<template>{{@model.foo}}</template>' ,
78+ output : '<template>{{this.model.foo}}</template>' ,
79+ errors : [ { messageId : 'noModelArgumentInRouteTemplates' } ] ,
80+ } ,
6381 ] ,
6482} ) ;
6583
@@ -72,6 +90,27 @@ const hbsRuleTester = new RuleTester({
7290} ) ;
7391
7492hbsRuleTester . run ( 'template-no-model-argument-in-route-templates' , rule , {
75- valid : [ '{{model}}' , '{{this.model}}' , '{{@modelythingy}}' , '{{@model}}' ] ,
76- invalid : [ ] ,
93+ valid : [
94+ '{{model}}' ,
95+ '{{this.model}}' ,
96+ '{{@modelythingy}}' ,
97+ // Component templates are not routes.
98+ {
99+ filename : 'app/components/user-card.hbs' ,
100+ code : '{{@model}}' ,
101+ } ,
102+ // Partials (basename starts with '-') are not routes.
103+ {
104+ filename : 'app/templates/-partial.hbs' ,
105+ code : '{{@model.foo}}' ,
106+ } ,
107+ ] ,
108+ invalid : [
109+ // Unknown path defaults to lint.
110+ {
111+ code : '{{@model}}' ,
112+ output : '{{this.model}}' ,
113+ errors : [ { messageId : 'noModelArgumentInRouteTemplates' } ] ,
114+ } ,
115+ ] ,
77116} ) ;
0 commit comments