Skip to content

Commit

Permalink
fix: account for mustache inside mustache (#1091)
Browse files Browse the repository at this point in the history
  • Loading branch information
ottomated authored Feb 26, 2025
1 parent 28200aa commit 83da078
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/better-rice-join.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'eslint-plugin-svelte': patch
---

fix: Don't remove mustache'd string literals if they contain curly braces
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@ export default createRule('no-useless-mustaches', {
return;
}

if (rawValue.includes('{')) {
return;
}

let hasEscape = false;
if (rawValue !== strValue) {
// check escapes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@ foo 'foo'
{1}
{null}
{`foo${foo}`}
{'{foo'}

<div data-text="foo 'foo' {foo} {'foo' || 'bar'} {1} {null}" />

0 comments on commit 83da078

Please sign in to comment.