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

RFC: Run prettier over generated files if a config exists #93

Open
mxstbr opened this issue Dec 15, 2023 · 2 comments · May be fixed by #100
Open

RFC: Run prettier over generated files if a config exists #93

mxstbr opened this issue Dec 15, 2023 · 2 comments · May be fixed by #100
Labels
good first issue Good for newcomers RFC A discussion about a future feature

Comments

@mxstbr
Copy link
Contributor

mxstbr commented Dec 15, 2023

Summary

Every time I run dev my VSCode sidebar looks like this, even if I haven't changed anything about my schema:

CleanShot 2023-12-15 at 10 07 26@2x

This happens because I use prettier, which formats files differently than the codegen.

Proposed Solution

If there is a prettier config file in the folder or a parent folder, run prettier over the generated code with the actual config to avoid unnecessary git diffs.

@mxstbr mxstbr added the RFC A discussion about a future feature label Dec 15, 2023
@JoviDeCroock
Copy link
Contributor

This should be implemented in GraphQL Code Generator, we basically have to detect whether the user has either got prettier installed (no config) or has a prettier config and then add the following to the GraphQL Code Generator process.

  hooks: { afterAllFileWrite: ['prettier --write'] }

@JoviDeCroock JoviDeCroock added the good first issue Good for newcomers label Dec 15, 2023
@cstrnt
Copy link

cstrnt commented Dec 15, 2023

On it :)

@cstrnt cstrnt linked a pull request Dec 16, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers RFC A discussion about a future feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants