Skip to content

Latest commit

 

History

History
47 lines (31 loc) · 1.62 KB

experimental-require-strict-events.md

File metadata and controls

47 lines (31 loc) · 1.62 KB
pageClass sidebarDepth title description
rule-details
0
svelte/experimental-require-strict-events
require the strictEvents attribute on <script> tags

svelte/experimental-require-strict-events

require the strictEvents attribute on <script> tags

  • This rule has not been released yet.

📖 Rule Details

This rule enforces the presence of the strictEvents attribute on the main <script> tag of all components. This attributes enforces typechecking of events dispatched by the component, e.g. making it a typescript error to listen to any non-existent events. Alternatively, the event types may be defined manually by declaring the $$Events interface. The strictEvents attribute and the $$Events interface are experimental and are documented in svelte RFC #38.

<!-- eslint svelte/experimental-require-strict-events: "error" -->

<!-- ✓ GOOD -->
<script lang="ts" strictEvents>
</script>

<script lang="ts">
  interface $$Events {}
</script>

<!-- ✗ BAD -->
<script lang="ts">
</script>

🔧 Options

Nothing.

🔍 Implementation