ardatan / ardatan/graphql-tools

graphql-tag-pluck can't be configured to ignore gql`...`

Open
#5,173 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
5.4k
Forks
830
Avg merge
10h 59m
Merged PRs (30d)
45

Description

### Issue workflow progress

_Progress of the issue based on the [Contributor Workflow](https://github.com/the-guild-org/Stack/blob/master/CONTRIBUTING.md#a-typical-contributor-workflow)_

- [ ] 1. The issue provides a reproduction available on Github, Stackblitz or CodeSandbox
> Make sure to fork this template and run `yarn generate` in the terminal.
>
> Please make sure the GraphQL Tools package versions under `package.json` matches yours.
- [ ] 2. A failing test has been provided
- [ ] 3. A local solution has been provided
- [ ] 4. A pull request is pending review

---

I have tried a number of configurations, but I have not been able to get graphql-tag-pluck to ignore the default `gql` tag.
I have further noticed that even custom tags that include `gql` are still picked up when the `globalGqlIdentifierName` property is configured. For example I had a custom tag `gql_ecommerce` and that tag was still picked up.

**To Reproduce**
Steps to reproduce the behavior:

Configure `globalGqlIdentifierName` to an empty list of tags.
Run the graphql-code-generator.
`gql` tags are still picked up and processed by the codegen.

**Expected behavior**

Tags that are not listed in the `globalGqlIdentifierName` to not be picked up by graphql-tag-pluck

**Environment:**

- OS: MacOS 12.3
- "@graphql-tools/graphql-tag-pluck": "7.5.0",
- NodeJS: 19.7.0

**Additional context**
I understand the use case I have may be strange, I can elaborate on why it's needed if desired, but the inability to unset tags has been a point of frustration with using the codegen.

Contributor guide

Open the contributing guide

Research direction

Start with the @graphql-tools/graphql-tag-pluck handling of globalGqlIdentifierName and reproduce the behavior using an empty tag list with graphql-code-generator. Done means only configured tags are processed, while the default gql tag and names such as gql_ecommerce are ignored when they are not listed.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.