ESLint Plugin for Kysely

1.0.7 · active · verified Wed Apr 22

eslint-plugin-kysely is an ESLint plugin designed to enforce safe and best-practice database operations when using the Kysely SQL query builder. It helps developers prevent common SQL-related issues like accidental full table scans by enforcing WHERE clauses, ensures explicit SELECT statements to avoid ambiguity, and prevents ambiguous column references in JOIN queries. The plugin also provides rules for correct Kysely operator usage, such as `is` for null comparisons and `in` for array operations, rather than `=` or `!=`. The current stable version is 1.0.7, indicating an early but stable release. Its release cadence is likely driven by user feedback and Kysely's evolution. A key differentiator is its specific focus on Kysely's API, providing tailored linting for Kysely users rather than generic SQL linting.

Common errors

Warnings

Install

Imports

Quickstart

Installs the plugin and configures ESLint to use the recommended set of rules for Kysely, then demonstrates how to run ESLint.

npm install --save-dev eslint eslint-plugin-kysely

// .eslintrc.json
{
  "root": true,
  "parserOptions": {
    "ecmaVersion": 2020,
    "sourceType": "module"
  },
  "extends": [
    "eslint:recommended",
    "plugin:kysely/recommended"
  ]
}

// To lint your project files (e.g., .ts, .js):
npx eslint . --ext .js,.ts

view raw JSON →