{"library":"sql-lint","title":"sql-lint","type":"library","description":"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.","language":"javascript","status":"active","last_verified":"Fri May 01","install":{"commands":["npm install sql-lint"],"cli":{"name":"sql-lint","version":null}},"imports":["import sqlLint from 'sql-lint'","const sqlLint = require('sql-lint').default || require('sql-lint')","import type { SqlLintOptions } from 'sql-lint'"],"auth":{"required":false,"env_vars":[]},"links":{"homepage":null,"github":"https://github.com/joereynolds/sql-lint","docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/sql-lint","openapi_spec":null,"status_page":null,"smithery":null},"quickstart":{"code":"import sqlLint from 'sql-lint';\n\nconst errors = await sqlLint({\n  sql: 'DELETE FROM users WHERE id = 1;',\n  // optionally connect to a database to get server errors\n  // host: 'localhost',\n  // user: 'root',\n  // password: process.env.DB_PASS ?? ''\n});\n\nif (errors.length === 0) {\n  console.log('No errors found.');\n} else {\n  for (const error of errors) {\n    console.log(`${error.file}:${error.line}: ${error.message}`);\n  }\n}","lang":"typescript","description":"Shows programmatic usage to lint SQL string and handle lint errors.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}