Skip to content

SafeQL ✨ node-postgres

SafeQL is compatible with node-postgres which is the most popular postgres library in the ecosystem!

PLEASE NOTE

node-postgres doesn't come with a built-in SQL template tag (sql``).

Thus, you'll need to install @ts-safeql/sql-tag in order to use SafeQL with node-postgres.


If you prefer using a different SQL template tag library, that's fine too! see sql-template-strings and sql-template-tag

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 "client.query(sql`...`)"
      { wrapper: "client.query" },
    ],
  })
);