Closed
Description
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?
8.57.0
What version of eslint-plugin-svelte
are you using?
2.35.1
What did you do?
Configuration
extends: ["eslint:recommended", "plugin:svelte/recommended", "plugin:@typescript-eslint/recommended", "plugin:import/recommended", "plugin:import/typescript", "plugin:jest-formatting/strict", "prettier"],
parser: "@typescript-eslint/parser",
parserOptions: {
project: "./tsconfig.json",
extraFileExtensions: [".svelte"],
},
overrides: [
{
files: ["*.svelte"],
parser: "svelte-eslint-parser",
// Parse the `<script>` in `.svelte` as TypeScript by adding the following configuration.
parserOptions: {
parser: "@typescript-eslint/parser",
},
},
{
files: ["**/?(*.)+(spec|test).+(js|ts|svelte)"],
plugins: ["vitest"],
extends: ["plugin:vitest/recommended"],
rules: {
"vitest/consistent-test-it": ["error", { fn: "it" }],
},
},
],
in markup:
{@html `<script>var x = ${50}</script>`}
What did you expect to happen?
svelte eslint to ignore the script block in the string literals. when the parent script is SSR'd the template literal is evaluated, so the underlying script is then valid.
What actually happened?
It seems like svelte-eslint is just looking for any script tag pair in the source files regardless of if its actual syntax or in a string literal.
Link to GitHub Repo with Minimal Reproducible Example
just paste those snippets into any svelte repo and itll break.
Additional comments
No response
Metadata
Metadata
Assignees
Labels
No labels