-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Description
Describe the problem
There is an "Update" button that reloads some data. It can be disabled.
{#snippet updateButton(updating: boolean)}
<button type="button" disabled={updating} onclick={/* update */}>
Update
</button>
{/snippet}
When the data is being updated the button is disabled until the update finishes:
{#await updateableData}
{@render updateButton(true)}
{:then loadedData}
{@render updateButton(false)}
{/await}
The button doesn't really care about loadedData and doesn't use it - it only cares about updateableData resolvness.
The problem is, the linter is gonna mark the unused variable with a warning:

At the moment I can suppress the warning and provide a telling name:
<!--eslint-disable-next-line-->
{:then dontNeedThisHere}
Describe the proposed solution
There could be a way to not introduce the variable in the first place.
One option is to allow to just do
{:then}
without a name. But maybe that's not the best idea because most of the times you'd probably be interested in the variable and the error is a useful reminder.
A better option is to allow to explicitly opt out of a variable. Like, for example, the lambdas do it:
{:then ()}
Or:
{:then {}}
, but that results in ESLint: Unexpected empty object pattern currently.
Importance
nice to have