Skip to content

Linter error no-unused-vars if property is $bindable and never read #11901

@ptrxyz

Description

@ptrxyz

Describe the bug

Consider this component:

<script lang="ts">
	let { busy = $bindable(false) }: { busy: boolean } = $props()
</script>

<button onclick={() => (busy = true)}>Lock</button>

I create a property busy that's bindable and that I only set, but never read. ESLint reports an "no-unused-vars" error.
I think that's wrong, since the property might be read from a parent component.

Reproduction

  • use example above + eslint with no-unused-vars rule

Logs

No response

System Info

System:
    OS: Linux 6.9 Arch Linux
    CPU: (24) x64 AMD Ryzen 9 5900X 12-Core Processor
    Memory: 53.28 GB / 62.70 GB
    Container: Yes
    Shell: 5.9 - /usr/bin/zsh
  Binaries:
    Node: 20.14.0 - /usr/bin/node
    Yarn: 1.22.22 - /usr/bin/yarn
    npm: 10.8.1 - /usr/bin/npm
    pnpm: 9.1.4 - /usr/bin/pnpm
    bun: 1.1.10 - ~/bin/bun
  Browsers:
    Brave Browser: 125.1.66.118
  npmPackages:
    eslint: ^9.4.0 => 9.4.0 
    svelte: ^5.0.0-next.136 => 5.0.0-next.143

Severity

annoyance

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