Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
As part of refactoring a GraphQL server I wanted to focus on getting the GraphQL Schema into the best shape possible and what better tool to help in that, and to ensure that it sticks that way, than a linter? So I was very happy to find that someone had started on making a linter for GraphQL Schemas, very handy!
I did however run across an error with the CLI command and tracked it down to an erroneous expectation of the return data from
fs.readFileSync()
. When an encoding has been specified, as it has in this case, then it returns a string: https://nodejs.org/api/fs.html#fs_fs_readfilesync_path_optionsDue to this wrong expectation the defined config file wasn't used but instead a JSON parse error was given whenever a config file was defined.
As an additional fix I reworded the error message to actually note the reason to why it will run with the default config + removed a needless assign to a
json
const. I hope that's okay and not stretching it too far for a single PR.