sveltejs / eslint-plugin-svelte

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

Rule 'no-use-before-define' from eslint #674

Open alkorlos opened 5 months ago

alkorlos commented 5 months ago

Description

Hello, thanks for the great tool

Eslint have rule 'no-use-before-define', it is useful in many situations, but have problem with Svelte:

+layout.svelte

<Header />

<script>
    import Header from '$lib/components/header/Header.svelte';
</script>

Will result: error 'Header' was used before it was defined no-use-before-define. This is correct behavior to JS, but not to Svelte.

Is there any way to improve compatibility?

DMartens commented 2 months ago

Also ran into this. When contributing this rule, should it support coarse options extending the existing options like props and components or just allow any reference outside the Githubissues.

  • Githubissues is a development platform for aggregating issues.