Skip to content

False positive svelte/no-unused-props when spreading props since 3.12.4 #1369

@machadinhos

Description

@machadinhos

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.36.0

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

3.12.4

What did you do?

Configuration

The default configuration after creating a svelte app with npx sv create project_name and choosing typescript and eslint.

<!--Test.svelte-->
<script lang="ts">
	interface Props {a: string;}

	let { a, b }: Props = $props();
</script>

{a}
{b}
<!--Test1.svelte-->
<script lang="ts">
	import Test from '$lib/Test.svelte';

	interface Props {a: string;}

	let props: Props = $props();
</script>

<Test {...props} />

On the Test1.svelte component props will have the following error:

'a' is an unused Props property  svelte/no-unused-props

Changing to [email protected] makes the error go away.

Thank you!

What did you expect to happen?

It shouldn't give an error because "a" is in props and props is being spread to <Test1>.

What actually happened?

'a' is an unused Props property  svelte/no-unused-props

Link to GitHub Repo with Minimal Reproducible Example

https://github.com/machadinhos/no-unused-props-bug-demo

Additional comments

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions