{"id":20365,"library":"prettier-plugin-gherkin","title":"prettier-plugin-gherkin","description":"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.","status":"active","version":"3.1.3","language":"javascript","source_language":"en","source_url":"https://github.com/mapado/prettier-plugin-gherkin","tags":["javascript","prettier","plugin","gherkin"],"install":[{"cmd":"npm install prettier-plugin-gherkin","lang":"bash","label":"npm"},{"cmd":"yarn add prettier-plugin-gherkin","lang":"bash","label":"yarn"},{"cmd":"pnpm add prettier-plugin-gherkin","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency for formatting engine","package":"prettier","optional":false}],"imports":[{"note":"The plugin is not imported directly; it is added to Prettier's plugins array in configuration.","wrong":"import prettierPluginGherkin from 'prettier-plugin-gherkin'","symbol":"default","correct":"import prettier from 'prettier'"},{"note":"Use the npm package name without scope in the plugins array.","wrong":"{\n  \"plugins\": [\"prettier-plugin-gherkin\", \"@prettier/plugin-gherkin\"]\n}","symbol":"plugins option","correct":"{\n  \"plugins\": [\"prettier-plugin-gherkin\"]\n}"},{"note":"The plugin exports no default; it's a CJS module that should be required directly.","wrong":"const plugin = require('prettier-plugin-gherkin').default;","symbol":"require()","correct":"const prettier = require('prettier');\nconst plugin = require('prettier-plugin-gherkin');"}],"quickstart":{"code":"// Install: npm install --save-dev prettier prettier-plugin-gherkin\n// .prettierrc\n{\n  \"plugins\": [\"prettier-plugin-gherkin\"],\n  \"forceNewlineBetweenStepBlocks\": true,\n  \"escapeBackslashes\": false\n}","lang":"javascript","description":"Shows installation via npm and minimal Prettier configuration to activate the plugin and set options."},"warnings":[{"fix":"Use plugin version 1.1.1 if still on Prettier 2, or upgrade Prettier to 3.","message":"Version 2.x dropped support for Prettier 2; plugin requires Prettier 3.","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Test formatting on your feature files and disable the plugin for files with non-standard syntax.","message":"The plugin does not handle all Gherkin dialects/extensions; custom tags or keywords may be reformatted unexpectedly.","severity":"gotcha","affected_versions":"*"},{"fix":"Explicitly configure these options in .prettierrc to avoid surprises.","message":"Options `forceNewlineBetweenStepBlocks` and `escapeBackslashes` only apply if set; defaults may not match team conventions.","severity":"gotcha","affected_versions":"*"},{"fix":"","message":"No deprecation warnings known yet.","severity":"deprecated","affected_versions":""}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Run `npm install --save-dev prettier-plugin-gherkin`.","cause":"The plugin is not installed or not in node_modules.","error":"Cannot find module 'prettier-plugin-gherkin'"},{"fix":"Do not import the plugin in code. Add it to your Prettier configuration's 'plugins' array.","cause":"Trying to import the plugin directly instead of using it via Prettier's plugins array.","error":"TypeError: Cannot read properties of undefined (reading 'format')"},{"fix":"Upgrade Prettier to 3: `npm install --save-dev prettier@^3.0.0` or install plugin version 1.1.1.","cause":"Version mismatch (plugin requires Prettier 3, but Prettier 2 is installed).","error":"prettier-plugin-gherkin: Plugin `prettier-plugin-gherkin` could not be loaded."}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}