How to find GraphQL syntax error in modularized schema

I’m learning GraphQL and have a schema split into about 45 different files, as suggested in an awesome post on the Apollo blog by engineer Dhaivat Pandya.

I liked modularizing my schema, but now I’m starting to write resolvers and am getting a syntax error. Unfortunately the error message doesn’t tell me where the error is in my code:

Chriss-MBP:api chris$ yarn dev
yarn run v1.22.15
$ ts-node-dev --no-notify --respawn --transpile-only src/index
[INFO] 10:00:57 ts-node-dev ver. 1.1.8 (using ts-node ver. 9.1.1, typescript ver. 4.4.3)
GraphQLError: Syntax Error: Expected Name, found "}".
    at syntaxError (/Users/chris/Documents/Jobs/AFSCME/repos/api/node_modules/graphql/error/syntaxError.js:15:10)
    at Parser.expectToken (/Users/chris/Documents/Jobs/AFSCME/repos/api/node_modules/graphql/language/parser.js:1413:40)
    at Parser.parseName (/Users/chris/Documents/Jobs/AFSCME/repos/api/node_modules/graphql/language/parser.js:98:22)
    at Parser.parseNamedType (/Users/chris/Documents/Jobs/AFSCME/repos/api/node_modules/graphql/language/parser.js:674:18)
    at Parser.parseTypeReference (/Users/chris/Documents/Jobs/AFSCME/repos/api/node_modules/graphql/language/parser.js:652:19)
    at Parser.parseFieldDefinition (/Users/chris/Documents/Jobs/AFSCME/repos/api/node_modules/graphql/language/parser.js:882:21)
    at Parser.optionalMany (/Users/chris/Documents/Jobs/AFSCME/repos/api/node_modules/graphql/language/parser.js:1503:28)
    at Parser.parseFieldsDefinition (/Users/chris/Documents/Jobs/AFSCME/repos/api/node_modules/graphql/language/parser.js:868:17)
    at Parser.parseObjectTypeExtension (/Users/chris/Documents/Jobs/AFSCME/repos/api/node_modules/graphql/language/parser.js:1176:23)
    at Parser.parseTypeSystemExtension (/Users/chris/Documents/Jobs/AFSCME/repos/api/node_modules/graphql/language/parser.js:1094:23)
[ERROR] 10:00:58 GraphQLError: Syntax Error: Expected Name, found "}".

Is there a way to see where this error is happening in my code, ideally which file and line number?

The IntelliJ IDE has a plugin called JS GraphQL that does a great job of finding syntax errors across schema and query files. I only have one schema file so I can’t attest to its ability to handle multiple schema files, but it’s worth a look. What IDE are you using? It may have a comparable plugin.