Skip to content

Commit

Permalink
stop checking for co-located fragments by default
Browse files Browse the repository at this point in the history
  • Loading branch information
JoviDeCroock committed Sep 17, 2023
1 parent 7a3817b commit 8bc4f74
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 9 deletions.
5 changes: 5 additions & 0 deletions .changeset/brave-tigers-talk.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@0no-co/graphqlsp': minor
---

Change default config to not check for co-located fragments by default
9 changes: 7 additions & 2 deletions packages/graphqlsp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,17 @@ when on a TypeScript file or adding a file like [this](https://github.com/0no-co
### Configuration

**Required**

- `schema` allows you to specify a url, `.json` or `.graphql` file as your schema. If you need to specify headers for your introspection
you can opt into the object notation i.e. `{ "schema": { "url": "x", "headers": { "Authorization": "y" } }}`
- `disableTypegen` disables type-generation in general

**Optional**

- `disableTypegen` disables type-generation in general, this could be needed if offset bugs are introduced
- `scalars` allows you to pass an object of scalars that we'll feed into `graphql-code-generator`
- `extraTypes` allows you to specify imports or declare types to help with `scalar` definitions
- `shouldCheckForColocatedFragments` when turned on (default), this will scan your imports to find
- `shouldCheckForColocatedFragments` when turned on, this will scan your imports to find
unused fragments and provide a message notifying you about them

## Fragment masking
Expand Down
2 changes: 1 addition & 1 deletion packages/graphqlsp/src/diagnostics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export function getGraphQLDiagnostics(
const tagTemplate = info.config.template || 'gql';
const scalars = info.config.scalars || {};
const shouldCheckForColocatedFragments =
info.config.shouldCheckForColocatedFragments ?? true;
info.config.shouldCheckForColocatedFragments ?? false;

let source = getSource(info, filename);
if (!source) return undefined;
Expand Down
8 changes: 3 additions & 5 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion test/e2e/fixture-project/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
"plugins": [
{
"name": "@0no-co/graphqlsp",
"schema": "./schema.graphql"
"schema": "./schema.graphql",
"shouldCheckForColocatedFragments": true
}
],
"target": "es2016",
Expand Down

0 comments on commit 8bc4f74

Please sign in to comment.