Registry /
testing / prettier-plugin-gherkin
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
muslnode 18–226 runs
build_error
glibcnode 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.fixUse 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.fixTest 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.fixExplicitly 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.
fixRun `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.
fixDo 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).
fixUpgrade Prettier to 3: `npm install --save-dev prettier@^3.0.0` or install plugin version 1.1.1.
Audit
Dependencies
prettierrequiredpeer dependency for formatting engine