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.
Files changed (96) hide show
  1. package/package.json +6 -1
  2. package/.env.example +0 -6
  3. package/.github/workflows/ci-cd.yml +0 -110
  4. package/.husky/pre-commit +0 -1
  5. package/.husky/pre-push +0 -1
  6. package/.prettierignore +0 -27
  7. package/.prettierrc +0 -4
  8. package/.releaserc.json +0 -20
  9. package/.voder/history.md +0 -162
  10. package/.voder/implementation-progress.md +0 -144
  11. package/.voder/last-action.md +0 -83
  12. package/.voder/plan.md +0 -12
  13. package/.voder/progress-chart.png +0 -0
  14. package/.voder/progress-log-areas.csv +0 -39
  15. package/.voder/progress-log.csv +0 -38
  16. package/.voder/traceability/docs-stories-001.0-DEV-PLUGIN-SETUP.story.xml +0 -17
  17. package/.voder/traceability/docs-stories-002.0-DEV-ESLINT-CONFIG.story.xml +0 -13
  18. package/.voder/traceability/docs-stories-003.0-DEV-FUNCTION-ANNOTATIONS.story.xml +0 -9
  19. package/.voder/traceability/docs-stories-004.0-DEV-BRANCH-ANNOTATIONS.story.xml +0 -9
  20. package/.voder/traceability/docs-stories-005.0-DEV-ANNOTATION-VALIDATION.story.xml +0 -9
  21. package/.voder/traceability/docs-stories-006.0-DEV-FILE-VALIDATION.story.xml +0 -9
  22. package/.voder/traceability/docs-stories-007.0-DEV-ERROR-REPORTING.story.xml +0 -9
  23. package/.voder/traceability/docs-stories-008.0-DEV-AUTO-FIX.story.xml +0 -9
  24. package/.voder/traceability/docs-stories-009.0-DEV-MAINTENANCE-TOOLS.story.xml +0 -16
  25. package/.voder/traceability/docs-stories-010.0-DEV-DEEP-VALIDATION.story.xml +0 -11
  26. package/CHANGELOG.md +0 -58
  27. package/CONTRIBUTING.md +0 -99
  28. package/cli-integration.js +0 -103
  29. package/docs/cli-integration.md +0 -105
  30. package/docs/config-presets.md +0 -38
  31. package/docs/conventional-commits-guide.md +0 -185
  32. package/docs/decisions/001-typescript-for-eslint-plugin.accepted.md +0 -111
  33. package/docs/decisions/002-jest-for-eslint-testing.accepted.md +0 -137
  34. package/docs/decisions/003-code-quality-ratcheting-plan.md +0 -48
  35. package/docs/decisions/004-automated-version-bumping-for-ci-cd.md +0 -196
  36. package/docs/decisions/005-github-actions-validation-tooling.accepted.md +0 -144
  37. package/docs/decisions/006-semantic-release-for-automated-publishing.accepted.md +0 -227
  38. package/docs/eslint-9-setup-guide.md +0 -517
  39. package/docs/eslint-plugin-development-guide.md +0 -483
  40. package/docs/jest-testing-guide.md +0 -100
  41. package/docs/rules/require-branch-annotation.md +0 -34
  42. package/docs/rules/require-req-annotation.md +0 -39
  43. package/docs/rules/require-story-annotation.md +0 -36
  44. package/docs/rules/valid-annotation-format.md +0 -52
  45. package/docs/rules/valid-req-reference.md +0 -58
  46. package/docs/rules/valid-story-reference.md +0 -47
  47. package/docs/security-incidents/unresolved-vulnerabilities.md +0 -11
  48. package/docs/stories/001.0-DEV-PLUGIN-SETUP.story.md +0 -82
  49. package/docs/stories/002.0-DEV-ESLINT-CONFIG.story.md +0 -82
  50. package/docs/stories/003.0-DEV-FUNCTION-ANNOTATIONS.story.md +0 -85
  51. package/docs/stories/004.0-DEV-BRANCH-ANNOTATIONS.story.md +0 -107
  52. package/docs/stories/005.0-DEV-ANNOTATION-VALIDATION.story.md +0 -119
  53. package/docs/stories/006.0-DEV-FILE-VALIDATION.story.md +0 -127
  54. package/docs/stories/007.0-DEV-ERROR-REPORTING.story.md +0 -89
  55. package/docs/stories/008.0-DEV-AUTO-FIX.story.md +0 -104
  56. package/docs/stories/009.0-DEV-MAINTENANCE-TOOLS.story.md +0 -104
  57. package/docs/stories/010.0-DEV-DEEP-VALIDATION.story.md +0 -110
  58. package/docs/stories/developer-story.map.md +0 -118
  59. package/eslint.config.js +0 -146
  60. package/jest.config.js +0 -21
  61. package/scripts/smoke-test.sh +0 -51
  62. package/src/index.ts +0 -56
  63. package/src/maintenance/batch.ts +0 -29
  64. package/src/maintenance/detect.ts +0 -42
  65. package/src/maintenance/index.ts +0 -14
  66. package/src/maintenance/report.ts +0 -15
  67. package/src/maintenance/update.ts +0 -40
  68. package/src/maintenance/utils.ts +0 -28
  69. package/src/rules/require-branch-annotation.ts +0 -114
  70. package/src/rules/require-req-annotation.ts +0 -36
  71. package/src/rules/require-story-annotation.ts +0 -52
  72. package/src/rules/valid-annotation-format.ts +0 -62
  73. package/src/rules/valid-req-reference.ts +0 -114
  74. package/src/rules/valid-story-reference.ts +0 -213
  75. package/tests/fixtures/stale/example.ts +0 -2
  76. package/tests/fixtures/story_bullet.md +0 -6
  77. package/tests/fixtures/update/example.ts +0 -2
  78. package/tests/fixtures/valid-annotations/example.ts +0 -2
  79. package/tests/maintenance/batch.test.ts +0 -55
  80. package/tests/maintenance/detect-isolated.test.ts +0 -65
  81. package/tests/maintenance/detect.test.ts +0 -19
  82. package/tests/maintenance/report.test.ts +0 -37
  83. package/tests/maintenance/update-isolated.test.ts +0 -39
  84. package/tests/maintenance/update.test.ts +0 -21
  85. package/tests/plugin-default-export-and-configs.test.ts +0 -50
  86. package/tests/plugin-setup.test.ts +0 -17
  87. package/tests/rules/require-branch-annotation.test.ts +0 -250
  88. package/tests/rules/require-req-annotation.test.ts +0 -38
  89. package/tests/rules/require-story-annotation.test.ts +0 -33
  90. package/tests/rules/valid-annotation-format.test.ts +0 -55
  91. package/tests/rules/valid-req-reference.test.ts +0 -85
  92. package/tests/rules/valid-story-reference.test.ts +0 -66
  93. package/tsconfig.json +0 -15
  94. package/user-docs/api-reference.md +0 -135
  95. package/user-docs/examples.md +0 -73
  96. package/user-docs/migration-guide.md +0 -71
