diff --git a/.changeset/brave-tigers-talk.md b/.changeset/brave-tigers-talk.md new file mode 100644 index 00000000..d43b47d8 --- /dev/null +++ b/.changeset/brave-tigers-talk.md @@ -0,0 +1,5 @@ +--- +'@0no-co/graphqlsp': minor +--- + +Change default config to not check for co-located fragments by default diff --git a/packages/graphqlsp/README.md b/packages/graphqlsp/README.md index 93ca5ad3..59374e75 100644 --- a/packages/graphqlsp/README.md +++ b/packages/graphqlsp/README.md @@ -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 diff --git a/packages/graphqlsp/src/diagnostics.ts b/packages/graphqlsp/src/diagnostics.ts index 1be2507c..e6de8db7 100644 --- a/packages/graphqlsp/src/diagnostics.ts +++ b/packages/graphqlsp/src/diagnostics.ts @@ -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; diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 4aba69c9..f1937ad8 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -362,6 +362,7 @@ packages: /@babel/plugin-proposal-class-properties@7.18.6(@babel/core@7.20.5): resolution: {integrity: sha512-cumfXOF0+nzZrrN8Rf0t7M+tF6sZc7vhQwYQck9q1/5w2OExlD+b4v4RpMJFaV1Z7WcDRgO6FqvxqxGlwo+RHQ==} engines: {node: '>=6.9.0'} + deprecated: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-class-properties instead. peerDependencies: '@babel/core': ^7.0.0-0 dependencies: @@ -374,6 +375,7 @@ packages: /@babel/plugin-proposal-object-rest-spread@7.20.2(@babel/core@7.20.5): resolution: {integrity: sha512-Ks6uej9WFK+fvIMesSqbAto5dD8Dz4VuuFvGJFKgIGSkJuRGcrwGECPA1fDgQK3/DbExBJpEkTeYeB8geIFCSQ==} engines: {node: '>=6.9.0'} + deprecated: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-object-rest-spread instead. peerDependencies: '@babel/core': ^7.0.0-0 dependencies: @@ -3509,7 +3511,7 @@ packages: /rxjs@7.8.0: resolution: {integrity: sha512-F2+gxDshqmIub1KdvZkaEfGDwLNpPvk9Fs6LD/MyQxNgMds/WH9OdDDXOmxUZpME+iSK3rQCctkL0DYyytUqMg==} dependencies: - tslib: 2.4.1 + tslib: 2.5.0 dev: true /safe-buffer@5.2.1: @@ -3905,10 +3907,6 @@ packages: engines: {node: '>=8'} dev: true - /tslib@2.4.1: - resolution: {integrity: sha512-tGyy4dAjRIEwI7BzsB0lynWgOpfqjUdq91XXAlIWD2OwKBH7oCl/GZG/HT4BOHrTlPMOASlMQ7veyTqpmRcrNA==} - dev: true - /tslib@2.5.0: resolution: {integrity: sha512-336iVw3rtn2BUK7ORdIAHTyxHGRIHVReokCR3XjbckJMK7ms8FysBfhLR8IXnAgy7T0PTPNBWKiH514FOW/WSg==} diff --git a/test/e2e/fixture-project/tsconfig.json b/test/e2e/fixture-project/tsconfig.json index 0c7ef1c9..8d84b4de 100644 --- a/test/e2e/fixture-project/tsconfig.json +++ b/test/e2e/fixture-project/tsconfig.json @@ -3,7 +3,8 @@ "plugins": [ { "name": "@0no-co/graphqlsp", - "schema": "./schema.graphql" + "schema": "./schema.graphql", + "shouldCheckForColocatedFragments": true } ], "target": "es2016",