efstajas / svelte-stepper

🚶 A simple library for building delightfully animated stepped flows with Svelte.
https://svelte-stepper.jason-e.dev
145 stars 4 forks source link

Update to Svelte 4 #5

Closed walker-tx closed 11 months ago

walker-tx commented 1 year ago

Svelte 4

This PR introduces the updates necessary to make the package compatible with Svelte 4 and associated tooling.

Why?

I used this wonderful library in my Svelte 4 project, and pnpm keeps warning me that the required peer dependency of svelte 3.x is not present. 🙃

Tooling

ESLint

The ESLint plugin for Svelte was changed to eslint-plugin-svelte since eslint-plugin-svelte3 was declared deprecated.

no-undef was set to off for Svelte files in order to better support the new generics syntax. Typescript and svelte-check will intervene here if there is indeed an undefined variable being used, so this shouldn't diminish type safety here.

Prettier

Prettier was updated. It's pluginSearchDirs config was deprecated. So, I removed that option from the rc file, and also the package.json scripts.

NOTE: I did run the format script. In some files, this only changed their tabbing.

Other

Dispatch Types

When using the never type for dispatch events, typescript is still expecting a variable to be passed, so it throws an error (Expected 2-3 arguments but received only 1 ...) when using the respective dispatch event. I changed these to null | undefined to fix the typescript error. Plus, null can now be passed as an argument in order to access the dispatch options arg.

netlify[bot] commented 1 year ago

Deploy Preview for spectacular-kheer-1e8435 ready!

Name Link
Latest commit 7090d533c715a9b0e6cbbff40603ab18682a5811
Latest deploy log https://app.netlify.com/sites/spectacular-kheer-1e8435/deploys/64f0cedf40f8790008e9a72a
Deploy Preview https://deploy-preview-5--spectacular-kheer-1e8435.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

shimkiv commented 11 months ago

Hey folks, out of curiosity, why peer dependency on Svelte 3 was not updated as well? NPM still complains when used with Svelte 4 projects... cc @wlockiv @efstajas

efstajas commented 11 months ago

Hey @shimkiv, sorry for that, just an oversight. The svelte projects I work on are currently still on Svelte 3, so I didn't notice this. Just uploaded v0.2.1 which should fix it, can you give it a try?

shimkiv commented 11 months ago

Ah, got it!

can you give it a try

Works perfectly, thank you so much!