# noConvexDuplicateIndexes

Rule `biome/noConvexDuplicateIndexes`. Disallow Convex database indexes whose fields are the first fields of another index on the same table.

- Source: biome
- Technologies: JavaScript
- Kind: style
- Needs type information: no
- Autofix: no
- Reach: 30.6M weekly downloads of presets that enable it
- Trend: +109.3% last quarter
- Rank: #493 by reach, #128 by growth

## Linters

| Linter | Rule name | Recommended | Autofix | Details | Docs |
| --- | --- | --- | --- | --- | --- |
| Biome | `nursery/noConvexDuplicateIndexes` | yes | no | group nursery, since 2.6.10 | [docs](https://biomejs.dev/linter/rules/no-convex-duplicate-indexes/) |

## Code examples

### Incorrect: the rule reports this

```js
import { defineTable } from "convex/server";
import { v } from "convex/values";

defineTable({ author: v.string(), channel: v.string() })
    .index("by_author", ["author"])
    .index("by_author_and_channel", ["author", "channel"]);
```

```js
import { defineTable } from "convex/server";
import { v } from "convex/values";

defineTable({ author: v.string() })
    .index("by_author", ["author"])
    .index("by_writer", ["author"]);
```

### Correct: the rule accepts this

```js
import { defineTable } from "convex/server";
import { v } from "convex/values";

// Neither index starts with all the fields of the other one.
defineTable({ author: v.string(), channel: v.string() })
    .index("by_channel", ["channel"])
    .index("by_author_and_channel", ["author", "channel"]);

// The longer index is staged, so the shorter one is still needed until it's ready.
defineTable({ author: v.string(), channel: v.string() })
    .index("by_author", ["author"])
    .index("by_author_and_channel", { fields: ["author", "channel"], staged: true });

// To query by `author` alone, use the longer index and filter only on its first field.
await ctx.db
    .query("messages")
    .withIndex("by_author_and_channel", (q) => q.eq("author", author))
    .collect();
```

Examples from the Biome documentation.

## Enable it

### Biome: `biome.json`

```json
{
  "linter": {
    "rules": {
      "nursery": {
        "noConvexDuplicateIndexes": "error"
      }
    }
  }
}
```

## Presets that enable it

| Preset | Linter | Package | Rules | Weekly downloads | Trend |
| --- | --- | --- | --- | --- | --- |
| [Biome recommended](https://lintradar.dev/presets/biome-recommended.md) | Biome | `@biomejs/biome` | 491 | 28.5M | +106.8% |
| [Ultracite for Biome](https://lintradar.dev/presets/ultracite-biome.md) | Biome | `ultracite` | 616 | 2.1M | +151.7% |

## Related rules

- [biome/noConstEnum](https://lintradar.dev/rules/biome/noConstEnum.md): Disallow TypeScript `const enum`
- [biome/noConvexOldRegisteredFunctionSyntax](https://lintradar.dev/rules/biome/noConvexOldRegisteredFunctionSyntax.md): Require the object syntax when registering Convex queries, mutations, and actions.
- [biome/noBiomeFirstException](https://lintradar.dev/rules/biome/noBiomeFirstException.md): Disallow ineffective ordering in `files.includes` patterns.
- [biome/noConvexProcessEnv](https://lintradar.dev/rules/biome/noConvexProcessEnv.md): Disallow `process.env` in Convex functions.
- [biome/noAstroSetHtmlDirective](https://lintradar.dev/rules/biome/noAstroSetHtmlDirective.md): Disallow the use of Astro's `set:html` directive.
- [biome/noConvexQueryFilter](https://lintradar.dev/rules/biome/noConvexQueryFilter.md): Disallow calling `.filter()` on a Convex database query.

---

Web page: https://lintradar.dev/rules/biome/noConvexDuplicateIndexes. Data from npm and the linters' documentation, collected Dec 4, 2026. Site guide for agents: https://lintradar.dev/llms.txt
