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

Author: stickerdanielCreated Sep 26, 2026Updated Sep 26, 2026

Bug

With type-aware linting enabled, @convex-dev/no-collect-in-query reports .collect() on any object, not only on Convex queries.

Minimal reproduction

typescript
import type { GenericDatabaseReader, GenericDataModel } from "convex/server";

class Sink {
  collect(): string[] {
    return [];
  }
}

export async function repro(db: GenericDatabaseReader<GenericDataModel>) {
  new Sink().collect(); // not a Convex query
  await db.query("messages").collect(); // a Convex query
}

Run ESLint with @typescript-eslint/parser and "@convex-dev/no-collect-in-query": "error", once without and once with parserOptions.projectService: true.

  • Without projectService: line 11 is reported.
  • With projectService: lines 10 and 11 are reported.

Reproduced with @convex-dev/eslint-plugin 5.0.0, ESLint 9.39.5, typescript-eslint 8.70.1, TypeScript 6.0.3, Convex 1.46.0, macOS.

Cause

findOrderedQueryType() in no-collect-in-query.ts resolves the exported OrderedQuery interface with checker.getTypeOfSymbolAtLocation(orderedQuerySymbol, sf). OrderedQuery is an interface and has no value, so this returns an error type that behaves like any. checker.isTypeAssignableTo(objectType, orderedQueryType) is then true for every receiver.

Replacing the call with checker.getDeclaredTypeOfSymbol(orderedQuerySymbol), as no-filter-in-query already does for its exported types, fixes the reproduction above: only line 11 is reported.

Source: get-convex/convex-backend