Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
jackvanderbilt-visma opened this issue Nov 15, 2024 · 3 comments
Open

Comments

@jackvanderbilt-visma
Copy link

jackvanderbilt-visma commented Nov 15, 2024

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

@dominikg dominikg transferred this issue from sveltejs/svelte Nov 15, 2024
@benmccann
Copy link
Member

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
Copy link
Member

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
Copy link
Author

jackvanderbilt-visma commented Nov 18, 2024

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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants