Getting Started
Prerequisites
Set up ESLint following the typescript-eslint Getting Started docs, to enable TypeScript language support in ESLint.
Installation
bash
npm install --save-dev @ts-safeql/eslint-plugin libpg-queryIntegrate with ESLint
In order for SafeQL to be able to lint your queries, you need to specify either a databaseUrl or a migrationsDir in your ESLint configuration:
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 next section
databaseUrl: "postgres://postgres:postgres@localhost:5432/my_database",
targets: [{ tag: "sql" }],
})
);In the next section, you'll learn how to configure your connection(s).