-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
fix some false positive for prefer-query-object-syntax rule #5953
fix some false positive for prefer-query-object-syntax rule #5953
Conversation
…pression that cannot be resolved or it's not defined in the current file
…to test newer typescript features
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Ignored Deployment
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 653917f:
|
☁️ Nx Cloud ReportCI is running/has finished running commands for commit 653917f. As they complete they will appear below. Click to see the status, the terminal output, and the build insights. 📂 See all runs for this branch
✅ Successfully ran 1 targetSent with 💌 from NxCloud. |
* We are using a newer version of typescript than the one at the repository root, | ||
* to be able to test code that uses newer typescript features. | ||
* To prevent RuleTester from using the typescript version at the root | ||
* we resolve '@typescript-eslint/parser' here instead of letting it do it internally. | ||
* Once the version at the root is updated to >=4.9 this can be replaced by just "@typescript-eslint/parser" | ||
*/ | ||
parser: require.resolve('@typescript-eslint/parser') as any, |
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.
where are we using an older version of @typescript-eslint/parser
?
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.
here:
Line 61 in ef5125f
"@typescript-eslint/parser": "^5.41.0", |
I came to the conclusion that I also needed to update typescript to >=4.9 to be able to test satisfies
and I didn't wan't to change the typescript version in the respository root. But maybe I can update @typescript-eslint in the root. I will give it another look.
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.
I have tried updating only @typescript-eslint/*
packages to oldest version that suports satisfies
(5.45.0), but that is not enough, typescript
>=4.9 is also needed, otherwise the test that uses satisfies
fails with A fatal parsing error occurred: Parsing error: ',' expected.
I didn't want to update the typescript version in the root, because I assumed that it is probably there to ensure that packages stay compatible with that version of typescript.
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.
ah yes, I see. what we'd want is to develop with TS 5.2, but have a type-testing suite that works against all sorts of TS versions.
@ZackDeRose started with this some time back, but we never followed through:
I'll take a look at setting this up later this week, then we should be good without this workaround 👍
My personal take: Other than that, LGTM. |
@eg-bernardo can you please fix the conflicts than we can go ahead and merge this fix |
This PR is only relevant for v4 since Also it was blocked because it required typescript 4.9: and you said: But it seems v4 still targets typescript 4.7. |
you're right, I'll close this then. |
Fixes #5028, and cases where the query options object is not defined in the same file as the
useQuery
call.To be able to test the issue with
satisfies
I had to updatetypescript
and@typescript-eslint
packages, but I have only updateddevDependencies
ineslint-plugin-query
.I have removed a test case for invalid code:
Because I think in most cases for
useQuery(some_variable)
whensome_variable
is not defined in the current file, it will be a query options object.