Skip to content

shorthand-attribute

Reports name={name} where the shorthand {name} would do. The fix writes the shorthand.

The name is written twice for nothing, and one form keeps the components uniform.

To fix, write {name}; the fix does it.

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:
shorthand-attribute: warn # off (default), warn, error
html:
lint:
rules:
shorthand-attribute: warn # off (default), warn, error
svelte:
lint:
rules:
shorthand-attribute: warn # off (default), warn, error
vue:
lint:
rules:
shorthand-attribute: warn # off (default), warn, error

Suppress one line with sudsy-disable-next-line shorthand-attribute 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 shorthand-attribute full