Created autonomously by voder.ai.
This page gives a high-level overview of how to use eslint-plugin-traceability in day-to-day development and answers common questions about annotations, rules, and their relationship to legacy aliases.
For detailed rule and option descriptions, see the API Reference. For concrete code samples, see the Examples document.
The plugin understands three annotation forms:
@supports– Preferred for new code and multi-story integrations.
Use this when a function, module, or branch implements requirements from one or more stories. A single@supportstag can express both the story path and the requirement IDs it implements.@story– Legacy story-level tag.
Still valid and useful when a function is tied to a single story file and you have not yet migrated to@supports.@req– Legacy requirement-level tag.
Pairs naturally with@storyfor simple, single-story scenarios.
Recommended usage:
- For new or refactored code, prefer
@supportsas your primary annotation. - For simple, single-story functions that already use
@story+@req, you can keep that style; there is no forced cut-over. - During migration, you can temporarily have both
@story/@reqand@supportsin the same block; the core rules and the optionaltraceability/prefer-supports-annotationrule are designed to support this.
The Migration Guide explains when and how to introduce @supports in more detail, including conservative auto-fix behavior.
For function-level checks, think in terms of a single canonical rule plus a small set of supporting rules.
traceability/require-traceability– Canonical function-level rule for new configurations.
Ensures that in-scope functions and methods have both story and requirement coverage. It understands both@supports(preferred) and legacy@story/@reqannotations.
Most users can choose one of these options:
-
Use the recommended preset (simplest):
// eslint.config.js import js from "@eslint/js"; import traceability from "eslint-plugin-traceability"; export default [js.configs.recommended, traceability.configs.recommended];
This enables
traceability/require-traceabilityand the other core rules with sensible defaults. -
Manually enable the unified rule and common helpers (when you need custom tuning):
// eslint.config.js import traceability from "eslint-plugin-traceability"; export default [ { plugins: { traceability }, rules: { // Canonical function-level rule "traceability/require-traceability": "error", // Common supporting rules "traceability/require-branch-annotation": "warn", "traceability/valid-annotation-format": "error", "traceability/valid-story-reference": "error", "traceability/valid-req-reference": "error", // Optional: enforce test traceability conventions "traceability/require-test-traceability": "warn", }, }, ];
The same guidance is summarized in the README under "Canonical function-level rule and legacy aliases".
Two additional rule keys exist for backward compatibility:
traceability/require-story-annotationtraceability/require-req-annotation
Key points:
- They are legacy aliases that share the same underlying engine as
traceability/require-traceability. - They are kept so that older configurations continue to work without change.
- New configurations should not rely on these keys directly unless you have a specific reason to tune their severities independently.
If you are starting from scratch, you can safely ignore the legacy keys and use only traceability/require-traceability together with the supporting rules listed above.
No. Existing @story + @req annotations remain valid and fully supported.
Typical migration path:
- Keep your current
@story+@reqannotations for simple, single-story functions. - Introduce
@supportsgradually for integration code that naturally spans multiple stories. - Optionally enable
traceability/prefer-supports-annotationat"warn"to get gentle guidance and conservative auto-fixes for straightforward single-story blocks. - Once you are comfortable, you can tighten enforcement or standardize on
@supportsfor new multi-story work.
See the Migration Guide for concrete before/after examples.
- Quick start and minimal config: See the main README.
- Full rule list and options: See the API Reference.
- End-to-end examples: See the Examples document, including:
- Flat-config snippets using the recommended and strict presets.
- CLI usage with the unified rule and clearly labeled legacy-alias examples.
- Test traceability examples using
traceability/require-test-traceability. - Branch annotation patterns that work well with formatters such as Prettier.
- Migration guidance: See the Migration Guide.
These resources are designed to be complementary: start with this overview to choose the right annotations and rules, then refer to the API reference and examples when you need exact configuration shapes or runnable code samples.