sveltejs / cli

The Svelte CLI
MIT License
258 stars 11 forks source link

Add paraglide lib stuff to eslint and prettier ignore files #308

Open jackvanderbilt-visma opened 1 week ago

jackvanderbilt-visma commented 1 week ago

Describe the problem

When I setup a new project I have to manually add src/lib/paraglide to the eslintignore and prettierignore configs.

When making github CI/CD workflows, its annoying to have to do myself, when the CLI could've done this for me.

Describe the proposed solution

Please add them for me automatically.

Importance

nice to have

benmccann commented 6 days ago

I feel like the better solution would be to change outdir: './src/lib/paraglide' to something in .svelte-kit. I'm not that familiar with paraglide or what it's outputting there, but src/lib is meant for source code and not generated output

manuel3108 commented 5 days ago

I feel like the better solution would be to change outdir: './src/lib/paraglide' to something in .svelte-kit. I'm not that familiar with paraglide or what it's outputting there, but src/lib is meant for source code and not generated output

Just tried that out, that does not work as far as I'm aware of. On of the core problems is that we have multiple imports to $lib/paraglide/*, which we could technically rewrite to something like this ../../.svelte-kit/paraglide/*. But this looks pretty ugly and feels strange.

The other problem is that changing messages/en.json used to trigger HMR. After this change it does not. Not only that, but refreshing the page does not bring up the expected result. Only restarting the dev server brings up the result.

Same goes for stuff as ./node_modules/.cache/paraglide as far as i can tell.

jackvanderbilt-visma commented 4 days ago

I feel like the better solution would be to change outdir: './src/lib/paraglide' to something in .svelte-kit. I'm not that familiar with paraglide or what it's outputting there, but src/lib is meant for source code and not generated output

The other problem is that changing messages/en.json used to trigger HMR. After this change it does not. Not only that, but refreshing the page does not bring up the expected result. Only restarting the dev server brings up the result.

Paraglide should ideally implement a virtual module for translation files and utilize Vite's APIs to trigger HMR when needed, rather than writing files directly to the watched directory . That would remove the need for those files to be written to the filesystem entirely, which will improve build and dev performance too.


Sidenote: During my experience with webpack, I learned that the ~/node_modules/.cache folder is widely regarded as the go-to location for temporary files in the Node.js ecosystem. Unrelated but kinda to this issue; i think it would be great if SvelteKit adopted this folder instead of using ~/.svelte-kit. This change would help keep the root directory of a project clean and organized. I also store my ESLint and Prettier caches there, which has proven to be highly efficient—especially for speeding up GitHub Actions. Having the caches all in one place simplifies cache maintenance quite a lot. It would be fantastic if SvelteKit could configure caches there for Prettier and eslint automatically through the cli create command.

edit: _(I just realized after writing this that I can probably configure the ~/.svelte-kit directory location, so I can choose to use the ~/node_modules/.cache folder myself)._