Skip to content

svelte/no-useless-mustaches breaks on string literals containing {} #1090

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
2 tasks done
ottomated opened this issue Feb 26, 2025 · 0 comments · Fixed by #1091
Closed
2 tasks done

svelte/no-useless-mustaches breaks on string literals containing {} #1090

ottomated opened this issue Feb 26, 2025 · 0 comments · Fixed by #1091

Comments

@ottomated
Copy link
Contributor

ottomated commented Feb 26, 2025

Before You File a Bug Report Please Confirm You Have Done The Following...

  • I have tried restarting my IDE and the issue persists.
  • 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?

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

export default [
  js.configs.recommended,
  ...svelte.configs['flat/recommended'],
];
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:

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant