Skip to content

Commit

Permalink
Final copy edits
Browse files Browse the repository at this point in the history
  • Loading branch information
Matt Seccafien committed May 28, 2022
1 parent 6d9a930 commit 90e6f8e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
6 changes: 3 additions & 3 deletions packages/eslint-plugin/src/rules/prefer-gql/README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# Prefer using the `gql` utility from Hydrogen

Projects that consume a GraphQL API typically use a utility that parses GraphQL queries into ASTNodes for the projects' GraphQL client library or provides syntax highlighting.
Projects that consume a GraphQL API typically use a utility to parses GraphQL queries into an AST for the projects' GraphQL client library to use. It will also often provide syntax highlighting, auto-completion and other integrations with the developers editor.

In Hydrogen, you don't need to parse GraphQL queries. Instead, you can use Hydrogen's light-weight [`gql` utility](https://shopify.dev/api/hydrogen/utilities/gql) that adds syntax highlighting to your GraphQL queries.
In Hydrogen, you don't need to parse GraphQL queries into an AST and can cut down on the projects' final bundle size by using Hydrogen's light-weight [`gql` utility](https://shopify.dev/api/hydrogen/utilities/gql) instead.

Using the `gql` utility makes your production bundle smaller by dropping certain AST-related dependencies. In development, however, the `gql` utility uses ASTNodes to provide better errors in your queries.

## Rule details

This rule is used to detect the use of a GraphQL utility other than the one provided by Hydrogen. If another GraphQL utility is being used, then the `gql` utility from `@shopify/hydrogen` is suggested.
This rule is used to detect the use of a GraphQL utility other than the one provided by Hydrogen. If another GraphQL utility is used, then the `gql` utility from `@shopify/hydrogen` is suggested. This will also replace the utility automatically when `eslint` is run with the `--fix` flag if you choose.

### Incorrect code

Expand Down
1 change: 0 additions & 1 deletion packages/eslint-plugin/src/rules/prefer-gql/prefer-gql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ export const preferGQL = createRule({
type: 'suggestion',
docs: {
description: 'Prefer using the `gql` utility from hydrogen',
category: 'Best Practices',
recommended: 'warn',
},
messages: {
Expand Down

0 comments on commit 90e6f8e

Please sign in to comment.