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.
Files changed (159) hide show
  1. package/.env.example +6 -0
  2. package/.github/workflows/ci-cd.yml +56 -0
  3. package/.husky/pre-commit +1 -0
  4. package/.husky/pre-push +1 -0
  5. package/.prettierignore +23 -0
  6. package/.prettierrc +4 -0
  7. package/.voder/history.md +164 -0
  8. package/.voder/implementation-progress.md +145 -0
  9. package/.voder/last-action.md +106 -0
  10. package/.voder/plan.md +15 -0
  11. package/.voder/progress-chart.png +0 -0
  12. package/.voder/progress-log-areas.csv +34 -0
  13. package/.voder/progress-log.csv +33 -0
  14. package/.voder/traceability/docs-stories-001.0-DEV-PLUGIN-SETUP.story.xml +17 -0
  15. package/.voder/traceability/docs-stories-002.0-DEV-ESLINT-CONFIG.story.xml +13 -0
  16. package/.voder/traceability/docs-stories-003.0-DEV-FUNCTION-ANNOTATIONS.story.xml +9 -0
  17. package/.voder/traceability/docs-stories-004.0-DEV-BRANCH-ANNOTATIONS.story.xml +9 -0
  18. package/.voder/traceability/docs-stories-005.0-DEV-ANNOTATION-VALIDATION.story.xml +9 -0
  19. package/.voder/traceability/docs-stories-006.0-DEV-FILE-VALIDATION.story.xml +9 -0
  20. package/.voder/traceability/docs-stories-007.0-DEV-ERROR-REPORTING.story.xml +9 -0
  21. package/.voder/traceability/docs-stories-008.0-DEV-AUTO-FIX.story.xml +9 -0
  22. package/.voder/traceability/docs-stories-009.0-DEV-MAINTENANCE-TOOLS.story.xml +16 -0
  23. package/.voder/traceability/docs-stories-010.0-DEV-DEEP-VALIDATION.story.xml +11 -0
  24. package/CHANGELOG.md +31 -0
  25. package/CONTRIBUTING.md +97 -0
  26. package/LICENSE +21 -0
  27. package/README.md +159 -0
  28. package/cli-integration.js +157 -0
  29. package/docs/cli-integration.md +103 -0
  30. package/docs/config-presets.md +38 -0
  31. package/docs/decisions/001-typescript-for-eslint-plugin.accepted.md +111 -0
  32. package/docs/decisions/002-jest-for-eslint-testing.accepted.md +137 -0
  33. package/docs/decisions/003-code-quality-ratcheting-plan.md +48 -0
  34. package/docs/eslint-9-setup-guide.md +517 -0
  35. package/docs/eslint-plugin-development-guide.md +483 -0
  36. package/docs/jest-testing-guide.md +100 -0
  37. package/docs/rules/require-branch-annotation.md +34 -0
  38. package/docs/rules/require-req-annotation.md +39 -0
  39. package/docs/rules/require-story-annotation.md +36 -0
  40. package/docs/rules/valid-annotation-format.md +52 -0
  41. package/docs/rules/valid-req-reference.md +58 -0
  42. package/docs/rules/valid-story-reference.md +47 -0
  43. package/docs/security-incidents/unresolved-vulnerabilities.md +11 -0
  44. package/docs/stories/001.0-DEV-PLUGIN-SETUP.story.md +82 -0
  45. package/docs/stories/002.0-DEV-ESLINT-CONFIG.story.md +82 -0
  46. package/docs/stories/003.0-DEV-FUNCTION-ANNOTATIONS.story.md +85 -0
  47. package/docs/stories/004.0-DEV-BRANCH-ANNOTATIONS.story.md +107 -0
  48. package/docs/stories/005.0-DEV-ANNOTATION-VALIDATION.story.md +119 -0
  49. package/docs/stories/006.0-DEV-FILE-VALIDATION.story.md +127 -0
  50. package/docs/stories/007.0-DEV-ERROR-REPORTING.story.md +89 -0
  51. package/docs/stories/008.0-DEV-AUTO-FIX.story.md +104 -0
  52. package/docs/stories/009.0-DEV-MAINTENANCE-TOOLS.story.md +104 -0
  53. package/docs/stories/010.0-DEV-DEEP-VALIDATION.story.md +110 -0
  54. package/docs/stories/developer-story.map.md +118 -0
  55. package/eslint.config.js +146 -0
  56. package/jest.config.js +21 -0
  57. package/lib/index.d.ts +26 -0
  58. package/lib/index.js +11 -0
  59. package/lib/src/index.d.ts +80 -0
  60. package/lib/src/index.js +58 -0
  61. package/lib/src/maintenance/batch.d.ts +16 -0
  62. package/lib/src/maintenance/batch.js +28 -0
  63. package/lib/src/maintenance/detect.d.ts +6 -0
  64. package/lib/src/maintenance/detect.js +69 -0
  65. package/lib/src/maintenance/index.d.ts +14 -0
  66. package/lib/src/maintenance/index.js +22 -0
  67. package/lib/src/maintenance/report.d.ts +7 -0
  68. package/lib/src/maintenance/report.js +17 -0
  69. package/lib/src/maintenance/update.d.ts +6 -0
  70. package/lib/src/maintenance/update.js +67 -0
  71. package/lib/src/maintenance/utils.d.ts +6 -0
  72. package/lib/src/maintenance/utils.js +64 -0
  73. package/lib/src/rules/require-branch-annotation.d.ts +7 -0
  74. package/lib/src/rules/require-branch-annotation.js +111 -0
  75. package/lib/src/rules/require-req-annotation.d.ts +7 -0
  76. package/lib/src/rules/require-req-annotation.js +38 -0
  77. package/lib/src/rules/require-story-annotation.d.ts +7 -0
  78. package/lib/src/rules/require-story-annotation.js +50 -0
  79. package/lib/src/rules/valid-annotation-format.d.ts +10 -0
  80. package/lib/src/rules/valid-annotation-format.js +60 -0
  81. package/lib/src/rules/valid-req-reference.d.ts +3 -0
  82. package/lib/src/rules/valid-req-reference.js +104 -0
  83. package/lib/src/rules/valid-story-reference.d.ts +3 -0
  84. package/lib/src/rules/valid-story-reference.js +168 -0
  85. package/lib/tests/basic.test.d.ts +1 -0
  86. package/lib/tests/basic.test.js +51 -0
  87. package/lib/tests/fixtures/stale/example.d.ts +0 -0
  88. package/lib/tests/fixtures/stale/example.js +3 -0
  89. package/lib/tests/fixtures/update/example.d.ts +0 -0
  90. package/lib/tests/fixtures/update/example.js +3 -0
  91. package/lib/tests/fixtures/valid-annotations/example.d.ts +0 -0
  92. package/lib/tests/fixtures/valid-annotations/example.js +3 -0
  93. package/lib/tests/index.test.d.ts +1 -0
  94. package/lib/tests/index.test.js +68 -0
  95. package/lib/tests/integration/file-validation.test.d.ts +1 -0
  96. package/lib/tests/integration/file-validation.test.js +60 -0
  97. package/lib/tests/integration/plugin-validation.test.d.ts +1 -0
  98. package/lib/tests/integration/plugin-validation.test.js +77 -0
  99. package/lib/tests/maintenance/batch.test.d.ts +1 -0
  100. package/lib/tests/maintenance/batch.test.js +79 -0
  101. package/lib/tests/maintenance/detect-isolated.test.d.ts +1 -0
  102. package/lib/tests/maintenance/detect-isolated.test.js +90 -0
  103. package/lib/tests/maintenance/detect.test.d.ts +1 -0
  104. package/lib/tests/maintenance/detect.test.js +23 -0
  105. package/lib/tests/maintenance/report.test.d.ts +1 -0
  106. package/lib/tests/maintenance/report.test.js +67 -0
  107. package/lib/tests/maintenance/update-isolated.test.d.ts +1 -0
  108. package/lib/tests/maintenance/update-isolated.test.js +66 -0
  109. package/lib/tests/maintenance/update.test.d.ts +1 -0
  110. package/lib/tests/maintenance/update.test.js +26 -0
  111. package/lib/tests/rules/require-branch-annotation.test.d.ts +1 -0
  112. package/lib/tests/rules/require-branch-annotation.test.js +251 -0
  113. package/lib/tests/rules/require-req-annotation.test.d.ts +1 -0
  114. package/lib/tests/rules/require-req-annotation.test.js +41 -0
  115. package/lib/tests/rules/require-story-annotation.test.d.ts +1 -0
  116. package/lib/tests/rules/require-story-annotation.test.js +35 -0
  117. package/lib/tests/rules/valid-annotation-format.test.d.ts +1 -0
  118. package/lib/tests/rules/valid-annotation-format.test.js +58 -0
  119. package/lib/tests/rules/valid-req-reference.test.d.ts +1 -0
  120. package/lib/tests/rules/valid-req-reference.test.js +87 -0
  121. package/lib/tests/rules/valid-story-reference.test.d.ts +1 -0
  122. package/lib/tests/rules/valid-story-reference.test.js +69 -0
  123. package/package.json +67 -0
  124. package/src/index.ts +56 -0
  125. package/src/maintenance/batch.ts +29 -0
  126. package/src/maintenance/detect.ts +42 -0
  127. package/src/maintenance/index.ts +14 -0
  128. package/src/maintenance/report.ts +15 -0
  129. package/src/maintenance/update.ts +40 -0
  130. package/src/maintenance/utils.ts +28 -0
  131. package/src/rules/require-branch-annotation.ts +114 -0
  132. package/src/rules/require-req-annotation.ts +36 -0
  133. package/src/rules/require-story-annotation.ts +52 -0
  134. package/src/rules/valid-annotation-format.ts +62 -0
  135. package/src/rules/valid-req-reference.ts +114 -0
  136. package/src/rules/valid-story-reference.ts +213 -0
  137. package/tests/basic.test.ts +17 -0
  138. package/tests/fixtures/stale/example.ts +2 -0
  139. package/tests/fixtures/story_bullet.md +6 -0
  140. package/tests/fixtures/update/example.ts +2 -0
  141. package/tests/fixtures/valid-annotations/example.ts +2 -0
  142. package/tests/index.test.ts +46 -0
  143. package/tests/integration/file-validation.test.ts +67 -0
  144. package/tests/integration/plugin-validation.test.ts +79 -0
  145. package/tests/maintenance/batch.test.ts +55 -0
  146. package/tests/maintenance/detect-isolated.test.ts +61 -0
  147. package/tests/maintenance/detect.test.ts +19 -0
  148. package/tests/maintenance/report.test.ts +37 -0
  149. package/tests/maintenance/update-isolated.test.ts +39 -0
  150. package/tests/maintenance/update.test.ts +21 -0
  151. package/tests/rules/require-branch-annotation.test.ts +248 -0
  152. package/tests/rules/require-req-annotation.test.ts +38 -0
  153. package/tests/rules/require-story-annotation.test.ts +32 -0
  154. package/tests/rules/valid-annotation-format.test.ts +55 -0
  155. package/tests/rules/valid-req-reference.test.ts +85 -0
  156. package/tests/rules/valid-story-reference.test.ts +66 -0
  157. package/tsconfig.json +15 -0
  158. package/user-docs/api-reference.md +135 -0
  159. 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
+ ```