Repository: sveltejs/eslint-plugin-svelte
Pull request #1093 (2025-02-26 10:47:05)

chore: update README
close: https://github.com/sveltejs/eslint-plugin-svelte/issues/1092

changeset-bot[bot]: ###  ⚠️  No Changeset found

Latest commit: 0bd8056ce22e13eb9fe4482ed4e340bb80ae9f1f

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. **If these changes should result in a version bump, you need to add a changeset.**

<details><summary>This PR includes no changesets</summary>

  When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

</details>

[Click here to learn what changesets are, and how to add one](https://github.com/changesets/changesets/blob/main/docs/adding-a-changeset.md).

[Click here if you're a maintainer who wants to add a changeset to this PR](https://github.com/sveltejs/eslint-plugin-svelte/new/chore/update-readme?filename=.changeset/modern-hotels-play.md&value=---%0A%0A---%0A%0Achore%3A%20update%20README%0A)


github-actions[bot]: <!-- posted by pkg.pr.new-comment.mjs -->

## Try the Instant Preview in Online Playground

[ESLint Online Playground](https://eslint-online-playground.netlify.app/?overrideDeps=%7B%22eslint-plugin-svelte%22%3A%22https%3A%2F%2Fpkg.pr.new%2Feslint-plugin-svelte%401093%22%7D#eslint-plugin-svelte%20with%20typescript)

## Install the Instant Preview to Your Local

```
npm i https://pkg.pr.new/eslint-plugin-svelte@1093
```

## Published Instant Preview Packages:

- eslint-plugin-svelte: https://pkg.pr.new/eslint-plugin-svelte@1093

[View Commit](https://github.com/sveltejs/eslint-plugin-svelte/commit/0bd8056ce22e13eb9fe4482ed4e340bb80ae9f1f)

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/README.md b/README.md
index 50140ce..a9902e8 100644
--- a/README.md
+++ b/README.md
@@ -78,14 +78,7 @@ export default [
     }
   },
   {
-    files: [
-      '*.svelte',
-      '**/*.svelte',
-      '*.svelte.ts',
-      '**/*.svelte.ts',
-      '*.svelte.js',
-      '**/*.svelte.js'
-    ],
+    files: ['**/*.svelte', '**/*.svelte.js'],
     languageOptions: {
       parserOptions: {
         // We recommend importing and specifying svelte.config.js.
@@ -132,33 +125,20 @@ export default ts.config(
     }
   },
   {
-    files: ['*.svelte', '**/*.svelte'],
+    files: ['**/*.svelte', '**/*.svelte.ts', '**/*.svelte.js'],
     // See more details at: https://typescript-eslint.io/packages/parser/
     languageOptions: {
       parserOptions: {
         projectService: true,
         extraFileExtensions: ['.svelte'], // Add support for additional file extensions, such as .svelte
-        parser: ts.parser
+        parser: ts.parser,
         // Specify a parser for each language, if needed:
         // parser: {
         //   ts: ts.parser,
         //   js: espree,    // Use espree for .js files (add: import espree from 'espree')
         //   typescript: ts.parser
         // },
-      }
-    }
-  },
-  {
-    files: [
-      '*.svelte',
-      '**/*.svelte',
-      '*.svelte.ts',
-      '**/*.svelte.ts',
-      '*.svelte.js',
-      '**/*.svelte.js'
-    ],
-    languageOptions: {
-      parserOptions: {
+
         // We recommend importing and specifying svelte.config.js.
         // By doing so, some rules in eslint-plugin-svelte will automatically read the configuration and adjust their behavior accordingly.
         // While certain Svelte settings may be statically loaded from svelte.config.js even if you don’t specify it,
diff --git a/docs/user-guide.md b/docs/user-guide.md
index 9af837e..0eba2e2 100644
--- a/docs/user-guide.md
+++ b/docs/user-guide.md
@@ -43,14 +43,7 @@ export default [
     }
   },
   {
-    files: [
-      '*.svelte',
-      '**/*.svelte',
-      '*.svelte.ts',
-      '**/*.svelte.ts',
-      '*.svelte.js',
-      '**/*.svelte.js'
-    ],
+    files: ['**/*.svelte', '**/*.svelte.js'],
     languageOptions: {
       parserOptions: {
         // We recommend importing and specifying svelte.config.js.
@@ -97,33 +90,20 @@ export default ts.config(
     }
   },
   {
-    files: ['*.svelte', '**/*.svelte'],
+    files: ['**/*.svelte', '**/*.svelte.ts', '**/*.svelte.js'],
     // See more details at: https://typescript-eslint.io/packages/parser/
     languageOptions: {
       parserOptions: {
         projectService: true,
         extraFileExtensions: ['.svelte'], // Add support for additional file extensions, such as .svelte
-        parser: ts.parser
+        parser: ts.parser,
         // Specify a parser for each language, if needed:
         // parser: {
         //   ts: ts.parser,
         //   js: espree,    // Use espree for .js files (add: import espree from 'espree')
         //   typescript: ts.parser
         // },
-      }
-    }
-  },
-  {
-    files: [
-      '*.svelte',
-      '**/*.svelte',
-      '*.svelte.ts',
-      '**/*.svelte.ts',
-      '*.svelte.js',
-      '**/*.svelte.js'
-    ],
-    languageOptions: {
-      parserOptions: {
+
         // We recommend importing and specifying svelte.config.js.
         // By doing so, some rules in eslint-plugin-svelte will automatically read the configuration and adjust their behavior accordingly.
         // While certain Svelte settings may be statically loaded from svelte.config.js even if you don’t specify it,
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}" />