-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Wrap cm6-graphql lint logic in try..catch #3461
Conversation
🦋 Changeset detectedLatest commit: 54ebaeb The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #3461 +/- ##
==========================================
+ Coverage 55.75% 55.85% +0.10%
==========================================
Files 110 110
Lines 5243 5264 +21
Branches 1426 1435 +9
==========================================
+ Hits 2923 2940 +17
- Misses 1897 1898 +1
- Partials 423 426 +3
|
The latest changes of this PR are available as canary in npm (based on the declared
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
makes sense for me! now I think i need to add this to our other mode, haha!
@acao I was thinking about this a bit more. The error that gets thrown is usually because of an invalid schema:
With this current try..catch, we are ignoring this type of error, which you can argue is fine since it's not a validation error in the GraphQL query (which the linter is meant for), but should we also report the invalid GraphQL schema from the linter as well? (The position of the error can just be line 1, col 1). I feel like that might be more useful to devs. We could also consider making devs choose the behavior they want here with a config option. What do you think? |
Hmm yeah, that makes a lot of sense to me! |
Yeah writing to a state field may not be needed |
It turns out that
getDiagnostics
may throw errors which codemirror 6 doesn't handle in the lint. Wrapping the logic in try..catch to handle errors and just return an empty array instead.