{"id":50523904,"url":"https://github.com/jojoee/gherkinfmt","last_synced_at":"2026-06-03T06:31:48.559Z","repository":{"id":333428004,"uuid":"1136911967","full_name":"jojoee/gherkinfmt","owner":"jojoee","description":"GHERKIN/FEATURE formatter - zero configuration, one way to format","archived":false,"fork":false,"pushed_at":"2026-01-19T13:18:28.000Z","size":177,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-01-19T14:54:18.560Z","etag":null,"topics":["development","feature","formatter","gherkin","linter","nodejs","style-guide"],"latest_commit_sha":null,"homepage":"https://jojoee.github.io/gherkinfmt/demo/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jojoee.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-01-18T15:31:53.000Z","updated_at":"2026-01-19T10:42:35.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/jojoee/gherkinfmt","commit_stats":null,"previous_names":["jojoee/gherkinfmt"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/jojoee/gherkinfmt","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jojoee%2Fgherkinfmt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jojoee%2Fgherkinfmt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jojoee%2Fgherkinfmt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jojoee%2Fgherkinfmt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jojoee","download_url":"https://codeload.github.com/jojoee/gherkinfmt/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jojoee%2Fgherkinfmt/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33852289,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-03T02:00:06.370Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["development","feature","formatter","gherkin","linter","nodejs","style-guide"],"created_at":"2026-06-03T06:31:47.924Z","updated_at":"2026-06-03T06:31:48.553Z","avatar_url":"https://github.com/jojoee.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# gherkinfmt\n\nOpinionated Gherkin formatter - zero configuration, one way to format.\n\n[![npm version](https://badge.fury.io/js/gherkinfmt.svg)](https://badge.fury.io/js/gherkinfmt)\n[![Download - npm](https://img.shields.io/npm/dt/gherkinfmt.svg)](https://www.npmjs.com/package/gherkinfmt)\n[![License - npm](https://img.shields.io/npm/l/gherkinfmt.svg)](http://opensource.org/licenses/MIT)\n[![install size](https://packagephobia.com/badge?p=gherkinfmt)](https://packagephobia.com/result?p=gherkinfmt)\n[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=flat-square)](https://github.com/semantic-release/semantic-release)\n\n[![continuous integration](https://github.com/jojoee/gherkinfmt/actions/workflows/continuous-integration.yml/badge.svg)](https://github.com/jojoee/gherkinfmt/actions/workflows/continuous-integration.yml)\n[![release](https://github.com/jojoee/gherkinfmt/actions/workflows/release.yml/badge.svg)](https://github.com/jojoee/gherkinfmt/actions/workflows/release.yml)\n[![runnable](https://github.com/jojoee/gherkinfmt/actions/workflows/runnable.yml/badge.svg)](https://github.com/jojoee/gherkinfmt/actions/workflows/runnable.yml)\n[![codecov](https://codecov.io/gh/jojoee/gherkinfmt/branch/main/graph/badge.svg)](https://codecov.io/gh/jojoee/gherkinfmt)\n\n## Philosophy\n\nLike [Standard.js](https://standardjs.com/) for JavaScript - no configuration, no debates. One way to format Gherkin/Cucumber feature files.\n\n## Installation\n\n```bash\n# npm\nnpm install gherkinfmt\n\n# yarn\nyarn add gherkinfmt\n\n# pnpm\npnpm add gherkinfmt\n\n# global install for CLI\nnpm install -g gherkinfmt\n```\n\n## Usage\n\n### CLI\n\n```bash\n# Check if files are formatted (validates without modifying)\ngherkinfmt --check file.feature\n\n# Check multiple files with glob pattern\ngherkinfmt --check \"src/**/*.feature\"\n\n# Check all .feature files in current directory\ngherkinfmt --check \"*.feature\"\n\n# Check all .feature files in directory (recursive)\ngherkinfmt --check src/\n\n# Format files in-place (overwrites)\ngherkinfmt --write file.feature\n\n# Format multiple files with glob pattern\ngherkinfmt --write \"src/**/*.feature\"\n\n# Format all .feature files in directory (recursive)\ngherkinfmt --write src/\n\n# Show help\ngherkinfmt --help\n\n# Show version\ngherkinfmt --version\n```\n\nGlob patterns support:\n- `*` - matches any characters except path separator\n- `**` - matches any characters including path separator (recursive)\n- `?` - matches single character\n- `{a,b}` - matches either pattern\n\nExit codes:\n- `0` - All files are formatted correctly (check) or formatted successfully (write)\n- `1` - Some files need formatting, errors occurred, or no mode specified\n\n### API\n\n```typescript\nimport { check, format } from 'gherkinfmt';\n\n// Check if Gherkin string is formatted correctly\nconst isFormatted = check('Feature: My Feature\\n');\nconsole.log(isFormatted); // true or false\n\n// Format Gherkin string\nconst formatted = format('Feature:My Feature');\nconsole.log(formatted); // 'Feature: My Feature\\n'\n```\n\n### CommonJS\n\n```javascript\nconst { check, format } = require('gherkinfmt');\n\nconst formatted = format('Feature: My Feature');\n```\n\n### Browser (UMD)\n\n```html\n\u003cscript src=\"https://unpkg.com/gherkinfmt/dist/gherkinfmt.umd.js\"\u003e\u003c/script\u003e\n\u003cscript\u003e\n  const formatted = gherkinfmt.format('Feature: My Feature');\n\u003c/script\u003e\n```\n\n### Docker\n\n```bash\n# Check a file\ndocker run --rm -v $(pwd):/data ghcr.io/jojoee/gherkinfmt --check /data/file.feature\n\n# Check all .feature files in a directory\ndocker run --rm -v $(pwd):/data ghcr.io/jojoee/gherkinfmt --check /data/\n\n# Format a file\ndocker run --rm -v $(pwd):/data ghcr.io/jojoee/gherkinfmt --write /data/file.feature\n```\n\n## Formatting Rules\n\nThese rules are **not configurable** - that's the point!\n\n| Rule | Value |\n|------|-------|\n| Indentation | 2 spaces |\n| Feature keyword | No indentation |\n| Background/Scenario/Scenario Outline | 2 spaces |\n| Rule keyword | 2 spaces |\n| Steps (Given/When/Then/And/But/*) | 4 spaces |\n| Examples | 4 spaces |\n| Data tables | Aligned columns |\n| Doc strings | Preserved with media type |\n| Tags | One per line, before element |\n| Comments | Preserved in place |\n| Trailing whitespace | Removed |\n| Blank lines | Single between scenarios |\n| End of file | Single newline |\n\n## API Reference\n\n### `check(input: string): boolean`\n\nCheck if a Gherkin string is formatted correctly.\n\n```typescript\ncheck('Feature: My Feature\\n');  // true\ncheck('Feature:My Feature');      // false (missing space)\n```\n\n### `format(input: string): string`\n\nFormat a Gherkin string according to the opinionated rules.\n\n```typescript\nformat('Feature:My Feature');\n// Returns: 'Feature: My Feature\\n'\n```\n\n## Gherkin Features Supported\n\n- Feature keyword\n- Background\n- Scenario\n- Scenario Outline with Examples\n- Steps (Given, When, Then, And, But, *)\n- Data tables (with column alignment)\n- Doc strings (triple quotes with media type)\n- Tags (@tag)\n- Comments (#)\n- Rule keyword (Gherkin 6+)\n- Descriptions (Feature, Scenario, Rule)\n- Unicode and special characters\n- Escaped characters in tables\n\n## Integration\n\n### Pre-commit Hook\n\n```bash\n# .husky/pre-commit\nnpx gherkinfmt --check \"features/**/*.feature\"\n```\n\n### VS Code Task\n\n```json\n{\n  \"version\": \"2.0.0\",\n  \"tasks\": [\n    {\n      \"label\": \"Check Gherkin\",\n      \"type\": \"shell\",\n      \"command\": \"npx gherkinfmt --check features/\"\n    }\n  ]\n}\n```\n\n### CI/CD\n\n```yaml\n# GitHub Actions\n- name: Check Gherkin formatting\n  run: npx gherkinfmt --check \"features/**/*.feature\"\n```\n\n## Development\n\n### Commands\n\n```bash\n# Install dependencies\nnpm install\n\n# Run tests\nnpm test\n\n# Run tests with coverage\nnpm run test:coverage\n\n# Build\nnpm run build\n\n# Build CLI\nnpm run build:cli\n\n# Lint\nnpm run lint\n```\n\n```bash\n# Run locally\n\n# Check a single file\nnode bin/gherkinfmt.js --check resource/01-minimal.feature\n\n# Check entire resource folder\nnode bin/gherkinfmt.js --check resource/\n\n# Format a single file (writes changes)\nnode bin/gherkinfmt.js --write resource/all-cases.feature\n\n# Format entire resource folder (writes changes)\nnode bin/gherkinfmt.js --write resource/\n```\n\n## Related\n\n- [Gherkin Specification](https://cucumber.io/docs/gherkin/reference/)\n- [Cucumber](https://cucumber.io/)\n- [prettier-plugin-gherkin](https://github.com/mapado/prettier-plugin-gherkin) - Prettier plugin for Gherkin files\n- [Standard.js](https://standardjs.com/) - Inspiration for zero-config philosophy\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjojoee%2Fgherkinfmt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjojoee%2Fgherkinfmt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjojoee%2Fgherkinfmt/lists"}