eslint-plugin-traceability 1.0.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/.env.example +6 -0
- package/.github/workflows/ci-cd.yml +56 -0
- package/.husky/pre-commit +1 -0
- package/.husky/pre-push +1 -0
- package/.prettierignore +23 -0
- package/.prettierrc +4 -0
- package/.voder/history.md +164 -0
- package/.voder/implementation-progress.md +145 -0
- package/.voder/last-action.md +106 -0
- package/.voder/plan.md +15 -0
- package/.voder/progress-chart.png +0 -0
- package/.voder/progress-log-areas.csv +34 -0
- package/.voder/progress-log.csv +33 -0
- package/.voder/traceability/docs-stories-001.0-DEV-PLUGIN-SETUP.story.xml +17 -0
- package/.voder/traceability/docs-stories-002.0-DEV-ESLINT-CONFIG.story.xml +13 -0
- package/.voder/traceability/docs-stories-003.0-DEV-FUNCTION-ANNOTATIONS.story.xml +9 -0
- package/.voder/traceability/docs-stories-004.0-DEV-BRANCH-ANNOTATIONS.story.xml +9 -0
- package/.voder/traceability/docs-stories-005.0-DEV-ANNOTATION-VALIDATION.story.xml +9 -0
- package/.voder/traceability/docs-stories-006.0-DEV-FILE-VALIDATION.story.xml +9 -0
- package/.voder/traceability/docs-stories-007.0-DEV-ERROR-REPORTING.story.xml +9 -0
- package/.voder/traceability/docs-stories-008.0-DEV-AUTO-FIX.story.xml +9 -0
- package/.voder/traceability/docs-stories-009.0-DEV-MAINTENANCE-TOOLS.story.xml +16 -0
- package/.voder/traceability/docs-stories-010.0-DEV-DEEP-VALIDATION.story.xml +11 -0
- package/CHANGELOG.md +31 -0
- package/CONTRIBUTING.md +97 -0
- package/LICENSE +21 -0
- package/README.md +159 -0
- package/cli-integration.js +157 -0
- package/docs/cli-integration.md +103 -0
- package/docs/config-presets.md +38 -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/eslint-9-setup-guide.md +517 -0
- package/docs/eslint-plugin-development-guide.md +483 -0
- package/docs/jest-testing-guide.md +100 -0
- package/docs/rules/require-branch-annotation.md +34 -0
- package/docs/rules/require-req-annotation.md +39 -0
- package/docs/rules/require-story-annotation.md +36 -0
- package/docs/rules/valid-annotation-format.md +52 -0
- package/docs/rules/valid-req-reference.md +58 -0
- package/docs/rules/valid-story-reference.md +47 -0
- package/docs/security-incidents/unresolved-vulnerabilities.md +11 -0
- package/docs/stories/001.0-DEV-PLUGIN-SETUP.story.md +82 -0
- package/docs/stories/002.0-DEV-ESLINT-CONFIG.story.md +82 -0
- package/docs/stories/003.0-DEV-FUNCTION-ANNOTATIONS.story.md +85 -0
- package/docs/stories/004.0-DEV-BRANCH-ANNOTATIONS.story.md +107 -0
- package/docs/stories/005.0-DEV-ANNOTATION-VALIDATION.story.md +119 -0
- package/docs/stories/006.0-DEV-FILE-VALIDATION.story.md +127 -0
- package/docs/stories/007.0-DEV-ERROR-REPORTING.story.md +89 -0
- package/docs/stories/008.0-DEV-AUTO-FIX.story.md +104 -0
- package/docs/stories/009.0-DEV-MAINTENANCE-TOOLS.story.md +104 -0
- package/docs/stories/010.0-DEV-DEEP-VALIDATION.story.md +110 -0
- package/docs/stories/developer-story.map.md +118 -0
- package/eslint.config.js +146 -0
- package/jest.config.js +21 -0
- package/lib/index.d.ts +26 -0
- package/lib/index.js +11 -0
- package/lib/src/index.d.ts +80 -0
- package/lib/src/index.js +58 -0
- package/lib/src/maintenance/batch.d.ts +16 -0
- package/lib/src/maintenance/batch.js +28 -0
- package/lib/src/maintenance/detect.d.ts +6 -0
- package/lib/src/maintenance/detect.js +69 -0
- package/lib/src/maintenance/index.d.ts +14 -0
- package/lib/src/maintenance/index.js +22 -0
- package/lib/src/maintenance/report.d.ts +7 -0
- package/lib/src/maintenance/report.js +17 -0
- package/lib/src/maintenance/update.d.ts +6 -0
- package/lib/src/maintenance/update.js +67 -0
- package/lib/src/maintenance/utils.d.ts +6 -0
- package/lib/src/maintenance/utils.js +64 -0
- package/lib/src/rules/require-branch-annotation.d.ts +7 -0
- package/lib/src/rules/require-branch-annotation.js +111 -0
- package/lib/src/rules/require-req-annotation.d.ts +7 -0
- package/lib/src/rules/require-req-annotation.js +38 -0
- package/lib/src/rules/require-story-annotation.d.ts +7 -0
- package/lib/src/rules/require-story-annotation.js +50 -0
- package/lib/src/rules/valid-annotation-format.d.ts +10 -0
- package/lib/src/rules/valid-annotation-format.js +60 -0
- package/lib/src/rules/valid-req-reference.d.ts +3 -0
- package/lib/src/rules/valid-req-reference.js +104 -0
- package/lib/src/rules/valid-story-reference.d.ts +3 -0
- package/lib/src/rules/valid-story-reference.js +168 -0
- package/lib/tests/basic.test.d.ts +1 -0
- package/lib/tests/basic.test.js +51 -0
- package/lib/tests/fixtures/stale/example.d.ts +0 -0
- package/lib/tests/fixtures/stale/example.js +3 -0
- package/lib/tests/fixtures/update/example.d.ts +0 -0
- package/lib/tests/fixtures/update/example.js +3 -0
- package/lib/tests/fixtures/valid-annotations/example.d.ts +0 -0
- package/lib/tests/fixtures/valid-annotations/example.js +3 -0
- package/lib/tests/index.test.d.ts +1 -0
- package/lib/tests/index.test.js +68 -0
- package/lib/tests/integration/file-validation.test.d.ts +1 -0
- package/lib/tests/integration/file-validation.test.js +60 -0
- package/lib/tests/integration/plugin-validation.test.d.ts +1 -0
- package/lib/tests/integration/plugin-validation.test.js +77 -0
- package/lib/tests/maintenance/batch.test.d.ts +1 -0
- package/lib/tests/maintenance/batch.test.js +79 -0
- package/lib/tests/maintenance/detect-isolated.test.d.ts +1 -0
- package/lib/tests/maintenance/detect-isolated.test.js +90 -0
- package/lib/tests/maintenance/detect.test.d.ts +1 -0
- package/lib/tests/maintenance/detect.test.js +23 -0
- package/lib/tests/maintenance/report.test.d.ts +1 -0
- package/lib/tests/maintenance/report.test.js +67 -0
- package/lib/tests/maintenance/update-isolated.test.d.ts +1 -0
- package/lib/tests/maintenance/update-isolated.test.js +66 -0
- package/lib/tests/maintenance/update.test.d.ts +1 -0
- package/lib/tests/maintenance/update.test.js +26 -0
- package/lib/tests/rules/require-branch-annotation.test.d.ts +1 -0
- package/lib/tests/rules/require-branch-annotation.test.js +251 -0
- package/lib/tests/rules/require-req-annotation.test.d.ts +1 -0
- package/lib/tests/rules/require-req-annotation.test.js +41 -0
- package/lib/tests/rules/require-story-annotation.test.d.ts +1 -0
- package/lib/tests/rules/require-story-annotation.test.js +35 -0
- package/lib/tests/rules/valid-annotation-format.test.d.ts +1 -0
- package/lib/tests/rules/valid-annotation-format.test.js +58 -0
- package/lib/tests/rules/valid-req-reference.test.d.ts +1 -0
- package/lib/tests/rules/valid-req-reference.test.js +87 -0
- package/lib/tests/rules/valid-story-reference.test.d.ts +1 -0
- package/lib/tests/rules/valid-story-reference.test.js +69 -0
- package/package.json +67 -0
- package/src/index.ts +56 -0
- package/src/maintenance/batch.ts +29 -0
- package/src/maintenance/detect.ts +42 -0
- package/src/maintenance/index.ts +14 -0
- package/src/maintenance/report.ts +15 -0
- package/src/maintenance/update.ts +40 -0
- package/src/maintenance/utils.ts +28 -0
- package/src/rules/require-branch-annotation.ts +114 -0
- package/src/rules/require-req-annotation.ts +36 -0
- package/src/rules/require-story-annotation.ts +52 -0
- package/src/rules/valid-annotation-format.ts +62 -0
- package/src/rules/valid-req-reference.ts +114 -0
- package/src/rules/valid-story-reference.ts +213 -0
- package/tests/basic.test.ts +17 -0
- package/tests/fixtures/stale/example.ts +2 -0
- package/tests/fixtures/story_bullet.md +6 -0
- package/tests/fixtures/update/example.ts +2 -0
- package/tests/fixtures/valid-annotations/example.ts +2 -0
- package/tests/index.test.ts +46 -0
- package/tests/integration/file-validation.test.ts +67 -0
- package/tests/integration/plugin-validation.test.ts +79 -0
- package/tests/maintenance/batch.test.ts +55 -0
- package/tests/maintenance/detect-isolated.test.ts +61 -0
- package/tests/maintenance/detect.test.ts +19 -0
- package/tests/maintenance/report.test.ts +37 -0
- package/tests/maintenance/update-isolated.test.ts +39 -0
- package/tests/maintenance/update.test.ts +21 -0
- package/tests/rules/require-branch-annotation.test.ts +248 -0
- package/tests/rules/require-req-annotation.test.ts +38 -0
- package/tests/rules/require-story-annotation.test.ts +32 -0
- package/tests/rules/valid-annotation-format.test.ts +55 -0
- package/tests/rules/valid-req-reference.test.ts +85 -0
- package/tests/rules/valid-story-reference.test.ts +66 -0
- package/tsconfig.json +15 -0
- package/user-docs/api-reference.md +135 -0
- package/user-docs/examples.md +73 -0
|
@@ -0,0 +1,73 @@
|
|
|
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
|
+
```
|