Skip to content

no-bind-value-on-checkable-inputs

Reports bind:value on a checkbox or a radio button.

The value of such an input is a fixed string, and the state is in checked, so the binding does not follow what the user does.

To fix, use bind:checked, or bind:group for a group of them.

Reported
...
<svelte:head><title>t</title></svelte:head>
...
<input type="checkbox" bind:value={v} bind:checked={v} id={id} {id} bind:group={group} class:on={on}>
...
<C>{#snippet children(x)}{x}{/snippet}</C>
...
After the fix
...
<svelte:head><title>t</title></svelte:head>
...
<input type="checkbox" bind:value={v} bind:checked={v} {id} {id} bind:group class:on>
...
<C>{#snippet children(x)}{x}{/snippet}</C>
...
angular:
lint:
rules:
no-bind-value-on-checkable-inputs: warn # off (default), warn, error
html:
lint:
rules:
no-bind-value-on-checkable-inputs: warn # off (default), warn, error
svelte:
lint:
rules:
no-bind-value-on-checkable-inputs: warn # off (default), warn, error
vue:
lint:
rules:
no-bind-value-on-checkable-inputs: warn # off (default), warn, error

Suppress one line with sudsy-disable-next-line no-bind-value-on-checkable-inputs in a comment of the file’s language.

The same check in other tools; Sudsy reports what each upstream rule reports.

Tool Rule Match
eslint-plugin-svelte no-bind-value-on-checkable-inputs full