-
-
Notifications
You must be signed in to change notification settings - Fork 59
Open
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?
9.39.1
What version of eslint-plugin-svelte are you using?
3.13.0
What did you do?
Configuration
svelte.config.js
import { vitePreprocess } from "@sveltejs/vite-plugin-svelte";
export default {
compilerOptions: {
experimental: {
async: true,
},
},
preprocess: [vitePreprocess()],
};
eslint.config.js
import { defineConfig } from "eslint/config";
import js from "@eslint/js";
import svelte from "eslint-plugin-svelte";
import globals from "globals";
import ts from "typescript-eslint";
import svelteConfig from "./svelte.config.js";
export default defineConfig([
js.configs.recommended,
...ts.configs.recommended,
...svelte.configs.recommended,
{
languageOptions: {
globals: {
...globals.browser,
...globals.node,
},
},
},
{
files: ["**/*.svelte", "**/*.svelte.ts", "**/*.svelte.js"],
languageOptions: {
parserOptions: {
projectService: true,
extraFileExtensions: [".svelte"],
parser: ts.parser,
svelteConfig,
},
},
rules: {
"svelte/valid-compile": "error",
"svelte/no-target-blank": "error",
"svelte/block-lang": [
"error",
{
enforceScriptPresent: true,
enforceStylePresent: false,
script: ["ts"],
style: [null],
},
],
"svelte/button-has-type": "error",
"svelte/no-add-event-listener": "error",
"svelte/no-ignored-unsubscribe": "error",
"prefer-const": "off",
"svelte/prefer-const": [
"error",
{
destructuring: "all",
excludedRunes: [],
},
],
"svelte/prefer-destructured-store-props": "error",
"svelte/require-stores-init": "error",
"svelte/no-top-level-browser-globals": "error",
},
},
]);
<script lang="ts">
/*
* Cannot use `await` in deriveds and template expressions, or at the top level of a component, unless the `experimental.async` compiler option is `true`
https://svelte.dev/e/experimental_async(experimental_async) (eslint svelte/valid-compile)
*/
await new Promise(() => {});
</script>
What did you expect to happen?
No warning/error on the usage of the await inside a template when the experimental.async option is enabled.
What actually happened?
An error.
Link to GitHub Repo with Minimal Reproducible Example
https://github.com/that-richan/svelte-eslint-async
Additional comments
No response
Metadata
Metadata
Assignees
Labels
No labels