An intelligent SQL linter that performs sanity checks (e.g., missing WHERE, unmatched parentheses) and surfaces database errors with more informative messages. The current stable version is 1.0.2. Since v1.0.0, it has been considered stable. Compared to other SQL linters, sql-lint focuses on catching common mistakes like missing WHERE clauses and invalid DROP/CREATE options, and supports multiple databases (MySQL, PostgreSQL). It can be used as a CLI tool or programmatically in JavaScript/TypeScript, and ships TypeScript type definitions. Release cadence is irregular.
npm install sql-lintNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows programmatic usage to lint SQL string and handle lint errors.
Use require('sql-lint').default or use ESM imports.Use `sql-lint my-file.sql` instead of `sql-lint -f my-file.sql`.
Use `echo 'SELECT 1' | sql-lint` or programmatic API.
Update to v0.0.20 or later.
Update to v0.0.20 or later.
Use `const sqlLint = require('sql-lint').default;` or switch to ESM imports.Run `npm install -g sql-lint` for CLI use or `npm install sql-lint` for programmatic use.
Provide correct host, user, password, and database options in the config or programmatic call.
Ensure the input is a valid SQL statement. Use the programmatic API with `sql` option.