-
-
Notifications
You must be signed in to change notification settings - Fork 53
Closed
sveltejs/svelte-eslint-parser
#338Labels
Description
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?
8.40.0
What version of eslint-plugin-svelte
are you using?
2.28.0
What did you do?
<script lang="ts">
import LoadingComponent from "$lib/components/LoadingComponent.svelte";
export let type: "button" | "submit" = "submit";
export let loading = false;
export let variant: "primary" | "secondary" | "error" = "primary";
export let form: string | undefined = undefined;
export let href = "";
$: className =
"w-full h-10 flex flex-row gap-3 justify-center items-center rounded px-4 shadow-md font-normal text-base text-white transition";
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
if (variant === "primary") {
className += " bg-secondary-700 hover:bg-secondary-800";
} else if (variant === "secondary") {
className += " bg-primary-800 hover:bg-primary-900";
} else if (variant === "error") {
className += " bg-error-600";
}
</script>
{#if href}
<a {href} class={className}>
<slot />
</a>
{:else}
<button {form} on:click {type} disabled={loading} class={className}>
{#if loading}
<div class="w-4 h-4 flex justify-center items-center">
<LoadingComponent />
</div>
{:else if // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
$$slots.icon}
<div class="w-6 h-6 flex justify-center items-center">
<slot name="icon" />
</div>
{/if}
<slot />
</button>
{/if}
What did you expect to happen?
No error when checking if slot exsist
What actually happened?
Missing eslint rule?
Link to GitHub Repo with Minimal Reproducible Example
Additional comments
No response