Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove #graphql comment tag #12

Merged
merged 1 commit into from
Jul 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 3 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ A concrete example:
import { gql } from 'graphql-tag';

// TypedDocumentNode<{ user, users }, { id }>
gql(`#graphql
gql(`
query User1($id: ID!) {
user(id: $id) {
id
Expand Down Expand Up @@ -120,7 +120,7 @@ This regex is used to extract project name from operations.
Finally, create your operations following regex constraints.

```ts
gql(`#graphql
gql(`
query CatalogProduct($id: ID!) {
product(id: $id) {
id
Expand All @@ -129,7 +129,7 @@ gql(`#graphql
}
`);

gql(`#graphql
gql(`
query ChannelItem($id: ID!) {
item(id: $id) {
id
Expand Down Expand Up @@ -174,14 +174,6 @@ Then search for `ts-gql-plugin` occurences.

To have highlighting between other features, you can use [GraphQL extension](https://marketplace.visualstudio.com/items?itemName=GraphQL.vscode-graphql) for VSCode.

Just keep in mind this extension requires to add a specific tag (`#graphql`) into your literals to be highlighten:

```ts
gql(`#graphql
query {...}
`);
```

## CLI

Because of [Language Service design limitations](https://github.com/microsoft/TypeScript/wiki/Writing-a-Language-Service-Plugin#whats-a-language-service-plugin) `tsc` does not load plugins. So building or type-checking your files using CLI cannot use `ts-gql-plugin`.
Expand Down
2 changes: 1 addition & 1 deletion example/expect-errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { gql } from 'graphql-tag';
import { useQuery } from '@apollo/client';

const { data } = useQuery(
gql(`#graphql
gql(`
query CatalogUserFoo($id: ID!) {
user(id: $id) {
id
Expand Down
8 changes: 4 additions & 4 deletions example/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { gql } from 'graphql-tag';
import { useQuery } from '@apollo/client';

const { data: abc } = useQuery(
gql(`#graphql
gql(`
query CatalogUser1($id: ID!) {
user(id: $id) {
id
Expand All @@ -16,7 +16,7 @@ const { data: abc } = useQuery(
);

const { data } = useQuery(
gql(`#graphql
gql(`
query CatalogUser2($id: ID!) {
user(id: $id) {
id
Expand All @@ -30,7 +30,7 @@ const { data } = useQuery(
);

const { data: foo } = useQuery(
gql(`#graphql
gql(`
query ProfileUser1($id: ID!) {
user(id: $id) {
id
Expand All @@ -44,7 +44,7 @@ const { data: foo } = useQuery(
);

const { data: azer } = useQuery(
gql(`#graphql
gql(`
query ProfileUser2($id: ID!) {
authByGoogle(code: "foo") {
id
Expand Down