Skip to content

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

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

Closed
jackvanderbilt-visma opened this issue Nov 15, 2024 · 14 comments · Fixed by #338
Closed

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

jackvanderbilt-visma opened this issue Nov 15, 2024 · 14 comments · Fixed by #338
Labels
bug Something isn't working pkg:add sv add

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

@jackvanderbilt-visma jackvanderbilt-visma closed this as not planned Won't fix, can't repro, duplicate, stale Nov 27, 2024
@manuel3108
Copy link
Member

@jackvanderbilt-visma Would you mind explaining why you closed the issue? I personally do think that this is still relevant

@AdrianGonz97
Copy link
Member

Thinking on this a little more, this is actually related to #334 and #335 given that the eslint isn't including the contents of the .gitignore into it's ignore list. #335 (comment) should resolve this.

@manuel3108
Copy link
Member

I don't think the linked comment will solve this, as we are not even adding ./src/$lib/paraglide to the gitignore at all. So this is still a separate issue in my opinion.

@AdrianGonz97
Copy link
Member

AdrianGonz97 commented Nov 27, 2024

that's because the .gitignore is added to src/lib/paraglide/.gitignore. it should be included in the root .gitignore instead, which would solve the issue

@manuel3108
Copy link
Member

Ohhh, that makes sense. Yeah, that's the paraglide output that's generating that. Reopening for that fix.

@manuel3108 manuel3108 reopened this Nov 27, 2024
@benmccann
Copy link
Member

Agree with the Vite plugin suggestion. I'll file an issue in the paraglide repo about that

Just FYI, .svelte-kit is not a cache. It's intermediate build output. It's a build that you can run with pnpm preview. And if you build with an adapter it will do a second build using that output as source

@jackvanderbilt-visma
Copy link
Author

@jackvanderbilt-visma Would you mind explaining why you closed the issue? I personally do that this is still relevant

My apologies! I was closing issues on this account because in the future I will no longer have access to it. This one was the only one I planned not to close as it was still relevant and useful to myself too.

@jackvanderbilt-visma

This comment was marked as off-topic.

@benmccann

This comment was marked as off-topic.

@jackvanderbilt-visma

This comment was marked as off-topic.

@samuelstroschein
Copy link
Contributor

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.

For context: That's why Paraglide JS compiles into /src. Usually HMR only watches /src.

Implementing the vite virtual module makes sense. opral/inlang-paraglide-js#264

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working pkg:add sv add
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants