Skip to content

Commit 1594288

Browse files
committed
Improve error messages for parserServices
1 parent 63cecdd commit 1594288

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

.changeset/sharp-feet-burn.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@graphql-eslint/eslint-plugin': patch
3+
---
4+
5+
Improve error messages for parserServices

packages/plugin/src/utils.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ import { SiblingOperations } from './sibling-operations';
66
export function requireSiblingsOperations(ruleName: string, context: GraphQLESlintRuleContext<any>): SiblingOperations {
77
if (!context || !context.parserServices) {
88
throw new Error(
9-
`You have used a rule ("${ruleName}") which requires parserServices to be generated with operations. You must therefore provide a value for the "parserOptions.operations" property for "@typescript-graphql/parser", or use graphql-config!`
9+
`Rule '${ruleName}' requires 'parserOptions.operations' to be set and loaded. See http://bit.ly/graphql-eslint-operations for more info`
1010
);
1111
}
1212

1313
if (!context.parserServices.siblingOperations.available) {
1414
throw new Error(
15-
`You have used a rule which requires GraphQL operations to be loaded. Found "parserServices" generated, but unable to load your GraphQL operations.`
15+
`Rule '${ruleName}' requires 'parserOptions.operations' to be set and loaded. See http://bit.ly/graphql-eslint-operations for more info`
1616
);
1717
}
1818

@@ -25,13 +25,13 @@ export function requireGraphQLSchemaFromContext(
2525
): GraphQLSchema {
2626
if (!context || !context.parserServices) {
2727
throw new Error(
28-
`You have used a rule ("${ruleName}") which requires parserServices to be generated with GraphQL schema. You must therefore provide a value for the "parserOptions.schema" property for "@typescript-graphql/parser", or use graphql-config!`
28+
`Rule '${ruleName}' requires 'parserOptions.schema' to be set. See http://bit.ly/graphql-eslint-schema for more info`
2929
);
3030
}
3131

3232
if (!context.parserServices.hasTypeInfo) {
3333
throw new Error(
34-
`You have used a rule which requires GraphQL Schema to be loaded. Found "parserServices" generated, but unable to load your GraphQL schema and it's type-info!`
34+
`Rule '${ruleName}' requires 'parserOptions.schema' to be set and schema to be loaded. See http://bit.ly/graphql-eslint-schema for more info`
3535
);
3636
}
3737

0 commit comments

Comments
 (0)