ksql-lint
raw JSON → 1.0.1 verified Fri May 01 auth: no javascript
ksql-lint is a CLI tool for linting KSQLDB commands/queries, designed for use in CI/CD pipelines. It uses the official KSQLDB grammar from Confluent's ANTLR parser to validate KSQLDB statements syntax. The current version (1.0.1) is released under the MIT license. Key differentiators: direct grammar-based validation, simple CLI usage, exit codes for CI integration. It supports ANTLR 4.12 and is available via npx.
Common errors
error Error: Cannot find module 'antlr4' ↓
cause Missing antlr4 runtime dependency
fix
Install locally: npm install antlr4
error SyntaxError: Unexpected token (maybe from KSQL syntax) ↓
cause Parser can't handle some KSQL extensions or older grammar
fix
Use npx ksql-lint --grammar to check version; consider updating grammar
error ksql-lint: command not found ↓
cause Package not installed
fix
Run via npx or install globally: npm install -g ksql-lint
Warnings
breaking ANTLR version may cause compatibility issues: ksql-lint uses ANTLR 4.12. Updating requires regenerating the parser from grammar. ↓
fix Regenerate parser using generate.sh with updated ANTLR version in package.json and Docker image.
gotcha Exit code 1 indicates linting errors, but does not halt execution; intended for CI. ↓
fix Ensure pipeline checks exit code; no additional action needed.
gotcha File glob patterns may not expand on all shells; quotes may be needed. ↓
fix Use quoted glob patterns like '*.ksql'
Install
npm install ksql-lint yarn add ksql-lint pnpm add ksql-lint Imports
- main (CLI) wrong
npx ksql-lint --file ./path/*.ksqlcorrectnpx ksql-lint ./path/*.ksql - lint (programmatic) wrong
const { lint } = require('ksql-lint');correctimport { lint } from 'ksql-lint'; - parseError / validate wrong
import * as ksql from 'ksql-lint';correctimport { lint } from 'ksql-lint';
Quickstart
npx ksql-lint ./migrations/*.ksql