@@ -47,7 +47,7 @@ describe('Module: InvalidConditionalBooleanExpression', () => {
4747
4848 expect ( offenses ) . to . have . length ( 1 ) ;
4949 expect ( offenses [ 0 ] . message ) . to . equal (
50- "Liquid lax parsing issue : Expression stops at truthy value '7', ignoring : '1 > 100'" ,
50+ "Syntax is not supported : Expression stops at truthy value '7', and will ignore : '1 > 100'" ,
5151 ) ;
5252
5353 const fixed = applyFix ( source , offenses [ 0 ] ) ;
@@ -60,7 +60,7 @@ describe('Module: InvalidConditionalBooleanExpression', () => {
6060
6161 expect ( offenses ) . to . have . length ( 1 ) ;
6262 expect ( offenses [ 0 ] . message ) . to . equal (
63- "Liquid lax parsing issue : Expression stops at truthy value ''hello'', ignoring : '1 > 100'" ,
63+ "Syntax is not supported : Expression stops at truthy value ''hello'', and will ignore : '1 > 100'" ,
6464 ) ;
6565
6666 const fixed = applyFix ( source , offenses [ 0 ] ) ;
@@ -108,7 +108,7 @@ describe('Module: InvalidConditionalBooleanExpression', () => {
108108
109109 expect ( offenses ) . to . have . length ( 1 ) ;
110110 expect ( offenses [ 0 ] . message ) . to . equal (
111- "Liquid lax parsing issue: Malformed expression starting with invalid token '>'" ,
111+ "Syntax is not supported: Conditional cannot start with '>'. Use a variable or value instead " ,
112112 ) ;
113113
114114 const fixed = applyFix ( source , offenses [ 0 ] ) ;
@@ -128,9 +128,7 @@ describe('Module: InvalidConditionalBooleanExpression', () => {
128128 for ( const testCase of testCases ) {
129129 const offenses = await runLiquidCheck ( LiquidHTMLSyntaxError , testCase . source ) ;
130130 expect ( offenses ) . to . have . length ( 1 ) ;
131- expect ( offenses [ 0 ] . message ) . to . contain (
132- `Malformed expression starting with invalid token '${ testCase . token } '` ,
133- ) ;
131+ expect ( offenses [ 0 ] . message ) . to . contain ( `Conditional cannot start with '${ testCase . token } '` ) ;
134132
135133 const fixed = applyFix ( testCase . source , offenses [ 0 ] ) ;
136134 expect ( fixed ) . to . equal ( '{% if false %}hello{% endif %}' ) ;
@@ -148,9 +146,7 @@ describe('Module: InvalidConditionalBooleanExpression', () => {
148146 for ( const testCase of testCases ) {
149147 const offenses = await runLiquidCheck ( LiquidHTMLSyntaxError , testCase . source ) ;
150148 expect ( offenses ) . to . have . length ( 1 ) ;
151- expect ( offenses [ 0 ] . message ) . to . contain (
152- `Malformed expression starting with invalid token '${ testCase . token } '` ,
153- ) ;
149+ expect ( offenses [ 0 ] . message ) . to . contain ( `Conditional cannot start with '${ testCase . token } '` ) ;
154150
155151 const fixed = applyFix ( testCase . source , offenses [ 0 ] ) ;
156152 expect ( fixed ) . to . equal ( '{% if false %}hello{% endif %}' ) ;
@@ -167,7 +163,7 @@ describe('Module: InvalidConditionalBooleanExpression', () => {
167163 for ( const testCase of testCases ) {
168164 const offenses = await runLiquidCheck ( LiquidHTMLSyntaxError , testCase ) ;
169165 expect ( offenses ) . to . have . length ( 1 ) ;
170- expect ( offenses [ 0 ] . message ) . to . contain ( 'Malformed expression starting with invalid token ' ) ;
166+ expect ( offenses [ 0 ] . message ) . to . contain ( 'Conditional cannot start with' ) ;
171167
172168 const fixed = applyFix ( testCase , offenses [ 0 ] ) ;
173169 expect ( fixed ) . to . equal ( '{% if false %}hello{% endif %}' ) ;
@@ -180,7 +176,7 @@ describe('Module: InvalidConditionalBooleanExpression', () => {
180176
181177 expect ( offenses ) . to . have . length ( 1 ) ;
182178 expect ( offenses [ 0 ] . message ) . to . equal (
183- "Liquid lax parsing issue: Trailing tokens ignored after comparison: 'foobar' " ,
179+ "Syntax is not supported: Conditional is invalid. Anything after '1 == 2' will be ignored " ,
184180 ) ;
185181
186182 const fixed = applyFix ( source , offenses [ 0 ] ) ;
@@ -206,7 +202,7 @@ describe('Module: InvalidConditionalBooleanExpression', () => {
206202 for ( const testCase of testCases ) {
207203 const offenses = await runLiquidCheck ( LiquidHTMLSyntaxError , testCase . source ) ;
208204 expect ( offenses , `Failed for: ${ testCase . description } ` ) . to . have . length ( 1 ) ;
209- expect ( offenses [ 0 ] . message ) . to . contain ( 'Trailing tokens ignored ' ) ;
205+ expect ( offenses [ 0 ] . message ) . to . contain ( 'Anything after ' ) ;
210206 }
211207 } ) ;
212208
@@ -215,7 +211,7 @@ describe('Module: InvalidConditionalBooleanExpression', () => {
215211 const offenses = await runLiquidCheck ( LiquidHTMLSyntaxError , source ) ;
216212
217213 expect ( offenses ) . to . have . length ( 1 ) ;
218- expect ( offenses [ 0 ] . message ) . to . contain ( 'Trailing tokens ignored ' ) ;
214+ expect ( offenses [ 0 ] . message ) . to . contain ( 'Anything after ' ) ;
219215
220216 const fixed = applyFix ( source , offenses [ 0 ] ) ;
221217 expect ( fixed ) . to . equal ( '{% if 10 > 4 %}hello{% endif %}' ) ;
@@ -231,7 +227,7 @@ describe('Module: InvalidConditionalBooleanExpression', () => {
231227 for ( const testCase of testCases ) {
232228 const offenses = await runLiquidCheck ( LiquidHTMLSyntaxError , testCase ) ;
233229 expect ( offenses ) . to . have . length ( 1 ) ;
234- expect ( offenses [ 0 ] . message ) . to . contain ( 'Trailing tokens ignored ' ) ;
230+ expect ( offenses [ 0 ] . message ) . to . contain ( 'Anything after ' ) ;
235231 }
236232 } ) ;
237233
@@ -351,13 +347,30 @@ describe('Module: InvalidConditionalBooleanExpression', () => {
351347 for ( const testCase of testCases ) {
352348 const offenses = await runLiquidCheck ( LiquidHTMLSyntaxError , testCase . source ) ;
353349 expect ( offenses ) . to . have . length ( 1 ) ;
354- expect ( offenses [ 0 ] . message ) . to . contain ( 'Trailing tokens ignored after comparison ' ) ;
350+ expect ( offenses [ 0 ] . message ) . to . contain ( 'Anything after' ) ;
355351
356352 const fixed = applyFix ( testCase . source , offenses [ 0 ] ) ;
357353 expect ( fixed ) . to . contain ( testCase . expectedFix ) ;
358354 }
359355 } ) ;
360356
357+ it ( 'should report special message for JavaScript-style operators after literal values' , async ( ) => {
358+ const testCases = [
359+ '{% if true && false %}hello{% endif %}' ,
360+ '{% if false || true %}hello{% endif %}' ,
361+ '{% if "hello" && world %}hello{% endif %}' ,
362+ '{% if 42 || something %}hello{% endif %}' ,
363+ ] ;
364+
365+ for ( const source of testCases ) {
366+ const offenses = await runLiquidCheck ( LiquidHTMLSyntaxError , source ) ;
367+ expect ( offenses ) . to . have . length ( 1 ) ;
368+ expect ( offenses [ 0 ] . message ) . to . contain (
369+ "Use 'and'/'or' instead of '&&'/'||' for multiple conditions" ,
370+ ) ;
371+ }
372+ } ) ;
373+
361374 it ( 'should NOT report an offense for valid logical operators' , async ( ) => {
362375 const validCases = [
363376 '{% if price > 100 and discount < 50 %}hello{% endif %}' ,
0 commit comments