svelte-inline-compile
svelte-inline-compile copied to clipboard
Clarify that imports do not need to be within <script> tag
When I was looking at your Readme, the example with the imports inside
On a related note, do you mind if I publicize/advertise your project at all? I feel like I'm the first person to stumble upon it and I feel like this could get much broader adoption. It solves a huge pain point with the framework overall.
That is a great idea! The component that gets generated will have a closure around the imports at the top of the file as well as any variables defined above it in the test function. We should showcase this as a way to decrease boilerplate. The only drawback to the approach is that linters will complain about unused imports/variables since they don’t know that they are being used by the generated component.
It would be awesome if you spread the word! Thank you!
The only drawback to the approach is that linters will complain about unused imports/variables since they don’t know that they are being used by the generated component.
Ah yes, you're right. Actually it's a bit worse than that if you're using TypeScript-- the TS compiler removes all unused imports and shockingly there's no real way to disable that. I ended up adding in a dummy assertion of the form expect(A).not.toBe(B);
to trick the TS compiler.