Registry / testing / remark-lint-gherkin-no-background-only-scenario

remark-lint-gherkin-no-background-only-scenario

JSON →
library0.1.0jsnpmunverified

remark-lint plugin to disallow Background when there is only a single Scenario in Gherkin feature files. Part of the unifiedjs-gherkin ecosystem. Version 0.1.0. Helps enforce maintainable Gherkin style by encouraging Background only for shared setup across multiple scenarios. Differentiates from general linting by targeting this specific antipattern. Low release cadence.

npm install remark-lint-gherkin-no-background-only-scenario
INSTALL
IMPORT
SIG · REMARK-LINT-GHERKI
R
remark-lint-gherkin-no-background-only-scenario
testingjavascriptv0.1.0
harness data pending
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.

remarkLintGherkinNoBackgroundOnlyScenario
import remarkLintGherkinNoBackgroundOnlyScenario from 'remark-lint-gherkin-no-background-only-scenario'
import { remarkLintGherkinNoBackgroundOnlyScenario } from 'remark-lint-gherkin-no-background-only-scenario'
Default export only; named import will give undefined.
plugin (via .use)
unified().use(remarkLintGherkinNoBackgroundOnlyScenario)
unified().use(remarkLintGherkinNoBackgroundOnlyScenario, {})
Plugin accepts no options; passing options may cause unexpected behavior.
TypeScript types
import type { Plugin } from 'unified'
import type { remarkLintGherkinNoBackgroundOnlyScenario } from 'remark-lint-gherkin-no-background-only-scenario'
Types are not re-exported; use unified types.

Set up remark-lint with the Gherkin plugin to warn on Background used with only one Scenario

import { unified } from 'unified'; import remarkParse from 'remark-parse'; import remarkLint from 'remark-lint'; import remarkLintGherkinNoBackgroundOnlyScenario from 'remark-lint-gherkin-no-background-only-scenario'; const file = await unified() .use(remarkParse) .use(remarkLint) .use(remarkLintGherkinNoBackgroundOnlyScenario) .process(`Feature: Example Background: Given something Scenario: Only one Then nothing`); console.log(file.messages); // [1:1-1:10: Background should not be used with a single scenario]
Debug
Known issues
gotchaPlugin does not export TypeScript types; rely on unified's Plugin type.
fix
Use `import type { Plugin } from 'unified'` instead.
affects: >=0.0.1
gotchaPlugin is a default export, not a named export. Named import yields undefined.
fix
Use `import pkg from 'remark-lint-gherkin-no-background-only-scenario'`.
affects: >=0.0.1
gotchaAccepts no options; passing an options object will be ignored but may cause confusion.
fix
Use without arguments: `.use(remarkLintGherkinNoBackgroundOnlyScenario)`.
affects: >=0.0.1
gotchaRequires a compatible version of unified (currently v10+). Using older version may produce errors.
fix
Ensure unified >=10.0.0 is installed.
affects: >=0.1.0
Errors
Common errors & fixes
TypeError: remarkLintGherkinNoBackgroundOnlyScenario is not a function
Using named import instead of default import.
fix
Change to: import remarkLintGherkinNoBackgroundOnlyScenario from 'remark-lint-gherkin-no-background-only-scenario'
Error: Cannot find module 'remark-lint-gherkin-no-background-only-scenario'
Package not installed or not resolvable.
fix
Run: npm install remark-lint-gherkin-no-background-only-scenario
Upgrade
Version history
0.1.0latest on npm
Audit
Dependencies
remark-lintrequiredPeer dependency: requires remark-lint to register the rule
Agent activity
2 hits · last 30 days
node
2
Resources
remark-lint-gherkin-no-background-only-scenario — npm install remark-lint-gherkin-no-background-only-scenario · libregistry