Repository: sveltejs/eslint-plugin-svelte (ts)

Issue:
svelte/no-useless-mustaches breaks on string literals containing `{}`
### Before You File a Bug Report Please Confirm You Have Done The Following...

- [x] I have tried restarting my IDE and the issue persists.
- [x] I have updated to the latest version of the packages.

### What version of ESLint are you using?

9.21.0

### What version of `eslint-plugin-svelte` are you using?

3.0.0

### What did you do?

<details>
<summary>Configuration</summary>

```js
import js from "@eslint/js";
import svelte from 'eslint-plugin-svelte';

export default [
  js.configs.recommended,
  ...svelte.configs['flat/recommended'],
];
```
</details>

```svelte
Example: <code>import {'{ db }'} from '$lib/db'</code>
```


### What did you expect to happen?

`eslint-plugin-svelte` should detect that the string literal contains curly braces, and therefore should be left untouched.

### What actually happened?

```
Error:   61:39  error  Unexpected mustache interpolation with a string literal value  svelte/no-useless-mustaches
```

--fix:

```svelte
Example: <code>import {db} from '$lib/db'</code>
                       ^~ Cannot find name db.
```

### Link to **GitHub Repo** with Minimal Reproducible Example

https://eslint-online-playground.netlify.app/#eNp9kL1uwzAMhF9F4KIlkXc3CDr0LaIMhkUbcvUHSw5SGHr3UpYDJEOyEbjvjkeuEOe+wXtng0ERb2gSQguncF75yhLGxDLPpyac4QAYjXZJ9N4NehRTJFDb4OfEpsiG2Vsm4btCzRQlfEm36zW4MrwSx2CWUbtjlTix0uF9oxUO3WISu0jHKHpfGMWMvbcWnUJ1KJIQe+MHceGD6VLzxPErkVcKp/qh63+7Eam4d1R9LRES0l9ACS1N1qvF0LxlS1B4+8FQUlyvkc5p2WYp2vOVxUpb6VW7tQBVfyPW0h+dr995RQuZpcuQ/wGDdZfc

### Additional comments

_No response_

Pull request description:
fix: account for mustache inside mustache
Fixes #1090

Patch:
diff --git a/.changeset/better-rice-join.md b/.changeset/better-rice-join.md
new file mode 100644
index 0000000..aaaa000
--- /dev/null
+++ b/.changeset/better-rice-join.md
@@ -0,0 +1,5 @@
+---
+'eslint-plugin-svelte': patch
+---
+
+fix: Don't remove mustache'd string literals if they contain curly braces
diff --git a/packages/eslint-plugin-svelte/src/rules/no-useless-mustaches.ts b/packages/eslint-plugin-svelte/src/rules/no-useless-mustaches.ts
index 169cc8e..05d3af2 100644
--- a/packages/eslint-plugin-svelte/src/rules/no-useless-mustaches.ts
+++ b/packages/eslint-plugin-svelte/src/rules/no-useless-mustaches.ts
@@ -85,6 +85,10 @@ export default createRule('no-useless-mustaches', {
 				return;
 			}
 
+			if (rawValue.includes('{')) {
+				return;
+			}
+
 			let hasEscape = false;
 			if (rawValue !== strValue) {
 				// check escapes


Test patch:
diff --git a/packages/eslint-plugin-svelte/tests/fixtures/rules/no-useless-mustaches/valid/valid-test01-input.svelte b/packages/eslint-plugin-svelte/tests/fixtures/rules/no-useless-mustaches/valid/valid-test01-input.svelte
index 5da305a..46402ae 100644
--- a/packages/eslint-plugin-svelte/tests/fixtures/rules/no-useless-mustaches/valid/valid-test01-input.svelte
+++ b/packages/eslint-plugin-svelte/tests/fixtures/rules/no-useless-mustaches/valid/valid-test01-input.svelte
@@ -8,5 +8,6 @@ foo 'foo'
 {1}
 {null}
 {`foo${foo}`}
+{'{foo'}
 
 <div data-text="foo 'foo' {foo} {'foo' || 'bar'} {1} {null}" />