An ESLint plugin providing SQL linting rules for formatting and preventing unsafe queries in JavaScript/TypeScript code.
eslint-plugin-sql is an ESLint plugin that enforces SQL code quality and security within JavaScript and TypeScript projects. It integrates directly into the ESLint ecosystem to catch SQL-related issues during development and maintain consistent SQL formatting across the codebase.
JavaScript and TypeScript developers working with SQL queries in their codebase, particularly those using PostgreSQL or other SQL dialects with query builders like sql-tag or mightyql.
Developers choose this plugin because it treats SQL as a first-class citizen in JavaScript projects by integrating SQL linting directly into the standard ESLint workflow, providing automated formatting and security enforcement that catches issues early.
SQL linting rules for ESLint.
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Integrates sql-formatter to automatically format SQL queries in template literals with configurable indentation, keyword case, and dialect support, as shown in the detailed format rule options.
Enforces the use of a designated sql tag via the no-unsafe-query rule, catching potential SQL injection vulnerabilities early by preventing untagged queries.
Designed and tested primarily for PostgreSQL, offering robust support for its syntax and placeholders, which is explicitly stated in the README.
Allows configuration of custom parameter placeholders through regex patterns in paramTypes, ensuring compatibility with various SQL dialects and query builders.
Only lints SQL within template literals, ignoring queries in plain strings or external SQL files, which can miss issues in those contexts.
Setting up for non-PostgreSQL dialects requires intricate adjustments to paramTypes and language options, making it error-prone and time-consuming.
Focuses on formatting and basic safety checks but doesn't validate SQL syntax correctness or schema alignment, necessitating additional tooling for comprehensive analysis.