We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
require-slot-types
It is possible to add types to component slots and their props:
<script lang="ts"> interface $$Slots { default: { prop: boolean; }; } </script> <slot prop={true} />
I would like to propose a rule to enforce these slot types.
The rule should report any component that includes a <slot> and does not declare the $$Slots interface.
<slot>
$$Slots
<!-- ✓ GOOD --> <script> </script> <b>No slots here!</b> <script> interface $$Slots { default: Record<string, never>; } </script> <slot /> <script lang="ts"> interface $$Slots { default: { prop: boolean; }; } </script> <slot prop={true} /> <script lang="ts"> interface $$Slots { named: Record<string, never>; } </script> <slot name = "named" /> <!-- ✗ BAD --> <script> </script> <slot />
The relevant RFC.
The text was updated successfully, but these errors were encountered:
Memo: New rule should be marked as experimental until the RFC is merged. sveltejs/rfcs#38
See also: #345 (comment)
Sorry, something went wrong.
Relevant PR: sveltejs/language-tools#1058
block-lang
Successfully merging a pull request may close this issue.
Motivation
It is possible to add types to component slots and their props:
I would like to propose a rule to enforce these slot types.
Description
The rule should report any component that includes a
<slot>
and does not declare the$$Slots
interface.Examples
Additional comments
The relevant RFC.
The text was updated successfully, but these errors were encountered: