Skip to content
This repository has been archived by the owner on Aug 20, 2020. It is now read-only.

Return empty map for empty doc (instead of error) #64

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

cooperka
Copy link

@cooperka cooperka commented May 29, 2018

Graphql can't parse empty documents (e.g. from js files with no gql tags); return an empty OutputMap in these cases instead of failing. Example:

# File with no `gql` tags:
yarn run persistgraphql --js --extension=js src/components/App.js

leads to

Unable to process input path src/components/App.js. Error message:
Syntax Error GraphQL request (1:1) Unexpected <EOF>

1:
   ^

This makes it impossible for me to recursively analyze a directory (e.g. src/) because there are undoubtedly going to be some .js files in that directory without any gql tags.

Note: This is a similar error to #48 and #20 but seemingly a different cause. This was also merged recently but seemingly didn't fix the issue in all cases: #48.

Graphql can't parse empty documents (e.g. from js files with no `gql` tags); return an empty output map in these cases instead of failing with a SyntaxError.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant