eslint-plugin-traceability 1.8.0 → 1.8.2
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 +5 -5
- package/README.md +28 -29
- package/SECURITY.md +135 -0
- package/lib/src/index.d.ts +6 -35
- package/lib/src/index.js +8 -5
- package/lib/src/maintenance/cli.js +12 -16
- package/lib/src/maintenance/detect.js +28 -1
- package/lib/src/rules/helpers/require-story-io.d.ts +2 -2
- package/lib/src/rules/helpers/require-story-io.js +13 -13
- package/lib/src/rules/helpers/valid-annotation-format-internal.d.ts +2 -2
- package/lib/src/rules/helpers/valid-annotation-format-internal.js +3 -3
- package/lib/src/rules/helpers/valid-annotation-utils.d.ts +5 -0
- package/lib/src/rules/helpers/valid-annotation-utils.js +43 -5
- package/lib/src/rules/helpers/valid-implements-utils.d.ts +11 -11
- package/lib/src/rules/helpers/valid-implements-utils.js +11 -11
- package/lib/src/rules/helpers/valid-story-reference-helpers.js +19 -0
- package/lib/src/rules/prefer-implements-annotation.d.ts +7 -7
- package/lib/src/rules/prefer-implements-annotation.js +21 -21
- package/lib/src/rules/valid-annotation-format.js +50 -24
- package/lib/src/rules/valid-req-reference.js +9 -9
- package/lib/src/utils/annotation-checker.js +3 -1
- package/lib/src/utils/reqAnnotationDetection.d.ts +2 -2
- package/lib/src/utils/reqAnnotationDetection.js +28 -28
- package/lib/tests/config/flat-config-presets-integration.test.d.ts +1 -0
- package/lib/tests/config/flat-config-presets-integration.test.js +75 -0
- package/lib/tests/maintenance/batch.test.js +11 -11
- package/lib/tests/maintenance/cli.test.js +34 -27
- package/lib/tests/maintenance/report.test.js +7 -7
- package/lib/tests/plugin-default-export-and-configs.test.js +0 -2
- package/lib/tests/rules/prefer-implements-annotation.test.js +48 -15
- package/lib/tests/rules/require-branch-annotation.test.js +15 -36
- package/lib/tests/rules/require-req-annotation.test.js +31 -104
- package/lib/tests/rules/require-story-annotation.test.js +3 -3
- package/lib/tests/rules/require-story-io-behavior.test.js +2 -7
- package/lib/tests/rules/require-story-io.edgecases.test.js +2 -7
- package/lib/tests/rules/require-story-visitors-edgecases.test.js +8 -8
- package/lib/tests/rules/valid-annotation-format.test.js +23 -23
- package/lib/tests/rules/valid-req-reference.test.js +9 -9
- package/lib/tests/rules/valid-story-reference.test.js +4 -43
- package/lib/tests/utils/annotation-checker.test.js +2 -6
- package/lib/tests/utils/fsTestHelpers.d.ts +7 -0
- package/lib/tests/utils/fsTestHelpers.js +26 -0
- package/lib/tests/utils/ioTestHelpers.d.ts +7 -0
- package/lib/tests/utils/ioTestHelpers.js +24 -0
- package/lib/tests/utils/temp-dir-helpers.d.ts +14 -0
- package/lib/tests/utils/temp-dir-helpers.js +61 -0
- package/package.json +8 -7
- package/user-docs/api-reference.md +37 -20
- package/user-docs/eslint-9-setup-guide.md +89 -6
- package/user-docs/migration-guide.md +37 -21
- package/docs/ci-cd-pipeline.md +0 -224
- package/docs/cli-integration.md +0 -22
- package/docs/code-quality-refactor-opportunities-2025-12-03.md +0 -78
- package/docs/config-presets.md +0 -38
- package/docs/conventional-commits-guide.md +0 -185
- package/docs/custom-rules-development-guide.md +0 -659
- package/docs/decisions/0001-allow-dynamic-require-for-built-plugins.md +0 -26
- 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/decisions/007-github-releases-over-changelog.accepted.md +0 -216
- package/docs/decisions/008-ci-audit-flags.accepted.md +0 -60
- package/docs/decisions/009-security-focused-lint-rules.accepted.md +0 -64
- package/docs/decisions/010-implements-annotation-for-multi-story-requirements.proposed.md +0 -184
- package/docs/decisions/adr-0001-console-usage-for-cli-guards.md +0 -190
- package/docs/decisions/adr-accept-dev-dep-risk-glob.md +0 -40
- package/docs/decisions/adr-commit-branch-tests.md +0 -54
- package/docs/decisions/adr-maintenance-cli-interface.md +0 -140
- package/docs/decisions/adr-pre-push-parity.md +0 -112
- package/docs/decisions/code-quality-ratcheting-plan.md +0 -53
- package/docs/dependency-health.md +0 -238
- package/docs/eslint-9-setup-guide.md +0 -517
- package/docs/eslint-plugin-development-guide.md +0 -487
- package/docs/functionality-coverage-2025-12-03.md +0 -250
- package/docs/jest-testing-guide.md +0 -100
- package/docs/rules/prefer-implements-annotation.md +0 -219
- package/docs/rules/require-branch-annotation.md +0 -71
- package/docs/rules/require-req-annotation.md +0 -203
- package/docs/rules/require-story-annotation.md +0 -159
- package/docs/rules/valid-annotation-format.md +0 -418
- package/docs/rules/valid-req-reference.md +0 -153
- package/docs/rules/valid-story-reference.md +0 -120
- package/docs/security-incidents/2025-11-17-glob-cli-incident.md +0 -45
- package/docs/security-incidents/2025-11-18-brace-expansion-redos.md +0 -45
- package/docs/security-incidents/2025-11-18-bundled-dev-deps-accepted-risk.md +0 -93
- package/docs/security-incidents/2025-11-18-tar-race-condition.md +0 -43
- package/docs/security-incidents/2025-12-03-dependency-health-review.md +0 -58
- package/docs/security-incidents/SECURITY-INCIDENT-2025-11-18-semantic-release-bundled-npm.known-error.md +0 -104
- package/docs/security-incidents/SECURITY-INCIDENT-TEMPLATE.md +0 -37
- package/docs/security-incidents/dependency-override-rationale.md +0 -57
- package/docs/security-incidents/dev-deps-high.json +0 -116
- package/docs/security-incidents/handling-procedure.md +0 -54
- package/docs/stories/001.0-DEV-PLUGIN-SETUP.story.md +0 -92
- package/docs/stories/002.0-DEV-ESLINT-CONFIG.story.md +0 -82
- package/docs/stories/003.0-DEV-FUNCTION-ANNOTATIONS.story.md +0 -112
- package/docs/stories/004.0-DEV-BRANCH-ANNOTATIONS.story.md +0 -153
- package/docs/stories/005.0-DEV-ANNOTATION-VALIDATION.story.md +0 -138
- package/docs/stories/006.0-DEV-FILE-VALIDATION.story.md +0 -144
- package/docs/stories/007.0-DEV-ERROR-REPORTING.story.md +0 -163
- package/docs/stories/008.0-DEV-AUTO-FIX.story.md +0 -150
- package/docs/stories/009.0-DEV-MAINTENANCE-TOOLS.story.md +0 -117
- package/docs/stories/010.0-DEV-DEEP-VALIDATION.story.md +0 -124
- package/docs/stories/010.1-DEV-CONFIGURABLE-PATTERNS.story.md +0 -149
- package/docs/stories/010.2-DEV-MULTI-STORY-SUPPORT.story.md +0 -216
- package/docs/stories/010.3-DEV-MIGRATE-TO-IMPLEMENTS.story.md +0 -236
- package/docs/stories/developer-story.map.md +0 -120
- package/docs/ts-jest-presets-guide.md +0 -548
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
# Security Incident Handling Procedures
|
|
2
|
-
|
|
3
|
-
This document outlines the standardized process for identifying, documenting, approving, and reviewing security incidents and manual dependency overrides within the project.
|
|
4
|
-
|
|
5
|
-
## Scope
|
|
6
|
-
|
|
7
|
-
This procedure applies to all security-related issues discovered in both production and development dependencies, with special focus on manual overrides configured in `package.json` under the `overrides` section.
|
|
8
|
-
|
|
9
|
-
## Roles and Responsibilities
|
|
10
|
-
|
|
11
|
-
- **Developer**: Identifies vulnerabilities, assesses impact, and proposes mitigations or overrides.
|
|
12
|
-
- **Security Lead**: Reviews vulnerability assessments and approves residual risk decisions.
|
|
13
|
-
- **Team Lead**: Ensures procedure compliance and schedules periodic reviews.
|
|
14
|
-
|
|
15
|
-
## Procedure
|
|
16
|
-
|
|
17
|
-
1. **Identification**
|
|
18
|
-
- Discover vulnerabilities via automated tools (e.g., `npm audit`, `dry-aged-deps`) or external advisories.
|
|
19
|
-
- Log the finding in the issue tracker and reference the advisory (CVE or GHSA ID).
|
|
20
|
-
|
|
21
|
-
2. **Initial Assessment**
|
|
22
|
-
- Evaluate severity and exploitability in the project context.
|
|
23
|
-
- Determine if an automated patch or upgrade is available via `dry-aged-deps` or other tooling.
|
|
24
|
-
- If a safe version exists, prefer automated upgrades; do not use manual overrides.
|
|
25
|
-
- All changes merged into `main` are automatically scanned for secrets via the `npm run security:secrets` script in CI; any findings must be investigated and either remediated or explicitly documented as false positives in the issue tracker.
|
|
26
|
-
|
|
27
|
-
3. **Decision to Override**
|
|
28
|
-
- If no safe version is available (e.g., bundled dependency cannot be patched), propose a manual override in `package.json`.
|
|
29
|
-
- Document the rationale in `docs/security-incidents/dependency-override-rationale.md`.
|
|
30
|
-
|
|
31
|
-
4. **Incident Report**
|
|
32
|
-
- Create a security incident report by copying `docs/security-incidents/SECURITY-INCIDENT-TEMPLATE.md` and naming it `YYYY-MM-DD-<package>-<short-title>.md`.
|
|
33
|
-
- Populate the report with details (Date, Dependency, Vulnerability ID, Severity, Description, Remediation, Timeline, Impact Analysis, Testing).
|
|
34
|
-
|
|
35
|
-
5. **Approval and Documentation**
|
|
36
|
-
- Security Lead reviews and approves the incident report and override rationale.
|
|
37
|
-
- Include a link to the incident report in `dependency-override-rationale.md`.
|
|
38
|
-
|
|
39
|
-
6. **Implementation**
|
|
40
|
-
- Commit the manual override to `package.json` under `overrides`.
|
|
41
|
-
- Ensure the incident report and rationale documents are committed in the same PR.
|
|
42
|
-
|
|
43
|
-
7. **Monitoring and Review**
|
|
44
|
-
- Schedule a follow-up review within 7 days to re-assess availability of safe patches.
|
|
45
|
-
- Update or remove overrides and incident reports when safe upgrades become available.
|
|
46
|
-
- Document decision changes in the existing incident report with new timeline entries.
|
|
47
|
-
|
|
48
|
-
8. **Escalation**
|
|
49
|
-
- If a critical vulnerability remains unpatched beyond the tolerance period, escalate to the Security Lead and Team Lead for urgent action.
|
|
50
|
-
|
|
51
|
-
## References
|
|
52
|
-
|
|
53
|
-
- [Security Incident Template](SECURITY-INCIDENT-TEMPLATE.md)
|
|
54
|
-
- [Dependency Override Rationale](dependency-override-rationale.md)
|
|
@@ -1,92 +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
|
-
- [x] **Error Handling**: Gracefully handles plugin loading errors and missing dependencies (covered by tests: tests/plugin-setup-error.test.ts, tests/cli-error-handling.test.ts)
|
|
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
|
-
- **REQ-ERROR-HANDLING**: Gracefully handles plugin loading errors and missing dependencies
|
|
49
|
-
|
|
50
|
-
## Dependencies
|
|
51
|
-
|
|
52
|
-
List other stories this story depends on, using numbered story references:
|
|
53
|
-
|
|
54
|
-
- None (This is the foundational story)
|
|
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
|
-
**Development Resources**:
|
|
68
|
-
|
|
69
|
-
- See [Custom ESLint Rules Development Guide](../custom-rules-development-guide.md) for comprehensive rule development patterns
|
|
70
|
-
- Use official ESLint plugin template and conventions
|
|
71
|
-
- Structure should support both CommonJS and ESM module systems
|
|
72
|
-
- Consider using @typescript-eslint/utils for TypeScript AST parsing utilities
|
|
73
|
-
- Plugin should be scoped (e.g., @eslint-plugin-traceability or similar)
|
|
74
|
-
- Include proper package.json configuration for ESLint plugin discovery
|
|
75
|
-
- Set up development environment with hot reloading for rule testing
|
|
76
|
-
|
|
77
|
-
**Key Guide Sections**:
|
|
78
|
-
|
|
79
|
-
- [Rule Structure](../custom-rules-development-guide.md#rule-structure) - Basic rule anatomy and meta properties
|
|
80
|
-
- [Testing Rules](../custom-rules-development-guide.md#testing-rules) - Using RuleTester for validation
|
|
81
|
-
- [Best Practices](../custom-rules-development-guide.md#best-practices) - Performance and maintainability guidelines
|
|
82
|
-
|
|
83
|
-
## Definition of Done
|
|
84
|
-
|
|
85
|
-
- [ ] All acceptance criteria met
|
|
86
|
-
- [ ] Code reviewed and approved
|
|
87
|
-
- [ ] Tests written and passing (plugin loads, registers rules)
|
|
88
|
-
- [ ] Documentation updated (README with setup instructions)
|
|
89
|
-
- [ ] Plugin can be installed locally and configured in test project
|
|
90
|
-
- [ ] Ready for subsequent rule implementation stories
|
|
91
|
-
|
|
92
|
-
---
|
|
@@ -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,112 +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 rules that validate 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 rules 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 ESLint rules that validate 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 - coordinated ESLint rules with defined behavior
|
|
23
|
-
- **Small**: Can be completed within a single iteration/sprint
|
|
24
|
-
- **Testable**: Rules can be thoroughly tested with ESLint's RuleTester
|
|
25
|
-
|
|
26
|
-
## Acceptance Criteria
|
|
27
|
-
|
|
28
|
-
Use checkbox format for clear completion tracking:
|
|
29
|
-
|
|
30
|
-
- [x] **Core Functionality**: ESLint rules `require-story-annotation` and `require-req-annotation` both enforce their respective annotations on the same set of function-like constructs, ensuring @story and @req are applied consistently together
|
|
31
|
-
- [x] **Quality Standards**: Rules follow ESLint rule development best practices
|
|
32
|
-
- [x] **Integration**: Rules work with TypeScript, JavaScript, and mixed codebases
|
|
33
|
-
- [x] **User Experience**: Clear, actionable error messages guide developers to fix issues
|
|
34
|
-
- [x] **Error Handling**: Gracefully handles malformed JSDoc comments and edge cases
|
|
35
|
-
- [x] **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 the following function-like constructs for annotation validation, shared by both rules:
|
|
42
|
-
- `FunctionDeclaration`
|
|
43
|
-
- `FunctionExpression`
|
|
44
|
-
- `MethodDefinition`
|
|
45
|
-
- `TSDeclareFunction`
|
|
46
|
-
- `TSMethodSignature`
|
|
47
|
-
- Arrow functions are excluded by default from traceability requirements
|
|
48
|
-
- **REQ-JSDOC-PARSING**: Parse JSDoc comments to extract @story and @req annotations, using a common parsing strategy for both rules
|
|
49
|
-
- **REQ-ANNOTATION-REQUIRED**:
|
|
50
|
-
- `require-story-annotation`: Require a @story annotation on all in-scope functions
|
|
51
|
-
- `require-req-annotation`: Require a @req annotation on all in-scope functions
|
|
52
|
-
- Together, these rules ensure functions carry both @story and @req annotations when both rules are enabled
|
|
53
|
-
- **REQ-CONFIGURABLE-SCOPE**: Both rules support the same configurable scope semantics, including:
|
|
54
|
-
- Which function kinds require annotations (e.g., exported only vs. all detected kinds)
|
|
55
|
-
- Optional constraints based on configuration (e.g., complexity threshold, if applicable)
|
|
56
|
-
- **REQ-EXPORT-PRIORITY**: Both rules support a shared `exportPriority`/equivalent option so that exported functions are prioritized for enforcement over internal ones, with consistent behavior across both rules
|
|
57
|
-
- **REQ-ERROR-LOCATION**: Both rules report errors at the function name (or closest equivalent for anonymous constructs) for precise error location
|
|
58
|
-
- **REQ-TYPESCRIPT-SUPPORT**: Support TypeScript-specific function syntax and decorators, including `TSDeclareFunction` and `TSMethodSignature`, with consistent handling across both rules
|
|
59
|
-
|
|
60
|
-
## Dependencies
|
|
61
|
-
|
|
62
|
-
List other stories this story depends on, using numbered story references:
|
|
63
|
-
|
|
64
|
-
- 001.0-DEV-PLUGIN-SETUP (requires plugin structure foundation)
|
|
65
|
-
- 002.0-DEV-ESLINT-CONFIG (requires configuration system)
|
|
66
|
-
|
|
67
|
-
**Dependency Rules**:
|
|
68
|
-
|
|
69
|
-
- Story numbers MUST be greater than all dependency story numbers
|
|
70
|
-
- Dependencies should be from in-scope stories when possible
|
|
71
|
-
- Cross-release dependencies should be clearly justified
|
|
72
|
-
- No circular dependencies allowed
|
|
73
|
-
|
|
74
|
-
## Implementation Notes (Optional)
|
|
75
|
-
|
|
76
|
-
Additional context for developers:
|
|
77
|
-
|
|
78
|
-
**Development Resources**:
|
|
79
|
-
|
|
80
|
-
- See [Custom ESLint Rules Development Guide](../custom-rules-development-guide.md) for comprehensive patterns
|
|
81
|
-
- Review [Working with the AST](../custom-rules-development-guide.md#working-with-the-ast) for visitor patterns
|
|
82
|
-
- See [Accessing Source Code](../custom-rules-development-guide.md#accessing-source-code) for JSDoc comment parsing
|
|
83
|
-
|
|
84
|
-
**Implementation Details**:
|
|
85
|
-
|
|
86
|
-
- Use @typescript-eslint/utils for AST parsing to handle TypeScript syntax
|
|
87
|
-
- Leverage ESLint's JSDoc utilities for comment parsing via `sourceCode.getCommentsBefore()`
|
|
88
|
-
- Support function declarations and function expressions (excluding arrow functions), as well as `MethodDefinition`, `TSDeclareFunction`, and `TSMethodSignature`
|
|
89
|
-
- Consider performance impact of JSDoc parsing on large codebases
|
|
90
|
-
- Implement configurable options for function scope (exported only, all functions, complexity threshold)
|
|
91
|
-
- Handle edge cases: anonymous function expressions, IIFE, generator functions, async function declarations/expressions
|
|
92
|
-
- Arrow functions are explicitly excluded from traceability requirements by default
|
|
93
|
-
- Provide clear error messages that include function name and missing annotation type
|
|
94
|
-
- Keep `require-story-annotation` and `require-req-annotation` implementations aligned so that any changes to detection or scoping logic remain consistent between both rules
|
|
95
|
-
|
|
96
|
-
**Key Guide Sections**:
|
|
97
|
-
|
|
98
|
-
- [The Context Object](../custom-rules-development-guide.md#the-context-object) - Accessing sourceCode and options
|
|
99
|
-
- [Reporting Problems](../custom-rules-development-guide.md#reporting-problems) - Using messageIds and context.report()
|
|
100
|
-
- [Rule Options and Schema](../custom-rules-development-guide.md#rule-options-and-schema) - Defining configurable behavior
|
|
101
|
-
|
|
102
|
-
## Definition of Done
|
|
103
|
-
|
|
104
|
-
- [x] All acceptance criteria met
|
|
105
|
-
- [ ] Code reviewed and approved
|
|
106
|
-
- [ ] Tests written and passing (comprehensive RuleTester coverage)
|
|
107
|
-
- [x] Documentation updated (rule documentation with examples)
|
|
108
|
-
- [ ] Rule integrated into plugin configuration presets
|
|
109
|
-
- [ ] Performance tested with large codebases
|
|
110
|
-
- [ ] Ready for branch annotation rule (004.0-DEV-BRANCH-ANNOTATIONS)
|
|
111
|
-
|
|
112
|
-
---
|
|
@@ -1,153 +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
|
-
**Development Resources**:
|
|
69
|
-
|
|
70
|
-
- See [Custom ESLint Rules Development Guide](../custom-rules-development-guide.md) for comprehensive patterns
|
|
71
|
-
- Review [Working with the AST](../custom-rules-development-guide.md#working-with-the-ast) for control flow node visitors
|
|
72
|
-
- See [Accessing Source Code](../custom-rules-development-guide.md#accessing-source-code) for comment association
|
|
73
|
-
|
|
74
|
-
**Implementation Details**:
|
|
75
|
-
|
|
76
|
-
- Leverage patterns established in 003.0-DEV-FUNCTION-ANNOTATIONS for consistency
|
|
77
|
-
- Use AST visitor pattern to identify significant control flow nodes (IfStatement, TryStatement, ForStatement, etc.)
|
|
78
|
-
- Consider branch complexity/significance thresholds (configurable)
|
|
79
|
-
- Handle inline comments vs. block comments for branch annotations
|
|
80
|
-
- Support various comment styles (// and /\* \*/) for branch annotations using `sourceCode.getCommentsBefore()`
|
|
81
|
-
- Implement smart detection of "significant" vs. trivial branches
|
|
82
|
-
- Consider performance impact on large files with many conditional statements
|
|
83
|
-
- Provide clear guidance on where to place branch annotations (before branch, inline, etc.)
|
|
84
|
-
|
|
85
|
-
**Key Guide Sections**:
|
|
86
|
-
|
|
87
|
-
- [Working with the AST](../custom-rules-development-guide.md#working-with-the-ast) - Visitor methods for control flow nodes
|
|
88
|
-
- [Accessing Source Code](../custom-rules-development-guide.md#accessing-source-code) - Getting comments with includeComments option
|
|
89
|
-
|
|
90
|
-
Example annotation patterns:
|
|
91
|
-
|
|
92
|
-
```javascript
|
|
93
|
-
// @story docs/stories/001.0-DEV-EXAMPLE.story.md
|
|
94
|
-
// @req REQ-ERROR-HANDLING
|
|
95
|
-
if (error) {
|
|
96
|
-
// error handling logic
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
try {
|
|
100
|
-
// @story docs/stories/001.0-DEV-EXAMPLE.story.md
|
|
101
|
-
// @req REQ-API-CALL
|
|
102
|
-
await apiCall();
|
|
103
|
-
} catch (error) {
|
|
104
|
-
// @story docs/stories/001.0-DEV-EXAMPLE.story.md
|
|
105
|
-
// @req REQ-ERROR-RECOVERY
|
|
106
|
-
handleError(error);
|
|
107
|
-
}
|
|
108
|
-
```
|
|
109
|
-
|
|
110
|
-
## Configuration (REQ-CONFIGURABLE-SCOPE)
|
|
111
|
-
|
|
112
|
-
This ESLint rule can be configured to enforce annotations only on specific branch types. For example, to enforce only on `IfStatement` and `ForStatement`:
|
|
113
|
-
|
|
114
|
-
```js
|
|
115
|
-
// .eslintrc.js
|
|
116
|
-
module.exports = {
|
|
117
|
-
rules: {
|
|
118
|
-
// @req REQ-CONFIGURABLE-SCOPE
|
|
119
|
-
"traceability/require-branch-annotation": [
|
|
120
|
-
"error",
|
|
121
|
-
{ branchTypes: ["IfStatement", "ForStatement"] },
|
|
122
|
-
],
|
|
123
|
-
},
|
|
124
|
-
};
|
|
125
|
-
```
|
|
126
|
-
|
|
127
|
-
```js
|
|
128
|
-
// .eslintrc.js
|
|
129
|
-
module.exports = {
|
|
130
|
-
rules: {
|
|
131
|
-
// @req REQ-CONFIGURABLE-SCOPE
|
|
132
|
-
"traceability/require-branch-annotation": [
|
|
133
|
-
"error",
|
|
134
|
-
{ branchTypes: ["IfStatement"] },
|
|
135
|
-
],
|
|
136
|
-
},
|
|
137
|
-
};
|
|
138
|
-
```
|
|
139
|
-
|
|
140
|
-
Invalid Configuration Behavior:
|
|
141
|
-
|
|
142
|
-
- If an unsupported or misspelled branch type is provided in `branchTypes`, the rule reports a configuration error during ESLint initialization with a message like:
|
|
143
|
-
`traceability/require-branch-annotation: Invalid branch type "InvalidType" in configuration. Supported branch types are: IfStatement, SwitchStatement, ForStatement, WhileStatement, DoWhileStatement, TryStatement, ForInStatement, ForOfStatement.`
|
|
144
|
-
|
|
145
|
-
## Definition of Done
|
|
146
|
-
|
|
147
|
-
- [ ] All acceptance criteria met
|
|
148
|
-
- [ ] Code reviewed and approved
|
|
149
|
-
- [ ] Tests written and passing (comprehensive branch pattern coverage)
|
|
150
|
-
- [ ] Documentation updated (branch annotation examples and best practices)
|
|
151
|
-
- [ ] Rule integrated into plugin configuration presets
|
|
152
|
-
- [ ] Performance tested with files containing many branches
|
|
153
|
-
- [ ] Ready for annotation validation logic (005.0-DEV-ANNOTATION-VALIDATION)
|
|
@@ -1,138 +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
|
-
- [x] **Core Functionality**: Validates @story and @req annotation format and syntax
|
|
31
|
-
- [x] **Quality Standards**: Follows ESLint development best practices for validation rules
|
|
32
|
-
- [x] **Integration**: Works with annotations found by function and branch validation rules
|
|
33
|
-
- [x] **User Experience**: Clear, specific error messages for different format violations
|
|
34
|
-
- [x] **Error Handling**: Gracefully handles edge cases and malformed comment structures
|
|
35
|
-
- [x] **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
|
-
**Development Resources**:
|
|
70
|
-
|
|
71
|
-
- See [Custom ESLint Rules Development Guide](../custom-rules-development-guide.md) for validation patterns
|
|
72
|
-
- Review [Reporting Problems](../custom-rules-development-guide.md#reporting-problems) for error messaging with messageIds
|
|
73
|
-
- See [Rule Options and Schema](../custom-rules-development-guide.md#rule-options-and-schema) for format configuration
|
|
74
|
-
|
|
75
|
-
**Implementation Details**:
|
|
76
|
-
|
|
77
|
-
- Build shared validation utilities used by both function and branch annotation rules
|
|
78
|
-
- Define annotation format specification as part of plugin configuration
|
|
79
|
-
- Support configurable format strictness levels
|
|
80
|
-
- Implement regex patterns for common annotation formats
|
|
81
|
-
- Handle various JSDoc comment styles and formatting
|
|
82
|
-
- Provide clear error messages with suggestions for fixing format issues using data placeholders
|
|
83
|
-
- Consider allowing configuration of custom annotation formats
|
|
84
|
-
|
|
85
|
-
**Key Guide Sections**:
|
|
86
|
-
|
|
87
|
-
- [Reporting Problems](../custom-rules-development-guide.md#reporting-problems) - Using message placeholders with data
|
|
88
|
-
- [Rule Options and Schema](../custom-rules-development-guide.md#rule-options-and-schema) - JSON Schema validation for format options
|
|
89
|
-
|
|
90
|
-
**Annotation Format Examples:**
|
|
91
|
-
|
|
92
|
-
Valid formats:
|
|
93
|
-
|
|
94
|
-
```javascript
|
|
95
|
-
/**
|
|
96
|
-
* @story docs/stories/001.0-DEV-EXAMPLE.story.md
|
|
97
|
-
* @req REQ-FUNCTION-VALIDATION
|
|
98
|
-
*/
|
|
99
|
-
function example() {}
|
|
100
|
-
|
|
101
|
-
// @story docs/stories/001.0-DEV-EXAMPLE.story.md
|
|
102
|
-
// @req REQ-BRANCH-LOGIC
|
|
103
|
-
if (condition) {
|
|
104
|
-
}
|
|
105
|
-
```
|
|
106
|
-
|
|
107
|
-
Invalid formats requiring validation:
|
|
108
|
-
|
|
109
|
-
```javascript
|
|
110
|
-
// @story missing-extension
|
|
111
|
-
// @req invalid-format
|
|
112
|
-
|
|
113
|
-
// @story ../../../outside-project.story.md (path traversal)
|
|
114
|
-
// @req (missing identifier)
|
|
115
|
-
|
|
116
|
-
/**
|
|
117
|
-
* @story
|
|
118
|
-
* @req REQ-EXAMPLE
|
|
119
|
-
*/ (missing story path)
|
|
120
|
-
|
|
121
|
-
// @story docs/stories/001.0-DEV-EXAMPLE (missing .story.md extension)
|
|
122
|
-
// @story ../docs/stories/001.0-DEV-EXAMPLE.story.md (disallowed ../ traversal)
|
|
123
|
-
// @req REQ- (invalid identifier format)
|
|
124
|
-
// @req (no identifier at all)
|
|
125
|
-
// @req (only the @req token with whitespace, missing identifier)
|
|
126
|
-
```
|
|
127
|
-
|
|
128
|
-
## Definition of Done
|
|
129
|
-
|
|
130
|
-
- [x] All acceptance criteria met
|
|
131
|
-
- [ ] Code reviewed and approved
|
|
132
|
-
- [x] Tests written and passing (comprehensive format validation coverage)
|
|
133
|
-
- [x] Documentation updated (annotation format specification and examples)
|
|
134
|
-
- [x] Validation utilities integrated with existing annotation rules
|
|
135
|
-
- [ ] Performance tested with various annotation patterns
|
|
136
|
-
- [ ] Ready for file validation logic (006.0-DEV-FILE-VALIDATION)
|
|
137
|
-
|
|
138
|
-
---
|