Skip to content

Commit 1540eea

Browse files
committed
latte processor: vary output for repeated if-blocks
so that it does not warn that we are comparing the same value repeatedly in multiple 'if' statements
1 parent 020a6d5 commit 1540eea

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/preprocessors/latte.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ const LATTE_TAG = /\{(?:[a-zA-Z_$\\/=].*?)\}/gs;
1111
const LATTE_TAG_DOUBLE = /\{\{(?:[a-zA-Z_$\\/=].*?)\}\}/gs;
1212

1313
// Default internal replacement function
14+
let counter = 1;
1415
function defaultReplacement(tagContent) {
1516
let replacedTag = /^(?:=|_|\$|(?:control|link|plink|asset)(?!\w)|\w[\w:\\]*(\(|::))/;
1617

@@ -22,7 +23,7 @@ function defaultReplacement(tagContent) {
2223
}
2324
if (replacedTag.test(tagContent)) {
2425
// so that you can call a method over it and eslint doesn't correct it as quotes
25-
return '[]';
26+
return '[' + (counter++) + ']';
2627
}
2728

2829
return ''; // remove completely

0 commit comments

Comments
 (0)