3 replies
1 recast
1 reaction
2 replies
0 recast
2 reactions
1 reply
0 recast
1 reaction
This is mine:
For Svelte:
• keep value of `$state()` and `$derived()` indented on their own line
• preserve existing double line breaks before comments in `<script>`
• within `<script>`, annotate and order groups of imports and local definitions into sections as follows: Types/constants, Props, Functions, State, Actions, Components, Styles, Transitions/animations
• within a section, sort imports by path, with types placed before values
• always order as `<script>`, `<svelte:head>`, template markup, and `<style>`, with two empty lines between each
• prefer `let { ... }: { ... } = $props()` over `let { ... } = $props<{ ... }>()`; comma after every destructured prop (except ...rest prop)
• prefer inlining logic and derived variables that are only used once into the markup using `{@const}`
• {@const} must be the immediate child of {#snippet}, {#if}, {:else if}, {:else}, {#each}, {:then}, {:catch}, <svelte:fragment>, <svelte:boundary> or <Component> 0 reply
1 recast
1 reaction