@@ -143,8 +143,7 @@ ruleTester.run('template-no-negated-condition', rule, {
143143 } ,
144144 {
145145 code : '<template><img class={{unless (not (not condition)) "some-class" "other-class"}}></template>' ,
146- output :
147- '<template><img class={{unless condition "some-class" "other-class"}}></template>' ,
146+ output : '<template><img class={{unless condition "some-class" "other-class"}}></template>' ,
148147 errors : [ { messageId : 'negatedHelper' } ] ,
149148 } ,
150149 {
@@ -154,8 +153,7 @@ ruleTester.run('template-no-negated-condition', rule, {
154153 } ,
155154 {
156155 code : '<template>{{input class=(if (not condition) "some-class" "other-class")}}</template>' ,
157- output :
158- '<template>{{input class=(if condition "other-class" "some-class")}}</template>' ,
156+ output : '<template>{{input class=(if condition "other-class" "some-class")}}</template>' ,
159157 errors : [ { messageId : 'flipIf' } ] ,
160158 } ,
161159 {
@@ -165,14 +163,12 @@ ruleTester.run('template-no-negated-condition', rule, {
165163 } ,
166164 {
167165 code : '<template>{{input class=(unless (not condition) "some-class" "other-class")}}</template>' ,
168- output :
169- '<template>{{input class=(if condition "some-class" "other-class")}}</template>' ,
166+ output : '<template>{{input class=(if condition "some-class" "other-class")}}</template>' ,
170167 errors : [ { messageId : 'useIf' } ] ,
171168 } ,
172169 {
173170 code : '<template>{{input class=(unless (not (not condition)) "some-class" "other-class")}}</template>' ,
174- output :
175- '<template>{{input class=(unless condition "some-class" "other-class")}}</template>' ,
171+ output : '<template>{{input class=(unless condition "some-class" "other-class")}}</template>' ,
176172 errors : [ { messageId : 'negatedHelper' } ] ,
177173 } ,
178174 ] ,
@@ -308,8 +304,7 @@ hbsRuleTester.run('template-no-negated-condition', rule, {
308304 } ,
309305 {
310306 code : '{{#unless (not (not condition))}}<img>{{else if (not (not condition))}}<input>{{/unless}}' ,
311- output :
312- '{{#unless condition}}<img>{{else if (not (not condition))}}<input>{{/unless}}' ,
307+ output : '{{#unless condition}}<img>{{else if (not (not condition))}}<input>{{/unless}}' ,
313308 errors : [
314309 { message : 'Simplify unnecessary negation of helper.' } ,
315310 { message : 'Simplify unnecessary negation of helper.' } ,
@@ -325,14 +320,12 @@ hbsRuleTester.run('template-no-negated-condition', rule, {
325320 } ,
326321 {
327322 code : '{{#unless (not condition)}}<img>{{else if (not condition)}}<input>{{else}}<hr>{{/unless}}' ,
328- output :
329- '{{#if condition}}<img>{{else if (not condition)}}<input>{{else}}<hr>{{/if}}' ,
323+ output : '{{#if condition}}<img>{{else if (not condition)}}<input>{{else}}<hr>{{/if}}' ,
330324 errors : [ { message : 'Change `unless (not condition)` to `if condition`.' } ] ,
331325 } ,
332326 {
333327 code : '{{#unless (not condition)}}<img>{{else if (not (not c1 c2))}}<input>{{else}}<hr>{{/unless}}' ,
334- output :
335- '{{#if condition}}<img>{{else if (not (not c1 c2))}}<input>{{else}}<hr>{{/if}}' ,
328+ output : '{{#if condition}}<img>{{else if (not (not c1 c2))}}<input>{{else}}<hr>{{/if}}' ,
336329 errors : [
337330 { message : 'Change `unless (not condition)` to `if condition`.' } ,
338331 { message : 'Simplify unnecessary negation of helper.' } ,
@@ -346,8 +339,7 @@ hbsRuleTester.run('template-no-negated-condition', rule, {
346339 } ,
347340 {
348341 code : '{{#if condition}}{{else}}{{#if (not condition)}}<img>{{/if}}{{/if}}' ,
349- output :
350- '{{#if condition}}{{else}}{{#unless condition}}<img>{{/unless}}{{/if}}' ,
342+ output : '{{#if condition}}{{else}}{{#unless condition}}<img>{{/unless}}{{/if}}' ,
351343 errors : [ { message : 'Change `if (not condition)` to `unless condition`.' } ] ,
352344 } ,
353345 {
@@ -460,8 +452,7 @@ hbsRuleTester.run('template-no-negated-condition', rule, {
460452 {
461453 // unless ... else if ... else — two errors with simplifyHelpers: true
462454 code : '{{#unless (not condition)}}<img>{{else if (not (not c1 c2))}}<input>{{else}}<hr>{{/unless}}' ,
463- output :
464- '{{#if condition}}<img>{{else if (not (not c1 c2))}}<input>{{else}}<hr>{{/if}}' ,
455+ output : '{{#if condition}}<img>{{else if (not (not c1 c2))}}<input>{{else}}<hr>{{/if}}' ,
465456 options : [ { simplifyHelpers : true } ] ,
466457 errors : [ { messageId : 'useIf' } , { messageId : 'negatedHelper' } ] ,
467458 } ,
0 commit comments