Skip to content

eslint: Match OrderedQuery by symbol in no-collect-in-query - #573

Closed
stickerdaniel wants to merge 2 commits into
convex:mainfrom
stickerdaniel:fix/no-collect-in-query-declared-type
Closed

stickerdaniel wants to merge 2 commits into
convex:mainfrom
stickerdaniel:fix/no-collect-in-query-declared-type

Conversation

@stickerdaniel

@stickerdaniel stickerdaniel commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #572.

With type-aware linting, no-collect-in-query resolved OrderedQuery with getTypeOfSymbolAtLocation. For an interface that returns an error type, so every .collect() receiver passed isTypeAssignableTo and non-Convex calls were reported. getDeclaredTypeOfSymbol is 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 OrderedQuery symbol and checks whether the receiver's type, or the generic behind it, is that interface or extends it (as Query does). 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:

  • Still reported: db.query(...) with .withIndex(), .order(), .filter(), a stored query, an OrderedQuery<...> parameter, and type parameters constrained to OrderedQuery or Query.
  • No longer reported with type info: .collect() on unrelated classes.
  • Without type info, the results are unchanged.

tsc --strict passes for the plugin sources. I did not add a CHANGELOG entry; happy to add one if you want it under an unreleased heading.

Copilot AI lite review requested due to automatic review settings September 26, 2026 15:18

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

All reported issues were addressed across 1 file

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread npm-packages/@convex-dev/eslint-plugin/src/lib/no-collect-in-query.ts Outdated
@stickerdaniel

Copy link
Copy Markdown
Contributor Author

This landed in 7c4eeb5, so I'm closing it. Thanks for picking it up!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

eslint: no-collect-in-query reports every .collect() with type-aware linting

2 participants