Repository navigation
eslint: Match OrderedQuery by symbol in no-collect-in-query - #573
Closed
stickerdaniel wants to merge 2 commits into
Closed
stickerdaniel wants to merge 2 commits into
stickerdaniel wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
All reported issues were addressed across 1 file
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
Contributor
Author
|
This landed in 7c4eeb5, so I'm closing it. Thanks for picking it up! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #572.
With type-aware linting,
no-collect-in-queryresolvedOrderedQuerywithgetTypeOfSymbolAtLocation. For an interface that returns an error type, so every.collect()receiver passedisTypeAssignableToand non-Convex calls were reported.getDeclaredTypeOfSymbolis not enough on its own:OrderedQuery<SomeTable>returned by.order()is not assignable to the uninstantiated generic, so those calls would stop being reported.This change keeps the
OrderedQuerysymbol and checks whether the receiver's type, or the generic behind it, is that interface or extends it (asQuerydoes). A type parameter is judged by its constraint.I checked it by building the rule from this branch and linting with and without
parserOptions.projectService:db.query(...)with.withIndex(),.order(),.filter(), a stored query, anOrderedQuery<...>parameter, and type parameters constrained toOrderedQueryorQuery..collect()on unrelated classes.tsc --strictpasses for the plugin sources. I did not add a CHANGELOG entry; happy to add one if you want it under an unreleased heading.