eslint-plugin-traceability 1.1.1 → 1.1.3
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/package.json +6 -1
- package/.env.example +0 -6
- package/.github/workflows/ci-cd.yml +0 -110
- package/.husky/pre-commit +0 -1
- package/.husky/pre-push +0 -1
- package/.prettierignore +0 -27
- package/.prettierrc +0 -4
- package/.releaserc.json +0 -20
- package/.voder/history.md +0 -162
- package/.voder/implementation-progress.md +0 -144
- package/.voder/last-action.md +0 -83
- package/.voder/plan.md +0 -12
- package/.voder/progress-chart.png +0 -0
- package/.voder/progress-log-areas.csv +0 -39
- package/.voder/progress-log.csv +0 -38
- package/.voder/traceability/docs-stories-001.0-DEV-PLUGIN-SETUP.story.xml +0 -17
- package/.voder/traceability/docs-stories-002.0-DEV-ESLINT-CONFIG.story.xml +0 -13
- package/.voder/traceability/docs-stories-003.0-DEV-FUNCTION-ANNOTATIONS.story.xml +0 -9
- package/.voder/traceability/docs-stories-004.0-DEV-BRANCH-ANNOTATIONS.story.xml +0 -9
- package/.voder/traceability/docs-stories-005.0-DEV-ANNOTATION-VALIDATION.story.xml +0 -9
- package/.voder/traceability/docs-stories-006.0-DEV-FILE-VALIDATION.story.xml +0 -9
- package/.voder/traceability/docs-stories-007.0-DEV-ERROR-REPORTING.story.xml +0 -9
- package/.voder/traceability/docs-stories-008.0-DEV-AUTO-FIX.story.xml +0 -9
- package/.voder/traceability/docs-stories-009.0-DEV-MAINTENANCE-TOOLS.story.xml +0 -16
- package/.voder/traceability/docs-stories-010.0-DEV-DEEP-VALIDATION.story.xml +0 -11
- package/CHANGELOG.md +0 -58
- package/CONTRIBUTING.md +0 -99
- package/cli-integration.js +0 -103
- package/docs/cli-integration.md +0 -105
- package/docs/config-presets.md +0 -38
- package/docs/conventional-commits-guide.md +0 -185
- package/docs/decisions/001-typescript-for-eslint-plugin.accepted.md +0 -111
- package/docs/decisions/002-jest-for-eslint-testing.accepted.md +0 -137
- package/docs/decisions/003-code-quality-ratcheting-plan.md +0 -48
- package/docs/decisions/004-automated-version-bumping-for-ci-cd.md +0 -196
- package/docs/decisions/005-github-actions-validation-tooling.accepted.md +0 -144
- package/docs/decisions/006-semantic-release-for-automated-publishing.accepted.md +0 -227
- package/docs/eslint-9-setup-guide.md +0 -517
- package/docs/eslint-plugin-development-guide.md +0 -483
- package/docs/jest-testing-guide.md +0 -100
- package/docs/rules/require-branch-annotation.md +0 -34
- package/docs/rules/require-req-annotation.md +0 -39
- package/docs/rules/require-story-annotation.md +0 -36
- package/docs/rules/valid-annotation-format.md +0 -52
- package/docs/rules/valid-req-reference.md +0 -58
- package/docs/rules/valid-story-reference.md +0 -47
- package/docs/security-incidents/unresolved-vulnerabilities.md +0 -11
- package/docs/stories/001.0-DEV-PLUGIN-SETUP.story.md +0 -82
- package/docs/stories/002.0-DEV-ESLINT-CONFIG.story.md +0 -82
- package/docs/stories/003.0-DEV-FUNCTION-ANNOTATIONS.story.md +0 -85
- package/docs/stories/004.0-DEV-BRANCH-ANNOTATIONS.story.md +0 -107
- package/docs/stories/005.0-DEV-ANNOTATION-VALIDATION.story.md +0 -119
- package/docs/stories/006.0-DEV-FILE-VALIDATION.story.md +0 -127
- package/docs/stories/007.0-DEV-ERROR-REPORTING.story.md +0 -89
- package/docs/stories/008.0-DEV-AUTO-FIX.story.md +0 -104
- package/docs/stories/009.0-DEV-MAINTENANCE-TOOLS.story.md +0 -104
- package/docs/stories/010.0-DEV-DEEP-VALIDATION.story.md +0 -110
- package/docs/stories/developer-story.map.md +0 -118
- package/eslint.config.js +0 -146
- package/jest.config.js +0 -21
- package/scripts/smoke-test.sh +0 -51
- package/src/index.ts +0 -56
- package/src/maintenance/batch.ts +0 -29
- package/src/maintenance/detect.ts +0 -42
- package/src/maintenance/index.ts +0 -14
- package/src/maintenance/report.ts +0 -15
- package/src/maintenance/update.ts +0 -40
- package/src/maintenance/utils.ts +0 -28
- package/src/rules/require-branch-annotation.ts +0 -114
- package/src/rules/require-req-annotation.ts +0 -36
- package/src/rules/require-story-annotation.ts +0 -52
- package/src/rules/valid-annotation-format.ts +0 -62
- package/src/rules/valid-req-reference.ts +0 -114
- package/src/rules/valid-story-reference.ts +0 -213
- package/tests/fixtures/stale/example.ts +0 -2
- package/tests/fixtures/story_bullet.md +0 -6
- package/tests/fixtures/update/example.ts +0 -2
- package/tests/fixtures/valid-annotations/example.ts +0 -2
- package/tests/maintenance/batch.test.ts +0 -55
- package/tests/maintenance/detect-isolated.test.ts +0 -65
- package/tests/maintenance/detect.test.ts +0 -19
- package/tests/maintenance/report.test.ts +0 -37
- package/tests/maintenance/update-isolated.test.ts +0 -39
- package/tests/maintenance/update.test.ts +0 -21
- package/tests/plugin-default-export-and-configs.test.ts +0 -50
- package/tests/plugin-setup.test.ts +0 -17
- package/tests/rules/require-branch-annotation.test.ts +0 -250
- package/tests/rules/require-req-annotation.test.ts +0 -38
- package/tests/rules/require-story-annotation.test.ts +0 -33
- package/tests/rules/valid-annotation-format.test.ts +0 -55
- package/tests/rules/valid-req-reference.test.ts +0 -85
- package/tests/rules/valid-story-reference.test.ts +0 -66
- package/tsconfig.json +0 -15
- package/user-docs/api-reference.md +0 -135
- package/user-docs/examples.md +0 -73
- package/user-docs/migration-guide.md +0 -71
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
# API Reference
|
|
2
|
-
|
|
3
|
-
Created autonomously by [voder.ai](https://voder.ai).
|
|
4
|
-
|
|
5
|
-
## Rules
|
|
6
|
-
|
|
7
|
-
Each rule enforces traceability conventions in your code. Below is a summary of each rule exposed by this plugin.
|
|
8
|
-
|
|
9
|
-
### traceability/require-story-annotation
|
|
10
|
-
|
|
11
|
-
Description: Ensures every function declaration has a JSDoc comment with an `@story` annotation referencing the related user story.
|
|
12
|
-
Options: None
|
|
13
|
-
Default Severity: `error`
|
|
14
|
-
Example:
|
|
15
|
-
|
|
16
|
-
```javascript
|
|
17
|
-
/**
|
|
18
|
-
* @story docs/stories/003.0-DEV-FUNCTION-ANNOTATIONS.story.md
|
|
19
|
-
* @req REQ-ANNOTATION-REQUIRED
|
|
20
|
-
*/
|
|
21
|
-
function initAuth() {
|
|
22
|
-
// authentication logic
|
|
23
|
-
}
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
### traceability/require-req-annotation
|
|
27
|
-
|
|
28
|
-
Description: Ensures every function declaration has an `@req` annotation in its JSDoc, linking to the specific requirement.
|
|
29
|
-
Options: None
|
|
30
|
-
Default Severity: `error`
|
|
31
|
-
Example:
|
|
32
|
-
|
|
33
|
-
```javascript
|
|
34
|
-
/**
|
|
35
|
-
* @story docs/stories/003.0-DEV-FUNCTION-ANNOTATIONS.story.md
|
|
36
|
-
* @req REQ-ANNOTATION-REQUIRED
|
|
37
|
-
*/
|
|
38
|
-
function initAuth() {
|
|
39
|
-
// authentication logic
|
|
40
|
-
}
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
### traceability/require-branch-annotation
|
|
44
|
-
|
|
45
|
-
Description: Ensures significant code branches (if/else, loops, switch cases, try/catch) have both `@story` and `@req` annotations in preceding comments.
|
|
46
|
-
Options: None
|
|
47
|
-
Default Severity: `error`
|
|
48
|
-
Example:
|
|
49
|
-
|
|
50
|
-
```javascript
|
|
51
|
-
// @story docs/stories/004.0-DEV-BRANCH-ANNOTATIONS.story.md
|
|
52
|
-
// @req REQ-BRANCH-DETECTION
|
|
53
|
-
if (error) {
|
|
54
|
-
handleError();
|
|
55
|
-
}
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
### traceability/valid-annotation-format
|
|
59
|
-
|
|
60
|
-
Description: Validates that all traceability annotations (`@story`, `@req`) follow the correct JSDoc or inline comment format.
|
|
61
|
-
Options: None
|
|
62
|
-
Default Severity: `error`
|
|
63
|
-
Example:
|
|
64
|
-
|
|
65
|
-
```javascript
|
|
66
|
-
/**
|
|
67
|
-
* @story docs/stories/005.0-DEV-VALIDATION.story.md
|
|
68
|
-
* @req REQ-FORMAT-VALIDATION
|
|
69
|
-
*/
|
|
70
|
-
function example() {
|
|
71
|
-
// ...
|
|
72
|
-
}
|
|
73
|
-
```
|
|
74
|
-
|
|
75
|
-
### traceability/valid-story-reference
|
|
76
|
-
|
|
77
|
-
Description: Checks that the file paths in `@story` annotations point to existing story markdown files.
|
|
78
|
-
Options: None
|
|
79
|
-
Default Severity: `error`
|
|
80
|
-
Example:
|
|
81
|
-
|
|
82
|
-
```javascript
|
|
83
|
-
/**
|
|
84
|
-
* @story docs/stories/006.0-DEV-STORY-EXISTS.story.md
|
|
85
|
-
* @req REQ-STORY-EXISTS
|
|
86
|
-
*/
|
|
87
|
-
function example() {
|
|
88
|
-
// ...
|
|
89
|
-
}
|
|
90
|
-
```
|
|
91
|
-
|
|
92
|
-
### traceability/valid-req-reference
|
|
93
|
-
|
|
94
|
-
Description: Verifies that the IDs used in `@req` annotations match known requirement identifiers.
|
|
95
|
-
Options: None
|
|
96
|
-
Default Severity: `error`
|
|
97
|
-
Example:
|
|
98
|
-
|
|
99
|
-
```javascript
|
|
100
|
-
/**
|
|
101
|
-
* @story docs/stories/007.0-DEV-REQ-REFERENCE.story.md
|
|
102
|
-
* @req REQ-VALID-REFERENCE
|
|
103
|
-
*/
|
|
104
|
-
function example() {
|
|
105
|
-
// ...
|
|
106
|
-
}
|
|
107
|
-
```
|
|
108
|
-
|
|
109
|
-
## Configuration Presets
|
|
110
|
-
|
|
111
|
-
The plugin provides two built-in presets for easy configuration:
|
|
112
|
-
|
|
113
|
-
### recommended
|
|
114
|
-
|
|
115
|
-
Enables the core traceability rules at the `error` level.
|
|
116
|
-
Usage:
|
|
117
|
-
|
|
118
|
-
```javascript
|
|
119
|
-
import js from "@eslint/js";
|
|
120
|
-
import traceability from "eslint-plugin-traceability";
|
|
121
|
-
|
|
122
|
-
export default [js.configs.recommended, traceability.configs.recommended];
|
|
123
|
-
```
|
|
124
|
-
|
|
125
|
-
### strict
|
|
126
|
-
|
|
127
|
-
Currently mirrors the **recommended** preset, reserved for future stricter policies.
|
|
128
|
-
Usage:
|
|
129
|
-
|
|
130
|
-
```javascript
|
|
131
|
-
import js from "@eslint/js";
|
|
132
|
-
import traceability from "eslint-plugin-traceability";
|
|
133
|
-
|
|
134
|
-
export default [js.configs.recommended, traceability.configs.strict];
|
|
135
|
-
```
|
package/user-docs/examples.md
DELETED
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
# Examples
|
|
2
|
-
|
|
3
|
-
Created autonomously by [voder.ai](https://voder.ai).
|
|
4
|
-
|
|
5
|
-
This document provides runnable examples demonstrating how to use the `eslint-plugin-traceability` plugin in real-world scenarios.
|
|
6
|
-
|
|
7
|
-
## 1. ESLint Flat Config with Recommended Preset
|
|
8
|
-
|
|
9
|
-
Create an ESLint config file (`eslint.config.js`) at your project root:
|
|
10
|
-
|
|
11
|
-
```javascript
|
|
12
|
-
// eslint.config.js
|
|
13
|
-
import js from "@eslint/js";
|
|
14
|
-
import traceability from "eslint-plugin-traceability";
|
|
15
|
-
|
|
16
|
-
export default [js.configs.recommended, traceability.configs.recommended];
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
Then run ESLint on your source files:
|
|
20
|
-
|
|
21
|
-
```bash
|
|
22
|
-
npx eslint "src/**/*.ts"
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
## 2. Using the Strict Preset
|
|
26
|
-
|
|
27
|
-
If you want to enforce all traceability rules (strict mode), update your config:
|
|
28
|
-
|
|
29
|
-
```javascript
|
|
30
|
-
// eslint.config.js
|
|
31
|
-
import js from "@eslint/js";
|
|
32
|
-
import traceability from "eslint-plugin-traceability";
|
|
33
|
-
|
|
34
|
-
export default [js.configs.recommended, traceability.configs.strict];
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
Run ESLint the same way:
|
|
38
|
-
|
|
39
|
-
```bash
|
|
40
|
-
npx eslint "src/**/*.js"
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
## 3. CLI Invocation Example
|
|
44
|
-
|
|
45
|
-
You can use the plugin without a config file by specifying rules inline:
|
|
46
|
-
|
|
47
|
-
```bash
|
|
48
|
-
npx eslint --no-eslintrc \
|
|
49
|
-
--rule "traceability/require-story-annotation:error" \
|
|
50
|
-
--rule "traceability/require-req-annotation:error" \
|
|
51
|
-
sample.js
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
- `--no-eslintrc` tells ESLint to ignore user configs.
|
|
55
|
-
- `--rule` options enable the traceability rules you need.
|
|
56
|
-
|
|
57
|
-
Replace `sample.js` with your JavaScript or TypeScript file.
|
|
58
|
-
|
|
59
|
-
## 4. Linting a Specific Directory
|
|
60
|
-
|
|
61
|
-
Add an npm script in your `package.json`:
|
|
62
|
-
|
|
63
|
-
```json
|
|
64
|
-
"scripts": {
|
|
65
|
-
"lint:trace": "eslint \"src/**/*.{js,ts}\" --config eslint.config.js"
|
|
66
|
-
}
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
Then run:
|
|
70
|
-
|
|
71
|
-
```bash
|
|
72
|
-
npm run lint:trace
|
|
73
|
-
```
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
# Migration Guide from v0.x to v1.x
|
|
2
|
-
|
|
3
|
-
Created autonomously by [voder.ai](https://voder.ai)
|
|
4
|
-
|
|
5
|
-
This guide helps you migrate from versions 0.x of `eslint-plugin-traceability` to 1.x.
|
|
6
|
-
|
|
7
|
-
## 1. Update Dependency
|
|
8
|
-
|
|
9
|
-
Update your development dependency to the latest 1.x release:
|
|
10
|
-
|
|
11
|
-
```bash
|
|
12
|
-
npm install --save-dev eslint-plugin-traceability@^1.0.0
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
Or with Yarn:
|
|
16
|
-
|
|
17
|
-
```bash
|
|
18
|
-
yarn add --dev eslint-plugin-traceability@^1.0.0
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
## 2. ESLint Configuration Changes
|
|
22
|
-
|
|
23
|
-
- 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.
|
|
24
|
-
- Update your ESLint config to load the plugin’s recommended settings:
|
|
25
|
-
|
|
26
|
-
```js
|
|
27
|
-
// eslint.config.js (ESLint v9 flat config)
|
|
28
|
-
import traceability from "eslint-plugin-traceability";
|
|
29
|
-
|
|
30
|
-
export default [traceability.configs.recommended];
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
## 3. New and Updated Rules
|
|
34
|
-
|
|
35
|
-
- `valid-story-reference` now enforces `.story.md` extensions strictly.
|
|
36
|
-
- `valid-req-reference` rejects path traversal (`../`) and absolute paths (`/etc/passwd`).
|
|
37
|
-
- `valid-annotation-format` enforces correct JSDoc traceability annotation syntax (`@story` and `@req` tags).
|
|
38
|
-
|
|
39
|
-
Review and update your existing annotations accordingly:
|
|
40
|
-
|
|
41
|
-
```diff
|
|
42
|
-
- /** @story docs/stories/001.0-DEV-PLUGIN-SETUP.md */
|
|
43
|
-
+ /** @story docs/stories/001.0-DEV-PLUGIN-SETUP.story.md */
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
## 4. CLI Integration Script
|
|
47
|
-
|
|
48
|
-
Version 1.x includes a new `cli-integration.js` script at the project root to run end-to-end CLI integration tests:
|
|
49
|
-
|
|
50
|
-
```bash
|
|
51
|
-
node ./cli-integration.js
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
## 5. Test and Validate
|
|
55
|
-
|
|
56
|
-
Run your test suite and the new CLI integration script to confirm everything passes:
|
|
57
|
-
|
|
58
|
-
```bash
|
|
59
|
-
npm test
|
|
60
|
-
npm run lint -- --max-warnings=0
|
|
61
|
-
npm run format:check
|
|
62
|
-
node ./cli-integration.js
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
## 6. Update Documentation
|
|
66
|
-
|
|
67
|
-
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.
|
|
68
|
-
|
|
69
|
-
---
|
|
70
|
-
|
|
71
|
-
If you encounter any issues during migration, please file an issue at https://github.com/voder-ai/eslint-plugin-traceability/issues.
|