@@ -1,52 +0,0 @@
1
- # valid-annotation-format
2
-
3
- Validates that `@story` and `@req` annotations follow the correct format and syntax rules to ensure traceability annotations are parseable and standardized.
4
-
5
- @story docs/stories/005.0-DEV-ANNOTATION-VALIDATION.story.md
6
- @req REQ-FORMAT-SPECIFICATION - Define clear format rules for @story and @req annotations
7
- @req REQ-SYNTAX-VALIDATION - Validate annotation syntax matches specification
8
- @req REQ-PATH-FORMAT - Validate @story paths follow expected patterns
9
- @req REQ-REQ-FORMAT - Validate @req identifiers follow expected patterns
10
-
11
- ## Rule Details
12
-
13
- This rule scans all comments in the source code and checks each line that begins with `@story` or `@req`. It applies regular expressions to verify:
14
-
15
- - `@story` paths match the pattern `docs/stories/NN.N-DEV-<NAME>.story.md`
16
- - `@req` identifiers match the pattern `REQ-<UPPERCASE|NUMERIC|DASH>`
17
-
18
- Violations report specific messages for invalid story formats or invalid requirement ID formats.
19
-
20
- ## Examples
21
-
22
- #### Correct
23
-
24
- ```js
25
- /**
26
- * @story docs/stories/005.0-DEV-ANNOTATION-VALIDATION.story.md
27
- * @req REQ-FORMAT-SPECIFICATION
28
- */
29
- function example() {}
30
-
31
- // @story docs/stories/005.0-DEV-ANNOTATION-VALIDATION.story.md
32
- // @req REQ-SYNTAX-VALIDATION
33
- if (condition) {
34
- /* ... */
35
- }
36
- ```
37
-
38
- #### Incorrect
39
-
40
- ```js
41
- // @story invalid-path
42
- // @req REQ-1234
43
-
44
- // @story docs/stories/005.0-DEV-ANNOTATION-VALIDATION.story
45
- // @req invalid-req-id
46
-
47
- /**
48
- * @story
49
- * @req REQ-EXAMPLE
50
- */
51
- function badExample() {}
52
- ```
@@ -1,58 +0,0 @@
1
- # valid-req-reference
2
-
3
- Enforces that `@req` annotations reference existing requirements in story files and protects against invalid paths.
4
-
5
- @story docs/stories/010.0-DEV-DEEP-VALIDATION.story.md
6
- @req REQ-DEEP-PARSE - Parse story files to extract requirement identifiers
7
- @req REQ-DEEP-MATCH - Validate `@req` references against story file content
8
- @req REQ-DEEP-PATH - Protect against path traversal in story paths
9
-
10
- ## Rule Details
11
-
12
- This rule performs deep validation of `@req` annotations by:
13
-
14
- - Verifying the referenced story file exists and is within the project directory
15
- - Parsing the story file to extract requirement IDs (e.g., `REQ-XXX-YYY`)
16
- - Ensuring each `@req` annotation matches an extracted requirement ID
17
- - Reporting an `invalidPath` error for paths containing `..` or absolute paths
18
- - Reporting a `reqMissing` error when the requirement ID is not found in the story file
19
-
20
- ### Options
21
-
22
- This rule does not accept any options (schema is `[]`).
23
-
24
- ## Examples
25
-
26
- ### Correct
27
-
28
- ```js
29
- // @story docs/stories/001.0-DEV-PLUGIN-SETUP.story.md
30
- // @req REQ-PLUGIN-STRUCTURE
31
- function initPlugin() {}
32
- ```
33
-
34
- ### Incorrect: Missing Requirement
35
-
36
- ```js
37
- // @story docs/stories/001.0-DEV-PLUGIN-SETUP.story.md
38
- // @req REQ-NON-EXISTENT
39
- function initPlugin() {}
40
- ```
41
-
42
- ### Incorrect: Path Traversal
43
-
44
- ```js
45
- // @story ../docs/stories/001.0-DEV-PLUGIN-SETUP.story.md
46
- // @req REQ-PLUGIN-STRUCTURE
47
- function initPlugin() {}
48
- ```
49
-
50
- ### Incorrect: Absolute Path
51
-
52
- ```js
53
- // @story /absolute/path/docs/stories/001.0-DEV-PLUGIN-SETUP.story.md
54
- // @req REQ-PLUGIN-STRUCTURE
55
- function initPlugin() {}
56
- ```
57
-
58
- For more details, see the story: docs/stories/010.0-DEV-DEEP-VALIDATION.story.md
@@ -1,47 +0,0 @@
1
- # valid-story-reference
2
-
3
- Validates that `@story` annotation references refer to existing `.story.md` files within the project and prevents invalid path usage.
4
-
5
- @story docs/stories/006.0-DEV-FILE-VALIDATION.story.md
6
- @req REQ-FILE-EXISTENCE - Verify that `@story` file paths reference existing files
7
- @req REQ-PATH-RESOLUTION - Resolve relative paths correctly and enforce configuration
8
- @req REQ-SECURITY-VALIDATION - Prevent path traversal and absolute path usage
9
-
10
- ## Rule Details
11
-
12
- This rule inspects all comment nodes for lines starting with `@story`. It then:
13
-
14
- - Prevents absolute paths unless explicitly allowed
15
- - Prevents path traversal outside the project directory
16
- - Ensures `.story.md` extension when required
17
- - Resolves candidate file locations in configured story directories
18
- - Reports a `fileMissing`, `invalidExtension`, or `invalidPath` error for violations
19
-
20
- ### Options
21
-
22
- Configure rule behavior using an options object:
23
-
24
- ```json
25
- {
26
- "storyDirectories": ["docs/stories", "stories"],
27
- "allowAbsolutePaths": false,
28
- "requireStoryExtension": true
29
- }
30
- ```
31
-
32
- ### Examples
33
-
34
- #### Correct
35
-
36
- ```js
37
- // @story docs/stories/001.0-DEV-PLUGIN-SETUP.story.md
38
- ```
39
-
40
- #### Incorrect
41
-
42
- ```js
43
- // @story docs/stories/nonexistent.story.md // @story fileMissing
44
- // @story docs/stories/001.0-DEV-PLUGIN-SETUP.md // @story invalidExtension
45
- // @story ../outside.story.md // @story invalidPath
46
- // @story /etc/passwd.story.md // @story invalidPath
47
- ```
@@ -1,11 +0,0 @@
1
- # Unresolved Vulnerabilities
2
-
3
- As of 2025-11-16, all moderate and higher severity vulnerabilities have been resolved in the project’s dependencies.
4
-
5
- ## Resolution Details
6
-
7
- - **js-yaml (GHSA-mh29-5h37-fv8m)**: Prototype pollution vulnerability resolved by upgrading to `js-yaml` >= 4.1.1 via `npm audit fix` and package.json override.
8
-
9
- ## Outstanding Issues
10
-
11
- _None._
@@ -1,82 +0,0 @@
1
- # 001.0-DEV-PLUGIN-SETUP: ESLint Plugin Structure Foundation
2
-
3
- ## Release Goal
4
-
5
- _Release 0.1: Core Validation - Provide essential ESLint rules that enforce @story and @req annotations on functions and code branches_
6
-
7
- This story establishes the foundational structure for the ESLint plugin that will enforce code traceability annotations. It creates the basic plugin architecture that enables all subsequent validation rules and features in Release 0.1.
8
-
9
- ## How This Story Contributes
10
-
11
- This story is critical as the foundation for the entire traceability enforcement system. Without a properly structured ESLint plugin, no validation rules can be implemented. It enables all other stories in Release 0.1 by providing the plugin architecture, rule registration system, and basic infrastructure that subsequent stories will build upon.
12
-
13
- ## User Story
14
-
15
- **Format**: So that I can enforce code traceability standards across my project, as a Developer, I want an ESLint plugin structure that can validate @story and @req annotations on functions and code branches.
16
-
17
- **INVEST Criteria Compliance**:
18
-
19
- - **Independent**: Can be developed independently - no dependencies on other stories
20
- - **Negotiable**: Plugin structure details can be refined during implementation
21
- - **Valuable**: Delivers the foundation needed for all traceability enforcement
22
- - **Estimable**: Scope is clear - standard ESLint plugin structure
23
- - **Small**: Can be completed within a single iteration/sprint
24
- - **Testable**: Plugin can be tested for proper registration and basic functionality
25
-
26
- ## Acceptance Criteria
27
-
28
- Use checkbox format for clear completion tracking:
29
-
30
- - [ ] **Core Functionality**: ESLint plugin properly registers and loads without errors
31
- - [ ] **Quality Standards**: Follows ESLint plugin development best practices and conventions
32
- - [ ] **Integration**: Works properly with ESLint v9 flat config
33
- - [ ] **User Experience**: Plugin can be installed and configured with clear setup instructions
34
- - [ ] **Error Handling**: Gracefully handles plugin loading errors and missing dependencies
35
- - [ ] **Documentation**: Plugin structure and development setup is properly documented
36
-
37
- ## Requirements (Current Implementation or To Be Implemented)
38
-
39
- Document specific technical requirements using the format:
40
-
41
- - **REQ-PLUGIN-STRUCTURE**: ESLint plugin follows standard Node.js module structure
42
- - **REQ-ESLINT-COMPAT**: Compatible with ESLint v9 flat configuration
43
- - **REQ-RULE-REGISTRY**: Provides mechanism to register multiple validation rules
44
- - **REQ-CONFIG-SYSTEM**: Supports plugin configuration options for customization
45
- - **REQ-NPM-PACKAGE**: Properly structured as publishable npm package
46
- - **REQ-TYPESCRIPT**: Written in TypeScript for type safety and developer experience
47
- - **REQ-TEST-SETUP**: Includes testing infrastructure for rule validation
48
-
49
- ## Dependencies
50
-
51
- List other stories this story depends on, using numbered story references:
52
-
53
- - None (This is the foundational story)
54
-
55
- **Dependency Rules**:
56
-
57
- - Story numbers MUST be greater than all dependency story numbers
58
- - Dependencies should be from in-scope stories when possible
59
- - Cross-release dependencies should be clearly justified
60
- - No circular dependencies allowed
61
-
62
- ## Implementation Notes (Optional)
63
-
64
- Additional context for developers:
65
-
66
- - Use official ESLint plugin template and conventions
67
- - Structure should support both CommonJS and ESM module systems
68
- - Consider using @typescript-eslint/utils for TypeScript AST parsing utilities
69
- - Plugin should be scoped (e.g., @eslint-plugin-traceability or similar)
70
- - Include proper package.json configuration for ESLint plugin discovery
71
- - Set up development environment with hot reloading for rule testing
72
-
73
- ## Definition of Done
74
-
75
- - [ ] All acceptance criteria met
76
- - [ ] Code reviewed and approved
77
- - [ ] Tests written and passing (plugin loads, registers rules)
78
- - [ ] Documentation updated (README with setup instructions)
79
- - [ ] Plugin can be installed locally and configured in test project
80
- - [ ] Ready for subsequent rule implementation stories
81
-
82
- ---
@@ -1,82 +0,0 @@
1
- # 002.0-DEV-ESLINT-CONFIG: ESLint Configuration Setup
2
-
3
- ## Release Goal
4
-
5
- _Release 0.1: Core Validation - Provide essential ESLint rules that enforce @story and @req annotations on functions and code branches_
6
-
7
- This story enables developers to easily configure the ESLint plugin in their projects with sensible defaults and customizable options. It builds upon the plugin foundation (001.0) to provide user-friendly configuration that integrates seamlessly with existing ESLint setups.
8
-
9
- ## How This Story Contributes
10
-
11
- This story is essential for plugin adoption as it determines how easy it is for developers to start using the traceability enforcement. It provides the configuration layer that enables all validation rules to be applied effectively, with options to customize behavior for different project structures and requirements.
12
-
13
- ## User Story
14
-
15
- **Format**: So that I can quickly integrate traceability validation into my project workflow, as a Developer, I want clear and flexible ESLint configuration options that work with my existing ESLint setup and project structure.
16
-
17
- **INVEST Criteria Compliance**:
18
-
19
- - **Independent**: Can be developed after plugin structure (depends on 001.0-DEV-PLUGIN-SETUP)
20
- - **Negotiable**: Configuration options and defaults can be refined during implementation
21
- - **Valuable**: Enables easy adoption and customization of the plugin
22
- - **Estimable**: Scope is clear - configuration system and presets
23
- - **Small**: Can be completed within a single iteration/sprint
24
- - **Testable**: Configuration can be tested with various ESLint setups
25
-
26
- ## Acceptance Criteria
27
-
28
- Use checkbox format for clear completion tracking:
29
-
30
- - [ ] **Core Functionality**: Plugin provides recommended and strict configuration presets
31
- - [ ] **Quality Standards**: Configuration follows ESLint v9 flat config best practices
32
- - [ ] **Integration**: Works seamlessly with existing ESLint configurations without conflicts
33
- - [ ] **User Experience**: Clear documentation for setup with common project types
34
- - [ ] **Error Handling**: Graceful handling of invalid configuration options
35
- - [ ] **Documentation**: Comprehensive configuration examples and troubleshooting guide
36
-
37
- ## Requirements (Current Implementation or To Be Implemented)
38
-
39
- Document specific technical requirements using the format:
40
-
41
- - **REQ-CONFIG-PRESETS**: Provide recommended and strict configuration presets
42
- - **REQ-FLAT-CONFIG**: Support ESLint v9 flat configuration format
43
- - **REQ-CUSTOMIZABLE-PATHS**: Allow customization of story file patterns and locations
44
- - **REQ-RULE-OPTIONS**: Support configurable options for individual rules
45
- - **REQ-PROJECT-INTEGRATION**: Easy integration with TypeScript, JavaScript, and mixed projects
46
- - **REQ-CONFIG-VALIDATION**: Validate configuration options with helpful error messages
47
-
48
- ## Dependencies
49
-
50
- List other stories this story depends on, using numbered story references:
51
-
52
- - 001.0-DEV-PLUGIN-SETUP (requires plugin structure foundation)
53
-
54
- **Dependency Rules**:
55
-
56
- - Story numbers MUST be greater than all dependency story numbers
57
- - Dependencies should be from in-scope stories when possible
58
- - Cross-release dependencies should be clearly justified
59
- - No circular dependencies allowed
60
-
61
- ## Implementation Notes (Optional)
62
-
63
- Additional context for developers:
64
-
65
- - Follow ESLint v9 flat config patterns from the development guide
66
- - Provide migration examples from eslintrc to flat config
67
- - Consider different project structures (monorepos, TypeScript projects, etc.)
68
- - Include configuration validation with JSON Schema
69
- - Support both scoped and unscoped package installations
70
- - Document integration with popular ESLint config presets (Airbnb, Standard, etc.)
71
- - Provide configuration generator or CLI helper for initial setup
72
-
73
- ## Definition of Done
74
-
75
- - [ ] All acceptance criteria met
76
- - [ ] Code reviewed and approved
77
- - [ ] Tests written and passing (configuration loading, validation, rule application)
78
- - [ ] Documentation updated (configuration guide, migration examples)
79
- - [ ] Configuration tested with sample projects (TS, JS, mixed)
80
- - [ ] Ready for rule implementation stories (003.0, 004.0, etc.)
81
-
82
- ---
@@ -1,85 +0,0 @@
1
- # 003.0-DEV-FUNCTION-ANNOTATIONS: Function Annotation Validation
2
-
3
- ## Release Goal
4
-
5
- _Release 0.1: Core Validation - Provide essential ESLint rules that enforce @story and @req annotations on functions and code branches_
6
-
7
- This story implements the core ESLint rule that validates functions have proper @story and @req annotations. It provides the fundamental traceability enforcement that ensures all functions can be traced back to their originating requirements and stories.
8
-
9
- ## How This Story Contributes
10
-
11
- This story delivers the primary value proposition of the plugin by implementing the core validation rule for function annotations. It enables the "Write Code" journey phase by ensuring developers receive immediate feedback when they create functions without proper traceability annotations, establishing the foundation for bidirectional traceability.
12
-
13
- ## User Story
14
-
15
- **Format**: So that I can ensure all functions in my codebase are traceable to requirements, as a Developer, I want an ESLint rule that validates functions have @story and @req annotations in their JSDoc comments.
16
-
17
- **INVEST Criteria Compliance**:
18
-
19
- - **Independent**: Can be developed after plugin foundation and configuration (depends on 001.0, 002.0)
20
- - **Negotiable**: Rule strictness and annotation format can be refined during implementation
21
- - **Valuable**: Delivers core traceability enforcement for functions
22
- - **Estimable**: Scope is clear - single ESLint rule with defined behavior
23
- - **Small**: Can be completed within a single iteration/sprint
24
- - **Testable**: Rule can be thoroughly tested with ESLint's RuleTester
25
-
26
- ## Acceptance Criteria
27
-
28
- Use checkbox format for clear completion tracking:
29
-
30
- - [ ] **Core Functionality**: ESLint rule detects functions missing @story or @req annotations
31
- - [ ] **Quality Standards**: Rule follows ESLint rule development best practices
32
- - [ ] **Integration**: Rule works with TypeScript, JavaScript, and mixed codebases
33
- - [ ] **User Experience**: Clear, actionable error messages guide developers to fix issues
34
- - [ ] **Error Handling**: Gracefully handles malformed JSDoc comments and edge cases
35
- - [ ] **Documentation**: Rule documentation with examples and configuration options
36
-
37
- ## Requirements (Current Implementation or To Be Implemented)
38
-
39
- Document specific technical requirements using the format:
40
-
41
- - **REQ-FUNCTION-DETECTION**: Detect all function declarations, expressions, and arrow functions
42
- - **REQ-JSDOC-PARSING**: Parse JSDoc comments to extract @story and @req annotations
43
- - **REQ-ANNOTATION-REQUIRED**: Require both @story and @req annotations on functions
44
- - **REQ-CONFIGURABLE-SCOPE**: Allow configuration of which functions require annotations
45
- - **REQ-EXPORT-PRIORITY**: Prioritize checking exported functions over internal ones
46
- - **REQ-ERROR-LOCATION**: Report errors at function name for precise error location
47
- - **REQ-TYPESCRIPT-SUPPORT**: Support TypeScript-specific function syntax and decorators
48
-
49
- ## Dependencies
50
-
51
- List other stories this story depends on, using numbered story references:
52
-
53
- - 001.0-DEV-PLUGIN-SETUP (requires plugin structure foundation)
54
- - 002.0-DEV-ESLINT-CONFIG (requires configuration system)
55
-
56
- **Dependency Rules**:
57
-
58
- - Story numbers MUST be greater than all dependency story numbers
59
- - Dependencies should be from in-scope stories when possible
60
- - Cross-release dependencies should be clearly justified
61
- - No circular dependencies allowed
62
-
63
- ## Implementation Notes (Optional)
64
-
65
- Additional context for developers:
66
-
67
- - Use @typescript-eslint/utils for AST parsing to handle TypeScript syntax
68
- - Leverage ESLint's JSDoc utilities for comment parsing
69
- - Support multiple function declaration patterns (function, const fn = (), class methods)
70
- - Consider performance impact of JSDoc parsing on large codebases
71
- - Implement configurable options for function scope (exported only, all functions, complexity threshold)
72
- - Handle edge cases: anonymous functions, IIFE, generator functions, async functions
73
- - Provide clear error messages that include function name and missing annotation type
74
-
75
- ## Definition of Done
76
-
77
- - [ ] All acceptance criteria met
78
- - [ ] Code reviewed and approved
79
- - [ ] Tests written and passing (comprehensive RuleTester coverage)
80
- - [ ] Documentation updated (rule documentation with examples)
81
- - [ ] Rule integrated into plugin configuration presets
82
- - [ ] Performance tested with large codebases
83
- - [ ] Ready for branch annotation rule (004.0-DEV-BRANCH-ANNOTATIONS)
84
-
85
- ---
@@ -1,107 +0,0 @@
1
- # 004.0-DEV-BRANCH-ANNOTATIONS: Code Branch Annotation Validation
2
-
3
- ## Release Goal
4
-
5
- _Release 0.1: Core Validation - Provide essential ESLint rules that enforce @story and @req annotations on functions and code branches_
6
-
7
- This story implements ESLint rules that validate significant code branches (if/else blocks, try/catch blocks, switch cases, loops) have proper traceability annotations. It extends traceability enforcement beyond functions to ensure complex logic paths can be traced back to their requirements.
8
-
9
- ## How This Story Contributes
10
-
11
- This story completes the core annotation enforcement by ensuring not just functions, but also significant logical branches within functions are traceable. It enables comprehensive requirement validation by ensuring that every code path can be traced to its originating story and requirement, supporting the system prompt's emphasis on branch-level traceability.
12
-
13
- ## User Story
14
-
15
- **Format**: So that I can trace complex logic and conditional code paths back to requirements, as a Developer, I want an ESLint rule that validates significant code branches have @story and @req annotations in comments.
16
-
17
- **INVEST Criteria Compliance**:
18
-
19
- - **Independent**: Can be developed after function annotations (depends on 001.0, 002.0, 003.0 patterns)
20
- - **Negotiable**: Branch significance criteria and annotation requirements can be refined
21
- - **Valuable**: Delivers comprehensive traceability coverage beyond function-level
22
- - **Estimable**: Scope is clear - ESLint rule for branch annotation validation
23
- - **Small**: Can be completed within a single iteration/sprint
24
- - **Testable**: Rule can be tested with various code branch patterns using RuleTester
25
-
26
- ## Acceptance Criteria
27
-
28
- Use checkbox format for clear completion tracking:
29
-
30
- - [ ] **Core Functionality**: ESLint rule detects significant code branches missing @story or @req annotations
31
- - [ ] **Quality Standards**: Rule follows ESLint development best practices and performance guidelines
32
- - [ ] **Integration**: Rule works with complex nested code structures and various programming patterns
33
- - [ ] **User Experience**: Clear error messages indicate which branch needs annotation and why
34
- - [ ] **Error Handling**: Gracefully handles edge cases like nested branches and complex conditionals
35
- - [ ] **Documentation**: Rule documentation with examples of annotated branches and configuration
36
-
37
- ## Requirements (Current Implementation or To Be Implemented)
38
-
39
- Document specific technical requirements using the format:
40
-
41
- - **REQ-BRANCH-DETECTION**: Detect significant code branches (if/else, try/catch, switch, loops)
42
- - **REQ-COMMENT-ASSOCIATION**: Associate inline comments with their corresponding code branches
43
- - **REQ-ANNOTATION-PARSING**: Parse @story and @req annotations from branch comments
44
- - **REQ-SIGNIFICANCE-CRITERIA**: Define criteria for which branches require annotations
45
- - **REQ-NESTED-HANDLING**: Handle nested branches and complex control flow structures
46
- - **REQ-CONFIGURABLE-SCOPE**: Allow configuration of which branch types require annotations
47
- - **REQ-PERFORMANCE-OPTIMIZATION**: Efficient processing of large files with many branches
48
-
49
- ## Dependencies
50
-
51
- List other stories this story depends on, using numbered story references:
52
-
53
- - 001.0-DEV-PLUGIN-SETUP (requires plugin structure foundation)
54
- - 002.0-DEV-ESLINT-CONFIG (requires configuration system)
55
- - 003.0-DEV-FUNCTION-ANNOTATIONS (uses patterns from function annotation validation)
56
-
57
- **Dependency Rules**:
58
-
59
- - Story numbers MUST be greater than all dependency story numbers
60
- - Dependencies should be from in-scope stories when possible
61
- - Cross-release dependencies should be clearly justified
62
- - No circular dependencies allowed
63
-
64
- ## Implementation Notes (Optional)
65
-
66
- Additional context for developers:
67
-
68
- - Leverage patterns established in 003.0-DEV-FUNCTION-ANNOTATIONS for consistency
69
- - Use AST visitor pattern to identify significant control flow nodes
70
- - Consider branch complexity/significance thresholds (configurable)
71
- - Handle inline comments vs. block comments for branch annotations
72
- - Support various comment styles (// and /\* \*/) for branch annotations
73
- - Implement smart detection of "significant" vs. trivial branches
74
- - Consider performance impact on large files with many conditional statements
75
- - Provide clear guidance on where to place branch annotations (before branch, inline, etc.)
76
-
77
- Example annotation patterns:
78
-
79
- ```javascript
80
- // @story docs/stories/001.0-DEV-EXAMPLE.story.md
81
- // @req REQ-ERROR-HANDLING
82
- if (error) {
83
- // error handling logic
84
- }
85
-
86
- try {
87
- // @story docs/stories/001.0-DEV-EXAMPLE.story.md
88
- // @req REQ-API-CALL
89
- await apiCall();
90
- } catch (error) {
91
- // @story docs/stories/001.0-DEV-EXAMPLE.story.md
92
- // @req REQ-ERROR-RECOVERY
93
- handleError(error);
94
- }
95
- ```
96
-
97
- ## Definition of Done
98
-
99
- - [ ] All acceptance criteria met
100
- - [ ] Code reviewed and approved
101
- - [ ] Tests written and passing (comprehensive branch pattern coverage)
102
- - [ ] Documentation updated (branch annotation examples and best practices)
103
- - [ ] Rule integrated into plugin configuration presets
104
- - [ ] Performance tested with files containing many branches
105
- - [ ] Ready for annotation validation logic (005.0-DEV-ANNOTATION-VALIDATION)
106
-
107
- ---
@@ -1,119 +0,0 @@
1
- # 005.0-DEV-ANNOTATION-VALIDATION: Annotation Format Validation
2
-
3
- ## Release Goal
4
-
5
- _Release 0.1: Core Validation - Provide essential ESLint rules that enforce @story and @req annotations on functions and code branches_
6
-
7
- This story implements validation logic that ensures @story and @req annotations follow proper format and syntax rules. It provides the foundation for validating annotation structure before checking file references and requirement existence, enabling clear error reporting for malformed annotations.
8
-
9
- ## How This Story Contributes
10
-
11
- This story enables the "Validate Annotations" journey phase by ensuring annotation syntax is correct and parseable before attempting to validate file references. It provides immediate feedback on annotation format issues, improving developer experience by catching syntax errors early in the validation pipeline and enabling more sophisticated validation in later stories.
12
-
13
- ## User Story
14
-
15
- **Format**: So that I can ensure my traceability annotations are properly formatted and parseable, as a Developer, I want validation that checks @story and @req annotation syntax and provides helpful error messages for format violations.
16
-
17
- **INVEST Criteria Compliance**:
18
-
19
- - **Independent**: Can be developed after annotation detection rules (depends on 001.0, 002.0, 003.0, 004.0)
20
- - **Negotiable**: Format strictness and validation rules can be refined during implementation
21
- - **Valuable**: Delivers clear feedback on annotation syntax before file validation
22
- - **Estimable**: Scope is clear - annotation format validation with defined syntax rules
23
- - **Small**: Can be completed within a single iteration/sprint
24
- - **Testable**: Format validation can be thoroughly tested with various annotation patterns
25
-
26
- ## Acceptance Criteria
27
-
28
- Use checkbox format for clear completion tracking:
29
-
30
- - [ ] **Core Functionality**: Validates @story and @req annotation format and syntax
31
- - [ ] **Quality Standards**: Follows ESLint development best practices for validation rules
32
- - [ ] **Integration**: Works with annotations found by function and branch validation rules
33
- - [ ] **User Experience**: Clear, specific error messages for different format violations
34
- - [ ] **Error Handling**: Gracefully handles edge cases and malformed comment structures
35
- - [ ] **Documentation**: Format specification with examples of valid and invalid annotations
36
-
37
- ## Requirements (Current Implementation or To Be Implemented)
38
-
39
- Document specific technical requirements using the format:
40
-
41
- - **REQ-FORMAT-SPECIFICATION**: Define clear format rules for @story and @req annotations
42
- - **REQ-SYNTAX-VALIDATION**: Validate annotation syntax matches specification
43
- - **REQ-PATH-FORMAT**: Validate @story paths follow expected patterns (relative paths, .story.md extension)
44
- - **REQ-REQ-FORMAT**: Validate @req identifiers follow expected patterns (REQ-\* format)
45
- - **REQ-MULTILINE-SUPPORT**: Handle annotations split across multiple lines
46
- - **REQ-FLEXIBLE-PARSING**: Support reasonable variations in whitespace and formatting
47
- - **REQ-ERROR-SPECIFICITY**: Provide specific error messages for different format violations
48
-
49
- ## Dependencies
50
-
51
- List other stories this story depends on, using numbered story references:
52
-
53
- - 001.0-DEV-PLUGIN-SETUP (requires plugin structure foundation)
54
- - 002.0-DEV-ESLINT-CONFIG (requires configuration system)
55
- - 003.0-DEV-FUNCTION-ANNOTATIONS (uses annotations detected by function validation)
56
- - 004.0-DEV-BRANCH-ANNOTATIONS (uses annotations detected by branch validation)
57
-
58
- **Dependency Rules**:
59
-
60
- - Story numbers MUST be greater than all dependency story numbers
61
- - Dependencies should be from in-scope stories when possible
62
- - Cross-release dependencies should be clearly justified
63
- - No circular dependencies allowed
64
-
65
- ## Implementation Notes (Optional)
66
-
67
- Additional context for developers:
68
-
69
- - Build shared validation utilities used by both function and branch annotation rules
70
- - Define annotation format specification as part of plugin configuration
71
- - Support configurable format strictness levels
72
- - Implement regex patterns for common annotation formats
73
- - Handle various JSDoc comment styles and formatting
74
- - Provide clear error messages with suggestions for fixing format issues
75
- - Consider allowing configuration of custom annotation formats
76
-
77
- **Annotation Format Examples:**
78
-
79
- Valid formats:
80
-
81
- ```javascript
82
- /**
83
- * @story docs/stories/001.0-DEV-EXAMPLE.story.md
84
- * @req REQ-FUNCTION-VALIDATION
85
- */
86
- function example() {}
87
-
88
- // @story docs/stories/001.0-DEV-EXAMPLE.story.md
89
- // @req REQ-BRANCH-LOGIC
90
- if (condition) {
91
- }
92
- ```
93
-
94
- Invalid formats requiring validation:
95
-
96
- ```javascript
97
- // @story missing-extension
98
- // @req invalid-format
99
-
100
- // @story ../../../outside-project.story.md (path traversal)
101
- // @req (missing identifier)
102
-
103
- /**
104
- * @story
105
- * @req REQ-EXAMPLE
106
- */ (missing story path)
107
- ```
108
-
109
- ## Definition of Done
110
-
111
- - [ ] All acceptance criteria met
112
- - [ ] Code reviewed and approved
113
- - [ ] Tests written and passing (comprehensive format validation coverage)
114
- - [ ] Documentation updated (annotation format specification and examples)
115
- - [ ] Validation utilities integrated with existing annotation rules
116
- - [ ] Performance tested with various annotation patterns
117
- - [ ] Ready for file validation logic (006.0-DEV-FILE-VALIDATION)
118
-
119
- ---