Skip to content

Is it possible to catch syntax errors? #10

@jeffwillette

Description

@jeffwillette

When I am using the plugin through ALE, and there is an error thrown due to bad syntax, I get no output in ALE and all linter warnings disappear. Is it possible on this end to catch syntax errors and output them nicely just like linter warnings?

# what is needed for a pet
type Pet {
    sklda
}

this syntax mistake, gives this output

Found no config file, running with default config.

/Users/Jeff/.config/yarn/global/node_modules/graphql/language/parser.js:973
  throw (0, _error.syntaxError)(lexer.source, token.start, 'Expected ' + kind + ', found ' + (0, _lexer.getTokenDesc)(token));
  ^
GraphQLError: Syntax Error GraphQL request (27:1) Expected :, found }

26:     sklda
27: }
    ^
28:

    at syntaxError (/Users/Jeff/.config/yarn/global/node_modules/graphql/error/syntaxError.js:31:15)
    at expect (/Users/Jeff/.config/yarn/global/node_modules/graphql/language/parser.js:973:32)
    at parseFieldDefinition (/Users/Jeff/.config/yarn/global/node_modules/graphql/language/parser.js:718:3)
    at any (/Users/Jeff/.config/yarn/global/node_modules/graphql/language/parser.js:1009:16)
    at parseObjectTypeDefinition (/Users/Jeff/.config/yarn/global/node_modules/graphql/language/parser.js:686:16)
    at parseTypeSystemDefinition (/Users/Jeff/.config/yarn/global/node_modules/graphql/language/parser.js:610:16)
    at parseDefinition (/Users/Jeff/.config/yarn/global/node_modules/graphql/language/parser.js:151:16)
    at parseDocument (/Users/Jeff/.config/yarn/global/node_modules/graphql/language/parser.js:109:22)
    at parse (/Users/Jeff/.config/yarn/global/node_modules/graphql/language/parser.js:46:10)
    at gqlint (/Users/Jeff/.config/yarn/global/node_modules/gqlint/lib/gqlint.js:28:15)

which cannot be read by ALE

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions