Skip to content

Migration from gherkin-lint ​

Replace the gherkin-lint dependency with gherkin-refine. The package installs a gherkin-lint command, reads .gherkin-lintrc and .gherkin-lintignore from the working directory, and accepts the gherkin-lint flags below, so existing scripts keep working. A .gherkin-lintrc runs only the rules it lists. When it lists rules that gherkin-refine cannot fully check, each run prints one warning line on stderr.

To review those differences, or to move to a native configuration, convert the file. The historical .gherkin-lintrc file is JSON and may contain comments. Run:

sh
gherkin-refine migrate .gherkin-lintrc --dry-run
gherkin-refine migrate .gherkin-lintrc

The migration writes gherkin-refine.config.json and does not replace an existing file unless --force is provided. Review every reported behavior difference before enabling the generated configuration.

The generated configuration sets extends: []. gherkin-lint runs only the rules a file lists, so the recommended preset stays off until you remove that line. Rules set to off in the legacy file are not reported as unsupported.

Keep .gherkin-lintignore. gherkin-refine reads it from the working directory on every run, as gherkin-lint does, and adds its non-empty lines to ignores.

Legacy ruleNew ruleStatus
no-duplicate-tagsno-duplicate-tagsSame intent
no-dupe-feature-namesno-duplicate-feature-namesScope is the set of linted files
no-dupe-scenario-namesno-duplicate-scenario-namesThe default anywhere maps to { scope: "anywhere" }; in-feature maps to one Feature or Rule. Names compare case-insensitively
no-unused-variablesno-unused-outline-variablesUses parsed step arguments and localized AST
scenario-sizescenario-size, background-sizeScenario and Background limits map separately. Without options, both use the gherkin-lint default of 15
name-lengthname-lengthSame per-node limits for Feature, Rule, Scenario, and Step
no-trailing-spacesno-trailing-whitespaceSame intent, with safe autofix
no-multiple-empty-linesno-extra-blank-linesSame intent, with safe autofix
keywords-in-logical-orderlogical-keyword-orderUses parser semantic step types, including localized dialects
allowed-tagsallowed-tagsSame tags and patterns options. Tags inside Rule blocks are also checked
no-restricted-tagsno-restricted-tagsSame tags and patterns options. Tags inside Rule blocks are also checked
indentation, new-line-at-eof, file-name, use-and, one-space-between-tags, required-tags, no-restricted-patternsSame namesSame options and findings. Each one except file-name has a safe autofix
no-unnamed-features, no-unnamed-scenarios, no-empty-file, no-files-without-scenarios, no-empty-background, no-background-only-scenario, no-scenario-outlines-without-examples, no-examples-in-scenarios, no-partially-commented-tag-lines, no-superfluous-tagsSame namesSame findings. Except for indentation, rules that walk Scenarios also check the ones inside Rule blocks
no-homogenous-tagsno-homogeneous-tagsSpelling corrected; see the fixes below
max-scenarios-per-filefeature-sizeSame count and options: countOutlineExamples defaults to true when migrated, maxScenarios to 10
only-one-whenonly-one-whenAnd after When no longer counts as a second When (gherkin-lint#345)
Custom rules from --rulesdirnoneReported as unsupported

Three rules fix gherkin-lint bugs and can only report less than before: no-homogeneous-tags ignores a single Scenario or Examples block and reports one finding per tag (#231, #257, #170), no-background-only-scenario ignores a Background without Scenarios (#159), and only-one-when as above.

migrate --strict fails without writing a file when any rule cannot be fully migrated.

test/gherkin-lint-parity.test.ts runs gherkin-lint 4.2.4 and gherkin-refine on the same fixtures in CI, for every rule, and fails if their findings differ beyond the fixes listed above.

This is a migration aid, not a compatibility mode. Review output because the former and current tools have different parser and scope behavior.

CLI flags ​

gherkin-lintgherkin-refine
-c, --config-c, --config, including a path to a .gherkin-lintrc
-f, --format-f, --format. xunit has no equivalent; json, ndjson, and sarif are available
-i, --ignore-i, --ignore. The comma-separated patterns replace .gherkin-lintignore
-r, --rulesdir-r, --rulesdir. A directory without .js files is accepted; custom rules must be ported to a plugin

Released under the MIT License.