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

Comments are lost when formatting #14

Open
leehambley opened this issue Aug 31, 2020 · 3 comments
Open

Comments are lost when formatting #14

leehambley opened this issue Aug 31, 2020 · 3 comments
Labels
enhancement New feature or request

Comments

@leehambley
Copy link

We use format-graphql along side the graphql-schema-linter package (via https://pre-commit.com/)

graphql-schema-linter provides the means to disable some of it's lint checks (unused types, camel casing) https://github.com/cjoudrey/graphql-schema-linter#inline-rule-overrides

However, when using it with format-grahpql the comments all disappear.

I would have guessed that because comments aren't necessarily part of the GraphQL spec, that any parser from GraphQL might just eat them, and not provide them as AST nodes, but in fact the spec does define comments:

@leehambley leehambley changed the title Comments are being lost Comments are lost when formatting Aug 31, 2020
@gajus gajus added the enhancement New feature or request label Aug 31, 2020
@gajus
Copy link
Owner

gajus commented Aug 31, 2020

For reference:

graphql/graphql-js#2241

@leehambley
Copy link
Author

Thanks @gajus - I suspected something like this, Rust's serde YAML suffers the same problem, because the underlying YAML parser doesn't preserve comments. (Ruby also had the same problem with the parser tools for the first 20 years it existed, and only recently learned to preserve comments on the AST)

@bfelbo
Copy link

bfelbo commented Oct 21, 2021

@gajus Is this possible now with ardatan/graphql-tools#1900?

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

No branches or pull requests

3 participants