Mirror: TypeScript LSP plugin that finds GraphQL documents in your code and provides diagnostics, auto-complete and hover-information.

fix: Add prettier/eslint disable comments to output (#199)

Changed files
+10
.changeset
packages
graphqlsp
src
graphql
+5
.changeset/yellow-pianos-explode.md
···
···
+
---
+
'@0no-co/graphqlsp': patch
+
---
+
+
Automatically disable Prettier and ESLint on `tadaOutputLocation` output files.
+5
packages/graphqlsp/src/graphql/getSchema.ts
···
import { Logger } from '../index';
const dtsAnnotationComment = [
'/** An IntrospectionQuery representation of your schema.',
' *',
···
if (/\.d\.ts$/.test(output)) {
contents = [
dtsAnnotationComment,
`export type introspection = ${json};\n`,
"import * as gqlTada from 'gql.tada';\n",
···
].join('\n');
} else if (path.extname(output) === '.ts') {
contents = [
tsAnnotationComment,
`const introspection = ${json} as const;\n`,
'export { introspection };',
···
import { Logger } from '../index';
+
const preambleComments =
+
['/* eslint-disable */', '/* prettier-ignore */'].join('\n') + '\n';
+
const dtsAnnotationComment = [
'/** An IntrospectionQuery representation of your schema.',
' *',
···
if (/\.d\.ts$/.test(output)) {
contents = [
+
preambleComments,
dtsAnnotationComment,
`export type introspection = ${json};\n`,
"import * as gqlTada from 'gql.tada';\n",
···
].join('\n');
} else if (path.extname(output) === '.ts') {
contents = [
+
preambleComments,
tsAnnotationComment,
`const introspection = ${json} as const;\n`,
'export { introspection };',