Open-Awesome
CategoriesAlternativesStacksSelf-HostedExplore
Open-Awesome

© 2026 Open-Awesome. Curated for the developer elite.

TermsPrivacyAboutGitHubRSS
  1. Home
  2. ESLint
  3. SQL

SQL

NOASSERTIONTypeScriptv3.4.1

An ESLint plugin providing SQL linting rules for formatting and preventing unsafe queries in JavaScript/TypeScript code.

GitHubGitHub
113 stars23 forks0 contributors

What is SQL?

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.

Target Audience

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.

Value Proposition

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.

Overview

SQL linting rules for ESLint.

Use Cases

Best For

  • Enforcing consistent SQL formatting and indentation in template literals across a JavaScript/TypeScript codebase.
  • Preventing SQL injection vulnerabilities by enforcing the use of safe query construction patterns with designated `sql` tags.
  • Automatically formatting SQL queries using sql-formatter with configurable style options for different SQL dialects.
  • Linting SQL queries in PostgreSQL-focused codebases with support for PostgreSQL-specific syntax and placeholders.
  • Configuring custom parameter placeholder patterns (like `?`, `:name`, or `$1`) to ensure compatibility with various SQL dialects and query builders.
  • Integrating SQL code quality checks directly into existing ESLint workflows without requiring separate tooling.

Not Ideal For

  • Projects that construct SQL queries using raw string concatenation instead of template literals
  • Teams using SQL dialects with highly non-standard syntax that sql-formatter doesn't support well, despite configuration options
  • Codebases where SQL is primarily abstracted by ORMs like Prisma or query builders like Knex, reducing the need for inline SQL linting
  • Environments without an existing ESLint setup, as this plugin requires ESLint integration to function

Pros & Cons

Pros

Automated SQL Formatting

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.

SQL Injection Prevention

Enforces the use of a designated sql tag via the no-unsafe-query rule, catching potential SQL injection vulnerabilities early by preventing untagged queries.

PostgreSQL-First Optimization

Designed and tested primarily for PostgreSQL, offering robust support for its syntax and placeholders, which is explicitly stated in the README.

Flexible Placeholder Support

Allows configuration of custom parameter placeholders through regex patterns in paramTypes, ensuring compatibility with various SQL dialects and query builders.

Cons

Limited to Template Literals

Only lints SQL within template literals, ignoring queries in plain strings or external SQL files, which can miss issues in those contexts.

Complex Configuration for Dialects

Setting up for non-PostgreSQL dialects requires intricate adjustments to paramTypes and language options, making it error-prone and time-consuming.

No Semantic Validation

Focuses on formatting and basic safety checks but doesn't validate SQL syntax correctness or schema alignment, necessitating additional tooling for comprehensive analysis.

Frequently Asked Questions

Quick Stats

Stars113
Forks23
Contributors0
Open Issues4
Last commit7 months ago
CreatedSince 2017

Tags

#postgres#typescript#code-quality#postgresql#eslint-plugin#javascript#eslint#sql-linting#sql-formatting#static-analysis#sql-injection-prevention#sql

Built With

E
ESLint

Included in

ESLint4.7k
Auto-fetched 9 hours ago

Related Projects

BabelBabel

🐠 Babel is a compiler for writing next generation JavaScript.

Stars43,996
Forks6,001
Last commit18 hours ago
FlowFlow

Flow type linting rules for ESLint.

Stars1,067
Forks151
Last commit2 years ago
Flow ErrorsFlow Errors

Run Flow as an ESLint plugin

Stars403
Forks23
Last commit4 years ago
NN

Additional ESLint rules for Node.js

Stars346
Forks62
Last commit1 day ago
Community-curated · Updated weekly · 100% open source

Found a gem we're missing?

Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.

Submit a projectStar on GitHub