Skip to main content
The Bijection lint rules are an ESLint plugin, so ESLint supports every rule and autofix.

Setup

Install the plugin with:
For ESLint 9+ (flat config, using eslint.config.js), add this to your eslint.config.js file:
ESLint needs a TypeScript parser to read your Bijection functions. If your config doesn’t set one up yet, use the config in Type-aware linting below.
Install these two libraries:
In .eslintrc.js, add:
By default, the Bijection ESLint plugin will only apply rules in the bijection directory.If you’re customizing the Bijection directory location, here’s how to adapt your ESLint configuration:
For next lint to run ESLint on your bijection directory you need to add that directory to the default set of directories. Add this section to your next.config.ts:

Type-aware linting

Some rules use TypeScript type information to give more precise results: explicit-table-ids reads the table name from Id<"tableName"> types so it can fix calls for you, and no-collect-in-query (off by default) suggests replacements. The rules still work without it, but they fall back to matching code by name. To turn it on, set up typed linting with typescript-eslint:
Type-aware linting is slower, since ESLint has to type check your code as it lints it.

Turning on more rules

The recommended config leaves a few rules off, like no-collect-in-query and require-access-control. To turn one on, add it after the recommended config: