Gherkin Lint is a JavaScript-based linter and validator for Gherkin feature files, inspired by ESLint. It ensures consistency and adherence to predefined style and structural rules within Behavior-Driven Development (BDD) scenarios. The current stable version is 4.2.4, with recent releases focusing on dependency updates and minor bug fixes. The package helps teams maintain high-quality, readable, and maintainable Gherkin files by catching common pitfalls such as incorrect indentation, duplicate tags, unnamed features or scenarios, and structural inconsistencies. Its primary differentiator is its comprehensive set of configurable rules and its integration capabilities within CI/CD pipelines and development environments, allowing for early detection of issues in Gherkin syntax and style.
npm install gherkin-lintVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates programmatic use of the `Linter` class to lint a single Gherkin feature file. It shows how to read file content, instantiate the linter, and process the results. It assumes the presence of a `.gherkin-lintrc` configuration file in the working directory.
Review the project's GitHub release notes for specific breaking changes. Update your `.gherkin-lintrc` configuration and any programmatic usages accordingly.
Ensure your Node.js environment is version 10.0.0 or higher. You can manage Node.js versions using tools like `nvm` or `volta`.
Verify your `.gherkin-lintrc` file against the official documentation for correct syntax and rule options. Ensure it's valid JSON (allowing comments) and located in the project root or specified via CLI options.
While these warnings are generally harmless for `gherkin-lint`'s functionality, they can often be resolved by ensuring your `npm` or `yarn` is up-to-date. If issues persist, report them on the `gherkin-lint` GitHub issue tracker.
This is an open issue. As a temporary workaround, try using an older version of `glob` if possible, or ensure consistent path separators. Check the `gherkin-lint` GitHub issues for updates and potential patches.
This specific bug was fixed in `v2.11.1`. Ensure you are using `gherkin-lint@2.11.1` or newer. If you are on an older version, upgrade. If the error persists with a newer version, double-check your custom rule's configuration format.
This issue was resolved in `v2.13.2`. Upgrade `gherkin-lint` to version `2.13.2` or later to ensure proper variable detection and avoid false positives or negatives related to variable usage.