Skip to content
New issue

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

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

Already on GitHub? # to your account

fix: handle multiple tsconfig extends for resolving GraphQLSP plugin entry #386

Merged
merged 2 commits into from
Aug 30, 2024

Conversation

aweber1
Copy link
Contributor

@aweber1 aweber1 commented Aug 29, 2024

Summary

Given the following tsconfig.json setup:

// tsconfig.json
{
  "extends": ["./tsconfig.app.json", "./tsconfig.gql-tada.json"]
}

// tsconfig.app.json
{
  "compilerOptions": {
     // some options here
   }
}

// tsconfig.gql-tada.json
{
  "compilerOptions": {
    "plugins": [
      {
        "name": "gql.tada/ts-plugin",
        // schema config
      }
    ]
  }
}

I encounter the following error:
Could not find a valid GraphQLSP plugin entry in: tsconfig.json

The code in this PR fixes the issue for me, but there aren't unit tests specifically for this area of code so not sure of any adverse effects.

Set of changes

The change was pretty straightforward in just modifying return load(tsconfigPath) to be return await load(tsconfigPath) so that exceptions thrown when trying to load nested tsconfig "extends" elements are caught (and swallowed) by the intended catch(_error) statements.

Copy link

changeset-bot bot commented Aug 29, 2024

🦋 Changeset detected

Latest commit: f216c49

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Member

@kitten kitten left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch! didn't spot this typo when refactoring this file. I think this must've regressed when this was made more reusable

@kitten kitten enabled auto-merge (squash) August 30, 2024 10:42
@kitten kitten merged commit 7fb938d into 0no-co:main Aug 30, 2024
2 checks passed
@github-actions github-actions bot mentioned this pull request Aug 30, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants