Registry / testing / prettier-plugin-gherkin

prettier-plugin-gherkin

JSON →
library3.1.3jsnpmunverified

A Prettier plugin that formats Gherkin (.feature) files used by Cucumber and BDD frameworks. The current stable version is 3.1.3, compatible with Prettier 3 (use 1.1.1 for Prettier 2). It enforces consistent indentation, table cell alignment, and spacing in feature files. Differentiators include options like `forceNewlineBetweenStepBlocks` and `escapeBackslashes`, and it integrates seamlessly with Prettier's existing configuration and editor plugins.

npm install prettier-plugin-gherkin
INSTALL
IMPORT
SIG · PRETTIER-PLUGIN-GH
P
prettier-plugin-gherkin
testingjavascriptv3.1.3
Install
—
Import
—
Disk
—
Pass rate
0/ 6
Env Coverage0 / 6
glibc
18–22
musl
18–22
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18–226 runs
build_error
glibc
node 18–226 runs
build_error
Code
Verified usage

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

default
✓ import prettier from 'prettier'
✗ import prettierPluginGherkin from 'prettier-plugin-gherkin'
The plugin is not imported directly; it is added to Prettier's plugins array in configuration.
plugins option
✓ { "plugins": ["prettier-plugin-gherkin"] }
✗ { "plugins": ["prettier-plugin-gherkin", "@prettier/plugin-gherkin"] }
Use the npm package name without scope in the plugins array.
require()
✓ const prettier = require('prettier'); const plugin = require('prettier-plugin-gherkin');
✗ const plugin = require('prettier-plugin-gherkin').default;
The plugin exports no default; it's a CJS module that should be required directly.

Shows installation via npm and minimal Prettier configuration to activate the plugin and set options.

// Install: npm install --save-dev prettier prettier-plugin-gherkin // .prettierrc { "plugins": ["prettier-plugin-gherkin"], "forceNewlineBetweenStepBlocks": true, "escapeBackslashes": false }
prettier --version
Debug
Known issues
breakingVersion 2.x dropped support for Prettier 2; plugin requires Prettier 3.
fix
Use plugin version 1.1.1 if still on Prettier 2, or upgrade Prettier to 3.
affects: >=2.0.0
gotchaThe plugin does not handle all Gherkin dialects/extensions; custom tags or keywords may be reformatted unexpectedly.
fix
Test formatting on your feature files and disable the plugin for files with non-standard syntax.
affects: *
gotchaOptions `forceNewlineBetweenStepBlocks` and `escapeBackslashes` only apply if set; defaults may not match team conventions.
fix
Explicitly configure these options in .prettierrc to avoid surprises.
affects: *
deprecatedNo deprecation warnings known yet.
Errors
Common errors & fixes
Cannot find module 'prettier-plugin-gherkin'
The plugin is not installed or not in node_modules.
fix
Run `npm install --save-dev prettier-plugin-gherkin`.
TypeError: Cannot read properties of undefined (reading 'format')
Trying to import the plugin directly instead of using it via Prettier's plugins array.
fix
Do not import the plugin in code. Add it to your Prettier configuration's 'plugins' array.
prettier-plugin-gherkin: Plugin `prettier-plugin-gherkin` could not be loaded.
Version mismatch (plugin requires Prettier 3, but Prettier 2 is installed).
fix
Upgrade Prettier to 3: `npm install --save-dev prettier@^3.0.0` or install plugin version 1.1.1.
Upgrade
Version history
3.1.3latest on npm
Audit
Dependencies
prettierrequiredpeer dependency for formatting engine
Agent activity
8 hits · last 30 days
node
6
Bingbot
1
Resources
prettier-plugin-gherkin — npm install prettier-plugin-gherkin · libregistry