@@ -143,7 +143,8 @@ 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 : '<template><img class={{unless condition "some-class" "other-class"}}></template>' ,
146+ output :
147+ '<template><img class={{unless condition "some-class" "other-class"}}></template>' ,
147148 errors : [ { messageId : 'negatedHelper' } ] ,
148149 } ,
149150 {
@@ -153,7 +154,8 @@ ruleTester.run('template-no-negated-condition', rule, {
153154 } ,
154155 {
155156 code : '<template>{{input class=(if (not condition) "some-class" "other-class")}}</template>' ,
156- output : '<template>{{input class=(if condition "other-class" "some-class")}}</template>' ,
157+ output :
158+ '<template>{{input class=(if condition "other-class" "some-class")}}</template>' ,
157159 errors : [ { messageId : 'flipIf' } ] ,
158160 } ,
159161 {
@@ -163,12 +165,14 @@ ruleTester.run('template-no-negated-condition', rule, {
163165 } ,
164166 {
165167 code : '<template>{{input class=(unless (not condition) "some-class" "other-class")}}</template>' ,
166- output : '<template>{{input class=(if condition "some-class" "other-class")}}</template>' ,
168+ output :
169+ '<template>{{input class=(if condition "some-class" "other-class")}}</template>' ,
167170 errors : [ { messageId : 'useIf' } ] ,
168171 } ,
169172 {
170173 code : '<template>{{input class=(unless (not (not condition)) "some-class" "other-class")}}</template>' ,
171- output : '<template>{{input class=(unless condition "some-class" "other-class")}}</template>' ,
174+ output :
175+ '<template>{{input class=(unless condition "some-class" "other-class")}}</template>' ,
172176 errors : [ { messageId : 'negatedHelper' } ] ,
173177 } ,
174178 ] ,
@@ -236,7 +240,7 @@ hbsRuleTester.run('template-no-negated-condition', rule, {
236240 code : '{{#if (not (eq c2))}}<img>{{/if}}' ,
237241 options : [ { simplifyHelpers : false } ] ,
238242 } ,
239- // simplifyHelpers: false -- if with nested fixable helpers is valid.
243+ // simplifyHelpers: false — if with nested fixable helpers is valid.
240244 {
241245 code : '<img class={{if (not (gte c 10)) "some-class"}}>' ,
242246 options : [ { simplifyHelpers : false } ] ,
@@ -304,7 +308,8 @@ hbsRuleTester.run('template-no-negated-condition', rule, {
304308 } ,
305309 {
306310 code : '{{#unless (not (not condition))}}<img>{{else if (not (not condition))}}<input>{{/unless}}' ,
307- output : '{{#unless condition}}<img>{{else if (not (not condition))}}<input>{{/unless}}' ,
311+ output :
312+ '{{#unless condition}}<img>{{else if (not (not condition))}}<input>{{/unless}}' ,
308313 errors : [
309314 { message : 'Simplify unnecessary negation of helper.' } ,
310315 { message : 'Simplify unnecessary negation of helper.' } ,
@@ -320,12 +325,14 @@ hbsRuleTester.run('template-no-negated-condition', rule, {
320325 } ,
321326 {
322327 code : '{{#unless (not condition)}}<img>{{else if (not condition)}}<input>{{else}}<hr>{{/unless}}' ,
323- output : '{{#if condition}}<img>{{else if (not condition)}}<input>{{else}}<hr>{{/if}}' ,
328+ output :
329+ '{{#if condition}}<img>{{else if (not condition)}}<input>{{else}}<hr>{{/if}}' ,
324330 errors : [ { message : 'Change `unless (not condition)` to `if condition`.' } ] ,
325331 } ,
326332 {
327333 code : '{{#unless (not condition)}}<img>{{else if (not (not c1 c2))}}<input>{{else}}<hr>{{/unless}}' ,
328- output : '{{#if condition}}<img>{{else if (not (not c1 c2))}}<input>{{else}}<hr>{{/if}}' ,
334+ output :
335+ '{{#if condition}}<img>{{else if (not (not c1 c2))}}<input>{{else}}<hr>{{/if}}' ,
329336 errors : [
330337 { message : 'Change `unless (not condition)` to `if condition`.' } ,
331338 { message : 'Simplify unnecessary negation of helper.' } ,
@@ -339,7 +346,8 @@ hbsRuleTester.run('template-no-negated-condition', rule, {
339346 } ,
340347 {
341348 code : '{{#if condition}}{{else}}{{#if (not condition)}}<img>{{/if}}{{/if}}' ,
342- output : '{{#if condition}}{{else}}{{#unless condition}}<img>{{/unless}}{{/if}}' ,
349+ output :
350+ '{{#if condition}}{{else}}{{#unless condition}}<img>{{/unless}}{{/if}}' ,
343351 errors : [ { message : 'Change `if (not condition)` to `unless condition`.' } ] ,
344352 } ,
345353 {
@@ -419,7 +427,7 @@ hbsRuleTester.run('template-no-negated-condition', rule, {
419427 } ,
420428
421429 // ******************************************
422- // simplifyHelpers: true (explicit) -- BlockStatement
430+ // simplifyHelpers: true (explicit) — BlockStatement
423431 // ******************************************
424432 {
425433 // if (not (not ...)) with simplifyHelpers: true
@@ -443,22 +451,23 @@ hbsRuleTester.run('template-no-negated-condition', rule, {
443451 errors : [ { messageId : 'negatedHelper' } ] ,
444452 } ,
445453 {
446- // unless ... else if with fixable helpers -- two errors with simplifyHelpers: true
454+ // unless ... else if with fixable helpers — two errors with simplifyHelpers: true
447455 code : '{{#unless (not (gt c 10))}}<img>{{else if (not (lt c 5))}}<input>{{/unless}}' ,
448456 output : '{{#unless (lte c 10)}}<img>{{else if (not (lt c 5))}}<input>{{/unless}}' ,
449457 options : [ { simplifyHelpers : true } ] ,
450458 errors : [ { messageId : 'negatedHelper' } , { messageId : 'negatedHelper' } ] ,
451459 } ,
452460 {
453- // unless ... else if ... else -- two errors with simplifyHelpers: true
461+ // unless ... else if ... else — two errors with simplifyHelpers: true
454462 code : '{{#unless (not condition)}}<img>{{else if (not (not c1 c2))}}<input>{{else}}<hr>{{/unless}}' ,
455- output : '{{#if condition}}<img>{{else if (not (not c1 c2))}}<input>{{else}}<hr>{{/if}}' ,
463+ output :
464+ '{{#if condition}}<img>{{else if (not (not c1 c2))}}<input>{{else}}<hr>{{/if}}' ,
456465 options : [ { simplifyHelpers : true } ] ,
457466 errors : [ { messageId : 'useIf' } , { messageId : 'negatedHelper' } ] ,
458467 } ,
459468
460469 // ******************************************
461- // simplifyHelpers: true (explicit) -- MustacheStatement
470+ // simplifyHelpers: true (explicit) — MustacheStatement
462471 // ******************************************
463472 {
464473 // if (not (gte ...)) with simplifyHelpers: true
@@ -476,7 +485,7 @@ hbsRuleTester.run('template-no-negated-condition', rule, {
476485 } ,
477486
478487 // ******************************************
479- // simplifyHelpers: true (explicit) -- SubExpression
488+ // simplifyHelpers: true (explicit) — SubExpression
480489 // ******************************************
481490 {
482491 // if (not (lte ...)) else with simplifyHelpers: true
0 commit comments