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.24.0
What version of eslint-plugin-svelte
are you using?
3.5.1
What did you do?
Configuration
Default from sv create
:
import js from '@eslint/js';
import { includeIgnoreFile } from '@eslint/compat';
import svelte from 'eslint-plugin-svelte';
import globals from 'globals';
import { fileURLToPath } from 'node:url';
import ts from 'typescript-eslint';
import svelteConfig from './svelte.config.js';
const gitignorePath = fileURLToPath(new URL('./.gitignore', import.meta.url));
export default ts.config(
includeIgnoreFile(gitignorePath),
js.configs.recommended,
...ts.configs.recommended,
...svelte.configs.recommended,
{
languageOptions: {
globals: { ...globals.browser, ...globals.node }
},
rules: { // typescript-eslint strongly recommend that you do not use the no-undef lint rule on TypeScript projects.
// see: https://typescript-eslint.io/troubleshooting/faqs/eslint/#i-get-errors-from-the-no-undef-rule-about-global-variables-not-being-defined-even-though-there-are-no-typescript-errors
"no-undef": 'off' }
},
{
files: [
'**/*.svelte',
'**/*.svelte.ts',
'**/*.svelte.js'
],
ignores: ['eslint.config.js', 'svelte.config.js'],
languageOptions: {
parserOptions: {
projectService: true,
extraFileExtensions: ['.svelte'],
parser: ts.parser,
svelteConfig
}
}
}
);
<script lang="ts">
import { onMount } from 'svelte'
let MyComponent: typeof import('./MyComponent.svelte').default | undefined
onMount(() => {
import('./MyComponent.svelte').then((component) => {
MyComponent = component.default
})
})
</script>
{#if MyComponent}
<!-- svelte-ignore reactive-component -->
<MyComponent />
{/if}
What did you expect to happen?
No errors, because this comment works to successfully ignore the reactive-component
runtime warning
What actually happened?
Gives this error:
svelte-ignore comment is used, but not warned svelte/no-unused-svelte-ignore
Link to GitHub Repo with Minimal Reproducible Example
https://github.com/probablykasper/svelte-ignore-reactive-component-bug
Additional comments
No response
Metadata
Metadata
Assignees
Labels
No labels