Skip to content

Commit ac7115c

Browse files
authored
fix: account for \n and \r in TemplateLiteral handling for the no-useless-mustaches rule (#1040)
1 parent 38a963b commit ac7115c

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

.changeset/old-numbers-pull.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'eslint-plugin-svelte': patch
3+
---
4+
5+
fix: account for \n and \r in `TemplateLiteral` handling for the `no-useless-mustaches` rule

packages/eslint-plugin-svelte/src/rules/no-useless-mustaches.ts

+4
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,10 @@ export default createRule('no-useless-mustaches', {
8181
return;
8282
}
8383

84+
if (expression.type === 'TemplateLiteral' && /[\n\r]/.test(rawValue)) {
85+
return;
86+
}
87+
8488
let hasEscape = false;
8589
if (rawValue !== strValue) {
8690
// check escapes
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<HyperMD
2+
value={`# Doc
3+
4+
Text goes here`}
5+
/>

0 commit comments

Comments
 (0)