Always clean your Gherkin.
A modern, extensible linter for Gherkin syntax — custom rules, automatic fixing, and beautiful HTML reports. CI-friendly. Fast. Strict where it matters.
HTML Report Preview
Top rule occurrences from a recent run.
What Gherklin does
Lint, fix, and report on Gherkin feature quality — locally or in CI.
Automatic Fixing
Whitespace & formatting issues (like trailing spaces, missing newline at EOF) can be fixed automatically before rules run.
Extensible Rules
Write custom rules in TypeScript; validate config with Zod; ship team conventions easily.
Rich HTML Reports
Zero-dependency, static HTML artefacts with severity charts, top rules, filters by severity & file.
CI-Friendly
Deterministic output, exit codes on failure, JSON reporter for machine parsing, HTML for humans.
Typed API
Use the Runner
programmatically to integrate deeply with your toolchain.
Fast & Modern
Built with TypeScript & ESM, tested on Node 22.x and 24.x.
Install & Use
Two commands and you’re linting.
Install
npm i -D gherklin # or yarn add -D gherklin
Run (CLI)
npx tsx ./node_modules/.bin/gherklin
Config (gherklin.config.ts)
export default { featureDirectory: "./features", customRulesDirectory: "./custom-rules", rules: { "allowed-tags": "off", "no-trailing-spaces": "error", "new-line-at-eof": "error", }, fix: true, }
API
import { Runner } from "gherklin"; (async () => { const runner = new Runner(); const init = await runner.init(); if (!init.success) throw init.schemaErrors; const result = await runner.run(); if (!result.success) process.exit(1); })();
Rules snapshot
Shipped set covers formatting, structure, consistency, and naming — plus your own custom rules.
Formatting
no-trailing-spaces
, new-line-at-eof
, indentation
, no-full-stops
Structure
keywords-in-logical-order
, no-background-only
, no-single-example-outline
Consistency
no-inconsistent-quotes
, no-typographer-quotes
, aligned-datatables
Naming & Uniqueness
no-unnamed-scenarios
, no-dupe-scenarios
, no-dupe-features
Perfect for CI
Emit JSON for machines, HTML for humans. Fail fast with maxErrors
, and attach the HTML artefact to your CI run for instant signal.