Registry / testing / gherkin-lint-ts

gherkin-lint-ts

JSON →
library5.0.6jsnpmunverified

Gherkin feature linter written in TypeScript, based on the original gherkin-lint project. Provides linting for .feature files using configurable rules, with support for custom TypeScript rules and error levels (Error/Warn). Current stable version is 5.0.6. Release cadence is irregular. Key differentiators: TypeScript support for writing custom rules, pretty terminal output, fixed issues from the original library, and output directed to process.stdout.

npm install gherkin-lint-ts
INSTALL
IMPORT
SIG · GHERKIN-LINT-TS
G
gherkin-lint-ts
testingjavascriptv5.0.6
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

lint
import { lint } from 'gherkin-lint-ts'
const gherkinLint = require('gherkin-lint-ts').lint
ESM module; default export is not present.
LintConfig
import type { LintConfig } from 'gherkin-lint-ts'
const { LintConfig } = require('gherkin-lint-ts')
TypeScript type, not importable as runtime value.
GherkinLintRule
import { GherkinLintRule } from 'gherkin-lint-ts'
Used for writing custom rules; only available in TypeScript.

Shows how to import and use the linter with a config object, linting .feature files and printing results.

import { lint } from 'gherkin-lint-ts'; const config = { rules: { 'no-tags-on-backgrounds': 'error', 'name-length': { Feature: { min: 1, max: 100 } } } }; const results = await lint(['path/to/features/**/*.feature'], config); console.log(JSON.stringify(results, null, 2));
gherkin-lint --version
Debug
Known issues
breakingThe 'lint' function is now asynchronous (returns a Promise) in v5.
fix
Use await or .then() when calling lint().
affects: >=5.0.0
deprecatedThe 'check' function is deprecated; use 'lint' instead.
fix
Replace check() with lint().
affects: >=4.0.0
gotchaConfiguration file must be named `.gherkin-lintrc` and placed in the project root; the library does not search up the directory tree.
fix
Ensure the config file is in the root directory of your project.
affects: >=0.0.1
breakingCustom rules written in JavaScript are no longer supported; they must be written in TypeScript.
fix
Rewrite custom rules in TypeScript.
affects: >=5.0.0
gotchaThe 'indentation' rule uses tabs by default instead of spaces.
fix
Specify 'indentation': { 'Feature': 'spaces', 'Scenario': 2 } in config.
affects: >=0.0.1
deprecatedThe 'new-line-at-eof' rule is deprecated; use the 'eof-newline' rule instead.
fix
Replace 'new-line-at-eof' with 'eof-newline' in config.
affects: >=4.0.0
Errors
Common errors & fixes
Error: Cannot find module 'gherkin'
Missing peer dependency 'gherkin'.
fix
Run 'npm install gherkin' or 'yarn add gherkin'.
TypeError: lint is not a function
Using incorrect import (e.g., require('gherkin-lint-ts') instead of named import).
fix
Use import { lint } from 'gherkin-lint-ts'.
ERROR: No rules configured in .gherkin-lintrc
Configuration file exists but is missing the 'rules' key or is empty.
fix
Add a 'rules' object with at least one rule to .gherkin-lintrc.
Upgrade
Version history
5.0.6latest on npm
Audit
Dependencies
gherkinrequiredParses Gherkin feature files
Agent activity
2 hits · last 30 days
node
2
Resources
gherkin-lint-ts — npm install gherkin-lint-ts · libregistry