eslint-plugin-traceability 1.7.0 → 1.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +82 -0
- package/README.md +73 -32
- package/docs/ci-cd-pipeline.md +224 -0
- package/docs/cli-integration.md +22 -0
- package/docs/code-quality-refactor-opportunities-2025-12-03.md +78 -0
- package/docs/config-presets.md +38 -0
- package/docs/conventional-commits-guide.md +185 -0
- package/docs/custom-rules-development-guide.md +659 -0
- package/docs/decisions/0001-allow-dynamic-require-for-built-plugins.md +26 -0
- package/docs/decisions/001-typescript-for-eslint-plugin.accepted.md +111 -0
- package/docs/decisions/002-jest-for-eslint-testing.accepted.md +137 -0
- package/docs/decisions/003-code-quality-ratcheting-plan.md +48 -0
- package/docs/decisions/004-automated-version-bumping-for-ci-cd.md +196 -0
- package/docs/decisions/005-github-actions-validation-tooling.accepted.md +144 -0
- package/docs/decisions/006-semantic-release-for-automated-publishing.accepted.md +227 -0
- package/docs/decisions/007-github-releases-over-changelog.accepted.md +216 -0
- package/docs/decisions/008-ci-audit-flags.accepted.md +60 -0
- package/docs/decisions/009-security-focused-lint-rules.accepted.md +64 -0
- package/docs/decisions/010-implements-annotation-for-multi-story-requirements.proposed.md +184 -0
- package/docs/decisions/adr-0001-console-usage-for-cli-guards.md +190 -0
- package/docs/decisions/adr-accept-dev-dep-risk-glob.md +40 -0
- package/docs/decisions/adr-commit-branch-tests.md +54 -0
- package/docs/decisions/adr-maintenance-cli-interface.md +140 -0
- package/docs/decisions/adr-pre-push-parity.md +112 -0
- package/docs/decisions/code-quality-ratcheting-plan.md +53 -0
- package/docs/dependency-health.md +238 -0
- package/docs/eslint-9-setup-guide.md +517 -0
- package/docs/eslint-plugin-development-guide.md +487 -0
- package/docs/functionality-coverage-2025-12-03.md +250 -0
- package/docs/jest-testing-guide.md +100 -0
- package/docs/rules/prefer-implements-annotation.md +219 -0
- package/docs/rules/require-branch-annotation.md +71 -0
- package/docs/rules/require-req-annotation.md +203 -0
- package/docs/rules/require-story-annotation.md +159 -0
- package/docs/rules/valid-annotation-format.md +418 -0
- package/docs/rules/valid-req-reference.md +153 -0
- package/docs/rules/valid-story-reference.md +120 -0
- package/docs/security-incidents/2025-11-17-glob-cli-incident.md +45 -0
- package/docs/security-incidents/2025-11-18-brace-expansion-redos.md +45 -0
- package/docs/security-incidents/2025-11-18-bundled-dev-deps-accepted-risk.md +93 -0
- package/docs/security-incidents/2025-11-18-tar-race-condition.md +43 -0
- package/docs/security-incidents/2025-12-03-dependency-health-review.md +58 -0
- package/docs/security-incidents/SECURITY-INCIDENT-2025-11-18-semantic-release-bundled-npm.known-error.md +104 -0
- package/docs/security-incidents/SECURITY-INCIDENT-TEMPLATE.md +37 -0
- package/docs/security-incidents/dependency-override-rationale.md +57 -0
- package/docs/security-incidents/dev-deps-high.json +116 -0
- package/docs/security-incidents/handling-procedure.md +54 -0
- package/docs/stories/001.0-DEV-PLUGIN-SETUP.story.md +92 -0
- package/docs/stories/002.0-DEV-ESLINT-CONFIG.story.md +82 -0
- package/docs/stories/003.0-DEV-FUNCTION-ANNOTATIONS.story.md +112 -0
- package/docs/stories/004.0-DEV-BRANCH-ANNOTATIONS.story.md +153 -0
- package/docs/stories/005.0-DEV-ANNOTATION-VALIDATION.story.md +138 -0
- package/docs/stories/006.0-DEV-FILE-VALIDATION.story.md +144 -0
- package/docs/stories/007.0-DEV-ERROR-REPORTING.story.md +163 -0
- package/docs/stories/008.0-DEV-AUTO-FIX.story.md +150 -0
- package/docs/stories/009.0-DEV-MAINTENANCE-TOOLS.story.md +117 -0
- package/docs/stories/010.0-DEV-DEEP-VALIDATION.story.md +124 -0
- package/docs/stories/010.1-DEV-CONFIGURABLE-PATTERNS.story.md +149 -0
- package/docs/stories/010.2-DEV-MULTI-STORY-SUPPORT.story.md +216 -0
- package/docs/stories/010.3-DEV-MIGRATE-TO-IMPLEMENTS.story.md +236 -0
- package/docs/stories/developer-story.map.md +120 -0
- package/docs/ts-jest-presets-guide.md +548 -0
- package/lib/src/index.d.ts +2 -2
- package/lib/src/index.js +2 -0
- package/lib/src/maintenance/batch.d.ts +5 -0
- package/lib/src/maintenance/batch.js +5 -0
- package/lib/src/maintenance/cli.js +34 -212
- package/lib/src/maintenance/commands.d.ts +32 -0
- package/lib/src/maintenance/commands.js +139 -0
- package/lib/src/maintenance/detect.d.ts +2 -0
- package/lib/src/maintenance/detect.js +4 -0
- package/lib/src/maintenance/flags.d.ts +99 -0
- package/lib/src/maintenance/flags.js +121 -0
- package/lib/src/maintenance/report.d.ts +2 -0
- package/lib/src/maintenance/report.js +2 -0
- package/lib/src/maintenance/update.d.ts +4 -0
- package/lib/src/maintenance/update.js +4 -0
- package/lib/src/rules/helpers/require-story-io.d.ts +3 -0
- package/lib/src/rules/helpers/require-story-io.js +20 -6
- package/lib/src/rules/helpers/valid-annotation-format-internal.d.ts +30 -0
- package/lib/src/rules/helpers/valid-annotation-format-internal.js +36 -0
- package/lib/src/rules/helpers/valid-annotation-options.js +15 -4
- package/lib/src/rules/helpers/valid-annotation-utils.js +5 -0
- package/lib/src/rules/helpers/valid-implements-utils.d.ts +75 -0
- package/lib/src/rules/helpers/valid-implements-utils.js +149 -0
- package/lib/src/rules/helpers/valid-story-reference-helpers.d.ts +3 -4
- package/lib/src/rules/prefer-implements-annotation.d.ts +39 -0
- package/lib/src/rules/prefer-implements-annotation.js +276 -0
- package/lib/src/rules/valid-annotation-format.js +87 -28
- package/lib/src/rules/valid-req-reference.js +71 -0
- package/lib/src/utils/reqAnnotationDetection.d.ts +4 -1
- package/lib/src/utils/reqAnnotationDetection.js +43 -15
- package/lib/tests/maintenance/cli.test.js +89 -0
- package/lib/tests/plugin-default-export-and-configs.test.js +3 -0
- package/lib/tests/rules/prefer-implements-annotation.test.d.ts +1 -0
- package/lib/tests/rules/prefer-implements-annotation.test.js +84 -0
- package/lib/tests/rules/require-req-annotation.test.js +8 -1
- package/lib/tests/rules/require-story-annotation.test.js +9 -4
- package/lib/tests/rules/valid-annotation-format.test.js +78 -0
- package/lib/tests/rules/valid-req-reference.test.js +34 -0
- package/lib/tests/utils/ts-language-options.d.ts +1 -7
- package/lib/tests/utils/ts-language-options.js +8 -5
- package/package.json +7 -3
- package/user-docs/api-reference.md +507 -0
- package/user-docs/eslint-9-setup-guide.md +639 -0
- package/user-docs/examples.md +74 -0
- package/user-docs/migration-guide.md +158 -0
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
# Migration Guide from v0.x to v1.x
|
|
2
|
+
|
|
3
|
+
Created autonomously by [voder.ai](https://voder.ai)
|
|
4
|
+
This guide covers migration from 0.x to the 1.x series of eslint-plugin-traceability. For the current 1.x release and detailed changelog, see GitHub Releases: <https://github.com/voder-ai/eslint-plugin-traceability/releases>.
|
|
5
|
+
|
|
6
|
+
This guide helps you migrate from versions 0.x of `eslint-plugin-traceability` to 1.x.
|
|
7
|
+
|
|
8
|
+
## 1. Update Dependency
|
|
9
|
+
|
|
10
|
+
Update your development dependency to the latest 1.x release:
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
npm install --save-dev eslint-plugin-traceability@^1.0.0
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Or with Yarn:
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
yarn add --dev eslint-plugin-traceability@^1.0.0
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## 2. ESLint Configuration Changes
|
|
23
|
+
|
|
24
|
+
- Version 1.x uses ESLint v9 flat config by default. If you currently use `.eslintrc.js`, you can continue using it, but consider migrating to the new flat config format for future upgrades.
|
|
25
|
+
- Update your ESLint config to load the plugin’s recommended settings:
|
|
26
|
+
|
|
27
|
+
```js
|
|
28
|
+
// eslint.config.js (ESLint v9 flat config)
|
|
29
|
+
import traceability from "eslint-plugin-traceability";
|
|
30
|
+
|
|
31
|
+
export default [traceability.configs.recommended];
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## 3. New and Updated Rules
|
|
35
|
+
|
|
36
|
+
- `valid-story-reference` now enforces `.story.md` extensions strictly.
|
|
37
|
+
- `valid-req-reference` rejects path traversal (`../`) and absolute paths (`/etc/passwd`).
|
|
38
|
+
- `valid-annotation-format` enforces correct JSDoc traceability annotation syntax (`@story` and `@req` tags).
|
|
39
|
+
|
|
40
|
+
Review and update your existing annotations accordingly:
|
|
41
|
+
|
|
42
|
+
```diff
|
|
43
|
+
- /** @story docs/stories/001.0-DEV-PLUGIN-SETUP.md */
|
|
44
|
+
+ /** @story docs/stories/001.0-DEV-PLUGIN-SETUP.story.md */
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### 3.1 Multi-story `@implements` annotations
|
|
48
|
+
|
|
49
|
+
Starting in v1.x, `eslint-plugin-traceability` supports an additional annotation form for integration code that implements requirements from multiple stories:
|
|
50
|
+
|
|
51
|
+
```js
|
|
52
|
+
/**
|
|
53
|
+
* @implements docs/stories/010.2-DEV-MULTI-STORY-SUPPORT.story.md REQ-IMPLEMENTS-PARSE REQ-IMPLEMENTS-VALIDATE
|
|
54
|
+
*/
|
|
55
|
+
function integrate() {}
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
You **do not** need to change existing, single-story annotations that already use `@story` and `@req`. Migration to `@implements` is only recommended when a function or module genuinely implements requirements from more than one story file.
|
|
59
|
+
|
|
60
|
+
#### When to keep `@story` + `@req`
|
|
61
|
+
|
|
62
|
+
Keep your current annotations if:
|
|
63
|
+
|
|
64
|
+
- Each function is tied to a single story file.
|
|
65
|
+
- All relevant requirements live in that story file.
|
|
66
|
+
- You do not need to distinguish which story a particular requirement ID comes from.
|
|
67
|
+
|
|
68
|
+
Example (no migration required):
|
|
69
|
+
|
|
70
|
+
```js
|
|
71
|
+
/**
|
|
72
|
+
* @story docs/stories/003.0-DEV-FUNCTION-ANNOTATIONS.story.md
|
|
73
|
+
* @req REQ-ANNOTATION-REQUIRED
|
|
74
|
+
*/
|
|
75
|
+
export function initAuth() {
|
|
76
|
+
// ...
|
|
77
|
+
}
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
#### When to introduce `@implements`
|
|
81
|
+
|
|
82
|
+
Adopt `@implements` for **multi-story integration** code, especially when:
|
|
83
|
+
|
|
84
|
+
- The function combines behavior governed by **multiple** stories.
|
|
85
|
+
- Requirement IDs are reused across stories (for example, `REQ-SHARED-ID` appears in more than one story file).
|
|
86
|
+
- You want deep validation (via `valid-req-reference`) to know **which story file** each requirement came from.
|
|
87
|
+
|
|
88
|
+
Before (single-story annotations trying to describe multi-story behavior):
|
|
89
|
+
|
|
90
|
+
```js
|
|
91
|
+
/**
|
|
92
|
+
* Apply age and security filters to rows.
|
|
93
|
+
* @story docs/stories/003.0-DEV-IDENTIFY-OUTDATED.story.md
|
|
94
|
+
* @req REQ-AGE-THRESHOLD
|
|
95
|
+
* @req REQ-OUTPUT
|
|
96
|
+
*/
|
|
97
|
+
export async function applyFilters(rows, options) {
|
|
98
|
+
// combined behavior
|
|
99
|
+
}
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
After (multi-story `@implements`), aligned with Story 010.2:
|
|
103
|
+
|
|
104
|
+
```js
|
|
105
|
+
/**
|
|
106
|
+
* Apply age and security filters to rows.
|
|
107
|
+
* @story docs/stories/003.0-DEV-IDENTIFY-OUTDATED.story.md
|
|
108
|
+
* @req REQ-AGE-THRESHOLD
|
|
109
|
+
* @req REQ-OUTPUT
|
|
110
|
+
*
|
|
111
|
+
* @implements docs/stories/003.0-DEV-IDENTIFY-OUTDATED.story.md REQ-AGE-THRESHOLD REQ-OUTPUT
|
|
112
|
+
* @implements docs/stories/004.0-DEV-FILTER-VULNERABLE-VERSIONS.story.md REQ-AUDIT-CHECK REQ-SAFE-ONLY
|
|
113
|
+
*/
|
|
114
|
+
export async function applyFilters(rows, options) {
|
|
115
|
+
// combined behavior
|
|
116
|
+
}
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
In the "after" example:
|
|
120
|
+
|
|
121
|
+
- `valid-annotation-format` ensures the `@implements` lines use a valid story path and requirement ID format.
|
|
122
|
+
- `valid-req-reference` validates that each requirement listed after `@implements` exists in the corresponding story file.
|
|
123
|
+
|
|
124
|
+
#### Mixed usage during migration
|
|
125
|
+
|
|
126
|
+
You can introduce `@implements` gradually without breaking existing code:
|
|
127
|
+
|
|
128
|
+
1. Leave existing `@story` and `@req` annotations in place.
|
|
129
|
+
2. Add `@implements` lines that group requirements by story file.
|
|
130
|
+
3. Run ESLint with `traceability/valid-annotation-format` and `traceability/valid-req-reference` enabled to confirm everything passes.
|
|
131
|
+
4. Optionally, once you are comfortable, standardize on using `@implements` for multi-story integration functions while keeping `@story` + `@req` for simple, single-story code.
|
|
132
|
+
|
|
133
|
+
For detailed semantics and edge cases (path validation, scoped requirement IDs, and multi-story fixtures), see:
|
|
134
|
+
|
|
135
|
+
- Rule docs: [`docs/rules/valid-annotation-format.md`](../docs/rules/valid-annotation-format.md), [`docs/rules/valid-req-reference.md`](../docs/rules/valid-req-reference.md)
|
|
136
|
+
- Story: [`docs/stories/010.2-DEV-MULTI-STORY-SUPPORT.story.md`](../docs/stories/010.2-DEV-MULTI-STORY-SUPPORT.story.md)
|
|
137
|
+
|
|
138
|
+
## 4. Test and Validate
|
|
139
|
+
|
|
140
|
+
Run your test suite to confirm everything passes:
|
|
141
|
+
|
|
142
|
+
```bash
|
|
143
|
+
npm test
|
|
144
|
+
npm run lint -- --max-warnings=0
|
|
145
|
+
npm run format:check
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
## 5. Update Documentation
|
|
149
|
+
|
|
150
|
+
If you have custom documentation or examples that reference old rule names or file paths, update them to match the new conventions introduced in v1.x.
|
|
151
|
+
|
|
152
|
+
## Security and Dependency Notes
|
|
153
|
+
|
|
154
|
+
Production dependency guarantees are enforced by CI scripts that run `npm audit --omit=dev --audit-level=high` and manage version changes via `dry-aged-deps`, with additional details on thresholds, review policies, and incident handling defined in the project's internal security and dependency health documentation.
|
|
155
|
+
|
|
156
|
+
---
|
|
157
|
+
|
|
158
|
+
If you encounter any issues during migration, please file an issue at https://github.com/voder-ai/eslint-plugin-traceability/issues.
|