storybookjs / addon-svelte-csf

[Incubation] CSF using Svelte components.
MIT License
103 stars 32 forks source link

refactor: Improve AST-related types readability & fix existing issues #209

Closed xeho91 closed 4 weeks ago

xeho91 commented 1 month ago

To summarize, the main objective - fix CI check

What has been done

  1. Update imports & usage for types related to AST nodes.\ I've created two types (namespaces), SvelteAST & ESTreeAST that are used across entire codebase (imported from #parser/ast). I figured when wrapped into two namespaces is it easier to read and to quickly see from which AST they come from. This project is unique for using both Svelte AST and ESTree AST, so I hope this clears possible future confusion.
  2. After updating svelte to latest rc version (where AST types from svelte/compiler are finally exposed), I could see the existing types issues related to previous PR attempts to fix breaking change in Svelte AST (references: #199 #201). So, I solved them + refactored them a little bit with early returns. There are small logic duplications, but I didn't mind them as they are easier to read and maintain than having very long and complicated if/else statements.

What is not included

There are only warnings left with deprecations related to <svelte:component> and <script context="module">. I'd rather them being solved them in separate PRs.

xeho91 commented 1 month ago

Oops, I broke build. Working on it

xeho91 commented 1 month ago

Blocked by: https://github.com/sveltejs/svelte/issues/13135