Registry /
testing / remark-lint-gherkin-up-to-one-background-per-file
Install & Compatibility
Where this runs
No compatibility data collected yet for this library.
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
default
✓ import remarkLintGherkinUpToOneBackgroundPerFile from 'remark-lint-gherkin-up-to-one-background-per-file'
✗ const { default } = require('remark-lint-gherkin-up-to-one-background-per-file')
ESM-only; no named export; default import is the plugin function.
remarkLintGherkinUpToOneBackgroundPerFile
✓ import remarkLintGherkinUpToOneBackgroundPerFile from 'remark-lint-gherkin-up-to-one-background-per-file'
✗ const { remarkLintGherkinUpToOneBackgroundPerFile } = require('remark-lint-gherkin-up-to-one-background-per-file')
Do not destructure; the package has only a default export.
type Options
✓ import type { Options } from 'remark-lint-gherkin-up-to-one-background-per-file'
TypeScript users can import the Options type for configuration.
Shows how to configure remark-lint pipeline with the plugin and lint a Gherkin file for multiple backgrounds.
import { unified } from 'unified';
import remarkParse from 'remark-parse';
import remarkLint from 'remark-lint';
import gherkinFromMdast from 'gherkin-from-mdast';
import remarkLintGherkinUpToOneBackgroundPerFile from 'remark-lint-gherkin-up-to-one-background-per-file';
import { lint } from 'remark-lint/message';
const processor = unified()
.use(remarkParse)
.use(remarkLint)
.use(gherkinFromMdast)
.use(remarkLintGherkinUpToOneBackgroundPerFile);
processor.process('Feature: Test\n Background: Setup\n Background: Duplicate').then((file) => {
const messages = lint(file);
console.log(messages); // Contains error about multiple backgrounds
});
Debug
Known issues
gotchaPlugin expects Gherkin AST from gherkin-from-mdast; otherwise it silently does nothing.fixEnsure you've added gherkinFromMdast() before this plugin in the pipeline.
affects: >=0.1.0
breakingVersion 0.1.0 initial release; no known breaking changes yet.
Errors
Common errors & fixes
Error: Cannot find module 'remark-lint-gherkin-up-to-one-background-per-file'
Package not installed or typo in import path
fixnpm install remark-lint-gherkin-up-to-one-background-per-file
TypeError: remarkLintGherkinUpToOneBackgroundPerFile is not a function
Incorrect import (named instead of default) or using ES import in CJS environment
fixUse default import: import plugin from 'remark-lint-gherkin-up-to-one-background-per-file' or in CJS: const plugin = require('remark-lint-gherkin-up-to-one-background-per-file').default Audit
Dependencies
remark-lintrequiredPeer dependency for lint rule integration
mdast-util-gherkinoptionalUsed for parsing and manipulating Gherkin AST