sveltejs / eslint-plugin-svelte

ESLint plugin for Svelte using AST
https://sveltejs.github.io/eslint-plugin-svelte/
MIT License
307 stars 38 forks source link

@typescript-eslint/no-unused-expressions for $: when upgrading to eslint 9.7.0 #934

Open jackie35er opened 17 hours ago

jackie35er commented 17 hours ago

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

What version of ESLint are you using?

9.7.0

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

2.46.0

What did you do?

Configuration ``` import js from '@eslint/js'; import svelte from 'eslint-plugin-svelte'; import globals from 'globals'; import ts from 'typescript-eslint'; export default ts.config( js.configs.recommended, ...ts.configs.recommended, ...svelte.configs["flat/recommended"], { languageOptions: { globals: { ...globals.browser, ...globals.node } } }, { files: ["**/*.svelte"], languageOptions: { parserOptions: { parser: ts.parser } } }, { ignores: ["build/", ".svelte-kit/", "dist/"] } ); ```
<script lang="ts">

    let value: string;

    $: value, myFunction();

    function myFunction() {
        console.log("Hello World!")
    }

</script>

<input bind:value>

What did you expect to happen?

Nothing

What actually happened?

5:8 error Expected an assignment or function call and instead saw an expression @typescript-eslint/no-unused-expressions

Link to GitHub Repo with Minimal Reproducible Example

https://github.com/jackie35er/svelte-eslint-bug-example/tree/master

Additional comments

No response

ota-meshi commented 4 hours ago

In your example, I don't think you actually use that expression. Could you explain in more detail what the problem is?