Skip to content

SafeQL ❤️ Slonik

SafeQL is compatible with Slonik as well with a few setting tweaks.

js
// eslint.config.js

import safeql from "@ts-safeql/eslint-plugin/config";
import tseslint from "typescript-eslint";

export default tseslint.config(
  // ...
  safeql.configs.connections({
    // ... (read more about configuration in the API docs)
    targets: [
      {
        // This will lint syntax that matches "sql.typeAlias()`...`", "sql.type()`...`" or "sql.unsafe`...`"
        tag: "sql.+(type\\(*\\)|typeAlias\\(*\\)|unsafe)",
        // this will tell SafeQL to not suggest type annotations
        // since we will be using our Zod schemas in slonik
        skipTypeAnnotations: true,
      },
    ],
  })
);