@@ -58,83 +58,65 @@ const ruleTesterTyped = new RuleTester({
5858
5959ruleTesterTyped . run ( 'template-no-deprecated (with TS project)' , rule , {
6060 valid : [
61- // Non-deprecated component — no error
61+ // Non-deprecated component
6262 {
6363 filename : path . join ( FIXTURES_DIR , 'usage.gts' ) ,
64- code : `
65- import CurrentComponent from './current-component';
66- <template><CurrentComponent /></template>
67- ` ,
64+ code : "import CurrentComponent from './current-component';\n<template><CurrentComponent /></template>" ,
6865 } ,
6966 // Plain HTML tag
7067 {
7168 filename : path . join ( FIXTURES_DIR , 'usage.gts' ) ,
72- code : `
73- <template><div></div></template>
74- ` ,
69+ code : '<template><div></div></template>' ,
7570 } ,
7671 // this.something — no scope reference
7772 {
7873 filename : path . join ( FIXTURES_DIR , 'usage.gts' ) ,
79- code : `
80- <template>{{this.foo}}</template>
81- ` ,
74+ code : '<template>{{this.foo}}</template>' ,
8275 } ,
83- // Non-deprecated @arg — no error
76+ // Non-deprecated @arg
8477 {
8578 filename : path . join ( FIXTURES_DIR , 'usage.gts' ) ,
86- code : `
87- import ComponentWithArgs from './component-with-args';
88- <template><ComponentWithArgs @newArg='x' /></template>
89- ` ,
79+ code : "import ComponentWithArgs from './component-with-args';\n<template><ComponentWithArgs @newArg='x' /></template>" ,
9080 } ,
91- // @arg on a component with no typed Args — silently skip
81+ // @arg on a component with no typed Args
9282 {
9383 filename : path . join ( FIXTURES_DIR , 'usage.gts' ) ,
94- code : `
95- import CurrentComponent from './current-component';
96- <template><CurrentComponent @anyArg='x' /></template>
97- ` ,
84+ code : "import CurrentComponent from './current-component';\n<template><CurrentComponent @anyArg='x' /></template>" ,
9885 } ,
9986 ] ,
10087 invalid : [
10188 // Deprecated component in element position
10289 {
10390 filename : path . join ( FIXTURES_DIR , 'usage.gts' ) ,
104- code : `
105- import DeprecatedComponent from './deprecated-component';
106- <template><DeprecatedComponent /></template>
107- ` ,
91+ code : "import DeprecatedComponent from './deprecated-component';\n<template><DeprecatedComponent /></template>" ,
10892 output : null ,
10993 errors : [ { messageId : 'deprecatedWithReason' , type : 'GlimmerElementNodePart' } ] ,
11094 } ,
11195 // Deprecated helper in mustache position
11296 {
11397 filename : path . join ( FIXTURES_DIR , 'usage.gts' ) ,
114- code : `
115- import { deprecatedHelper } from './deprecated-helper';
116- <template>{{deprecatedHelper}}</template>
117- ` ,
98+ code : "import { deprecatedHelper } from './deprecated-helper';\n<template>{{deprecatedHelper}}</template>" ,
99+ output : null ,
100+ errors : [ { messageId : 'deprecated' , type : 'VarHead' } ] ,
101+ } ,
102+ // Deprecated helper in sub-expression position
103+ {
104+ filename : path . join ( FIXTURES_DIR , 'usage.gts' ) ,
105+ code : "import { deprecatedHelper } from './deprecated-helper';\n<template>{{fn (deprecatedHelper)}}</template>" ,
118106 output : null ,
119107 errors : [ { messageId : 'deprecated' , type : 'VarHead' } ] ,
120108 } ,
121109 // Deprecated component in block position
122110 {
123111 filename : path . join ( FIXTURES_DIR , 'usage.gts' ) ,
124- code : `
125- import DeprecatedComponent from './deprecated-component';
126- <template>{{#DeprecatedComponent}}{{/DeprecatedComponent}}</template>
127- ` ,
112+ code : "import DeprecatedComponent from './deprecated-component';\n<template>{{#DeprecatedComponent}}{{/DeprecatedComponent}}</template>" ,
128113 output : null ,
129114 errors : [ { messageId : 'deprecatedWithReason' , type : 'VarHead' } ] ,
130115 } ,
131116 // Deprecated @arg with reason
132117 {
133118 filename : path . join ( FIXTURES_DIR , 'usage.gts' ) ,
134- code : `
135- import ComponentWithArgs from './component-with-args';
136- <template><ComponentWithArgs @oldArg='x' /></template>
137- ` ,
119+ code : "import ComponentWithArgs from './component-with-args';\n<template><ComponentWithArgs @oldArg='x' /></template>" ,
138120 output : null ,
139121 errors : [
140122 {
@@ -146,10 +128,7 @@ ruleTesterTyped.run('template-no-deprecated (with TS project)', rule, {
146128 // Deprecated @arg without reason
147129 {
148130 filename : path . join ( FIXTURES_DIR , 'usage.gts' ) ,
149- code : `
150- import ComponentWithArgs from './component-with-args';
151- <template><ComponentWithArgs @oldArgNoReason='x' /></template>
152- ` ,
131+ code : "import ComponentWithArgs from './component-with-args';\n<template><ComponentWithArgs @oldArgNoReason='x' /></template>" ,
153132 output : null ,
154133 errors : [ { messageId : 'deprecated' , data : { name : '@oldArgNoReason' } } ] ,
155134 } ,
0 commit comments