-
- 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.12.4
What did you do?
Configuration
Generated by sv
import { fileURLToPath } from 'node:url'; import { includeIgnoreFile } from '@eslint/compat'; import js from '@eslint/js'; import svelte from 'eslint-plugin-svelte'; import { defineConfig } from 'eslint/config'; import globals from 'globals'; import ts from 'typescript-eslint'; import svelteConfig from './svelte.config.js'; const gitignorePath = fileURLToPath(new URL('./.gitignore', import.meta.url)); export default defineConfig( 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' ], languageOptions: { parserOptions: { projectService: true, extraFileExtensions: ['.svelte'], parser: ts.parser, svelteConfig } } } ); <script lang="ts" module> export class FooController<T = unknown> { #foo: T constructor(foo: T) { this.#foo = foo } get foo() { return this.#foo } } </script> <script lang="ts"> interface Props { ctrl: FooController } let {ctrl}: Props = $props() // Mark `ctrl`/`ctrl.foo` as used void ctrl.foo </script>What did you expect to happen?
Lint passes
What actually happened?
19:5 error '#foo' in 'ctrl' is an unused property svelte/no-unused-props Link to GitHub Repo with Minimal Reproducible Example
https://github.com/echocrow/eslint-plugin-svelte-repro--false-positive-unused-props
Additional comments
Error goes away when the class does not have any generics (i.e. in the above example, remove T = unknown and substitute T with e.g. unknown).
Metadata
Metadata
Assignees
Labels
No labels