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,185 +0,0 @@
1
- # Conventional Commits Guide
2
-
3
- This project uses [Conventional Commits](https://www.conventionalcommits.org/) to enable automated semantic versioning and changelog generation through semantic-release.
4
-
5
- ## Commit Message Format
6
-
7
- ```
8
- <type>[optional scope]: <description>
9
-
10
- [optional body]
11
-
12
- [optional footer(s)]
13
- ```
14
-
15
- ## Types and Version Impact
16
-
17
- ### `feat`: New Features (Minor Version)
18
-
19
- - Adds new functionality
20
- - Results in a **minor** version increment (e.g., 1.0.0 → 1.1.0)
21
-
22
- Examples:
23
-
24
- ```bash
25
- feat: add new validation rule for story references
26
- feat(rules): implement require-branch-annotation rule
27
- feat: add CLI integration for batch processing
28
- ```
29
-
30
- ### `fix`: Bug Fixes (Patch Version)
31
-
32
- - Fixes existing functionality
33
- - Results in a **patch** version increment (e.g., 1.0.0 → 1.0.1)
34
-
35
- Examples:
36
-
37
- ```bash
38
- fix: resolve annotation parsing for multiline comments
39
- fix(validation): handle edge case in reference checking
40
- fix: prevent false positives in story reference detection
41
- ```
42
-
43
- ### Breaking Changes (Major Version)
44
-
45
- - Any commit with `!` after the type or `BREAKING CHANGE:` in footer
46
- - Results in a **major** version increment (e.g., 1.0.0 → 2.0.0)
47
-
48
- Examples:
49
-
50
- ```bash
51
- feat!: change API interface for rule configuration
52
- fix!: remove deprecated annotation format support
53
-
54
- feat: add new validation options
55
-
56
- BREAKING CHANGE: The `allowUnresolved` option has been removed.
57
- Use `strict: false` instead.
58
- ```
59
-
60
- ### Other Types (No Version Change)
61
-
62
- These don't trigger releases but appear in changelog:
63
-
64
- - `docs`: Documentation changes
65
- - `style`: Code style changes (formatting, etc.)
66
- - `refactor`: Code refactoring without functional changes
67
- - `test`: Adding or updating tests
68
- - `chore`: Build process, auxiliary tools, or maintenance
69
- - `perf`: Performance improvements
70
- - `ci`: CI/CD configuration changes
71
-
72
- Examples:
73
-
74
- ```bash
75
- docs: update README with installation instructions
76
- test: add unit tests for validation rules
77
- chore: update dependencies to latest versions
78
- ci: configure semantic-release for automated publishing
79
- ```
80
-
81
- ## Scopes (Optional)
82
-
83
- Use scopes to specify what part of the codebase is affected:
84
-
85
- - `rules`: ESLint rule implementations
86
- - `maintenance`: Maintenance scripts and utilities
87
- - `cli`: Command-line integration tools
88
- - `config`: Configuration and setup files
89
- - `deps`: Dependency updates
90
-
91
- Examples:
92
-
93
- ```bash
94
- feat(rules): add valid-annotation-format rule
95
- fix(maintenance): resolve batch processing memory leak
96
- docs(config): add ESLint 9 setup guide
97
- ```
98
-
99
- ## Best Practices
100
-
101
- ### Commit Message Guidelines
102
-
103
- 1. **Use imperative mood**: "add feature" not "added feature"
104
- 2. **Keep subject under 50 characters**: For better git log readability
105
- 3. **Capitalize the subject line**: Start with capital letter
106
- 4. **No period at the end**: Of the subject line
107
- 5. **Explain what and why**: In the body, not how
108
-
109
- ### When to Use Each Type
110
-
111
- **Use `feat` when:**
112
-
113
- - Adding new ESLint rules
114
- - Adding new maintenance utilities
115
- - Adding new configuration options
116
- - Adding new CLI commands or features
117
-
118
- **Use `fix` when:**
119
-
120
- - Fixing rule logic or false positives/negatives
121
- - Fixing crashes or runtime errors
122
- - Fixing configuration issues
123
- - Fixing documentation errors
124
-
125
- **Use `refactor` when:**
126
-
127
- - Improving code structure without changing behavior
128
- - Renaming variables or functions
129
- - Extracting common functionality
130
- - Simplifying complex logic
131
-
132
- **Use `docs` when:**
133
-
134
- - Updating README, guides, or API documentation
135
- - Adding code comments or JSDoc
136
- - Updating examples or migration guides
137
-
138
- ### Example Workflow
139
-
140
- ```bash
141
- # New feature
142
- git commit -m "feat(rules): add require-story-annotation rule
143
-
144
- Implements validation to ensure all functions have @story annotations
145
- linking them to user stories for traceability.
146
-
147
- Resolves: #123"
148
-
149
- # Bug fix
150
- git commit -m "fix: resolve false positive in annotation parsing
151
-
152
- The regex pattern was incorrectly matching inline comments.
153
- Updated to only match block comments that start at beginning of line."
154
-
155
- # Breaking change
156
- git commit -m "feat!: change rule configuration schema
157
-
158
- BREAKING CHANGE: Rule options now use 'patterns' instead of 'pattern'.
159
- Update your ESLint config:
160
- - Before: { "pattern": "REQ-*" }
161
- + After: { "patterns": ["REQ-*"] }"
162
- ```
163
-
164
- ## Integration with semantic-release
165
-
166
- semantic-release analyzes commit messages to:
167
-
168
- 1. **Determine version bump**: Based on feat/fix/breaking change types
169
- 2. **Generate changelog**: From commit messages and pull request information
170
- 3. **Create git tags**: For each release
171
- 4. **Publish to npm**: Only when changes warrant a release
172
-
173
- ## Validation
174
-
175
- Pre-commit hooks will validate your commit messages follow the conventional format. If you need to bypass validation temporarily (not recommended), use:
176
-
177
- ```bash
178
- git commit --no-verify -m "your message"
179
- ```
180
-
181
- ## Resources
182
-
183
- - [Conventional Commits Specification](https://www.conventionalcommits.org/)
184
- - [semantic-release Documentation](https://semantic-release.gitbook.io/)
185
- - [Angular Commit Message Guidelines](https://github.com/angular/angular/blob/main/CONTRIBUTING.md#-commit-message-format)
@@ -1,111 +0,0 @@
1
- ---
2
- status: "accepted"
3
- date: 2025-11-15
4
- decision-makers: [Development Team]
5
- consulted: [ESLint Community Best Practices, TypeScript ESLint Documentation]
6
- informed: [Project Stakeholders, Future Contributors]
7
- ---
8
-
9
- # Use TypeScript for ESLint Plugin Development
10
-
11
- ## Context and Problem Statement
12
-
13
- When developing an ESLint plugin that validates code traceability annotations (@story and @req comments), we need to choose the implementation language. The plugin will perform complex Abstract Syntax Tree (AST) manipulation to analyze JavaScript/TypeScript code and validate annotation compliance. The choice between JavaScript and TypeScript affects development experience, maintainability, error prevention, and integration with the broader ESLint ecosystem.
14
-
15
- ## Decision Drivers
16
-
17
- - Need for type safety when working with complex AST structures and ESLint Rule API
18
- - Developer experience and IDE support for plugin development
19
- - Integration with modern ESLint tooling and TypeScript ecosystem
20
- - Error prevention during AST manipulation and rule configuration
21
- - Long-term maintainability of the plugin codebase
22
- - Alignment with ESLint plugin development best practices
23
- - Support for advanced TypeScript-aware parsing when needed
24
-
25
- ## Considered Options
26
-
27
- - TypeScript with full type definitions
28
- - JavaScript with JSDoc type annotations
29
- - Plain JavaScript without type annotations
30
-
31
- ## Decision Outcome
32
-
33
- Chosen option: "TypeScript with full type definitions", because it provides the strongest type safety for complex AST manipulation, offers the best developer experience through IDE integration, aligns with modern ESLint plugin development practices, and enables seamless integration with @typescript-eslint utilities.
34
-
35
- ### Consequences
36
-
37
- - Good, because TypeScript prevents runtime errors from malformed AST access patterns
38
- - Good, because IDE autocompletion and IntelliSense improve development velocity
39
- - Good, because type definitions serve as living documentation for rule APIs
40
- - Good, because integration with @typescript-eslint/utils provides advanced parsing capabilities
41
- - Good, because refactoring becomes safer as the plugin grows in complexity
42
- - Good, because follows established patterns in the ESLint ecosystem
43
- - Bad, because requires additional build step for TypeScript compilation
44
- - Bad, because slightly increases initial setup complexity
45
- - Bad, because may have learning curve for developers unfamiliar with TypeScript
46
-
47
- ### Confirmation
48
-
49
- Implementation compliance will be confirmed through:
50
-
51
- - TypeScript compilation passes without errors in CI/CD pipeline
52
- - All plugin source files use .ts extension
53
- - package.json includes TypeScript as development dependency
54
- - tsconfig.json configured for ESLint plugin development
55
- - Use of @typescript-eslint/utils for AST manipulation where appropriate
56
- - Type definitions for all rule configurations and options
57
-
58
- ## Pros and Cons of the Options
59
-
60
- ### TypeScript with full type definitions
61
-
62
- TypeScript provides compile-time type checking, excellent IDE support, and strong integration with ESLint tooling ecosystem.
63
-
64
- - Good, because prevents common AST manipulation errors at compile time
65
- - Good, because provides excellent IDE autocompletion for ESLint Rule API
66
- - Good, because enables type-safe rule configuration and options validation
67
- - Good, because integrates seamlessly with @typescript-eslint/utils
68
- - Good, because self-documents code through type annotations
69
- - Good, because supports advanced refactoring capabilities
70
- - Good, because aligns with modern ESLint plugin development practices
71
- - Neutral, because requires TypeScript knowledge from contributors
72
- - Bad, because adds compilation step to development workflow
73
- - Bad, because increases initial project setup complexity
74
-
75
- ### JavaScript with JSDoc type annotations
76
-
77
- JavaScript with JSDoc comments provides some type hints while maintaining simpler build process.
78
-
79
- - Good, because no additional build step required
80
- - Good, because familiar to JavaScript-only developers
81
- - Good, because provides basic type hints through comments
82
- - Neutral, because some IDE support for JSDoc types
83
- - Bad, because no compile-time error checking
84
- - Bad, because JSDoc types are not enforced or validated
85
- - Bad, because limited integration with @typescript-eslint type definitions
86
- - Bad, because refactoring support is significantly weaker
87
- - Bad, because AST manipulation errors only discovered at runtime
88
-
89
- ### Plain JavaScript without type annotations
90
-
91
- Pure JavaScript implementation with no type system support.
92
-
93
- - Good, because simplest possible setup
94
- - Good, because no build step required
95
- - Good, because no TypeScript learning curve
96
- - Bad, because no type safety for complex AST manipulation
97
- - Bad, because no IDE autocompletion for ESLint APIs
98
- - Bad, because all errors discovered at runtime during testing
99
- - Bad, because difficult to maintain as complexity grows
100
- - Bad, because no integration benefits with TypeScript ecosystem
101
- - Bad, because poor refactoring support
102
-
103
- ## More Information
104
-
105
- This decision aligns with REQ-TYPESCRIPT in story 001.0-DEV-PLUGIN-SETUP. The implementation should use @typescript-eslint/utils for AST parsing utilities and follow TypeScript ESLint plugin development patterns. The decision should be re-evaluated if TypeScript compilation becomes a significant bottleneck or if the team expertise changes significantly.
106
-
107
- Related resources:
108
-
109
- - [ESLint Plugin Development Guide](https://eslint.org/docs/latest/extend/plugins)
110
- - [@typescript-eslint/utils Documentation](https://typescript-eslint.io/packages/utils/)
111
- - [TypeScript ESLint Plugin Examples](https://github.com/typescript-eslint/typescript-eslint/tree/main/packages/eslint-plugin/src/rules)
@@ -1,137 +0,0 @@
1
- ---
2
- status: "accepted"
3
- date: 2025-11-15
4
- decision-makers: [Development Team]
5
- consulted:
6
- [
7
- ESLint Community Best Practices,
8
- Jest Documentation,
9
- Vitest Documentation,
10
- TypeScript ESLint Testing Patterns,
11
- ]
12
- informed: [Project Stakeholders, Future Contributors]
13
- ---
14
-
15
- # Use Jest for ESLint Plugin Testing
16
-
17
- ## Context and Problem Statement
18
-
19
- When developing an ESLint plugin in TypeScript that outputs CommonJS modules, we need to choose a testing framework for validating ESLint rules. The plugin will use ESLint's RuleTester for rule validation and needs to test complex AST manipulation logic. The choice of testing framework affects development experience, compatibility with ESLint tooling, and alignment with ecosystem practices, particularly given the CommonJS output requirement and ESLint-specific testing patterns.
20
-
21
- ## Decision Drivers
22
-
23
- - Compatibility with ESLint's RuleTester and rule testing patterns
24
- - Support for CommonJS module testing (plugin output format)
25
- - Integration with TypeScript source code testing
26
- - Alignment with ESLint plugin development ecosystem practices
27
- - Developer experience for writing and debugging tests
28
- - Performance and reliability of test execution
29
- - Support for ESLint-specific testing utilities and patterns
30
- - Community adoption and long-term maintenance
31
-
32
- ## Considered Options
33
-
34
- - Jest with TypeScript support
35
- - Vitest with CommonJS configuration
36
- - Node.js built-in test runner with TypeScript
37
-
38
- ## Decision Outcome
39
-
40
- Chosen option: "Jest with TypeScript support", because it provides native CommonJS support essential for ESLint plugin testing, seamless integration with ESLint's RuleTester, follows established patterns in the ESLint ecosystem, and offers superior tooling for ESLint rule development without requiring complex configuration workarounds.
41
-
42
- ### Consequences
43
-
44
- - Good, because Jest works natively with CommonJS modules (no configuration needed)
45
- - Good, because ESLint's RuleTester integrates seamlessly with Jest
46
- - Good, because follows patterns used by @typescript-eslint and most ESLint plugins
47
- - Good, because excellent TypeScript support through ts-jest
48
- - Good, because mature ecosystem with extensive ESLint testing examples
49
- - Good, because built-in mocking capabilities useful for file system operations
50
- - Good, because snapshot testing can validate error message formats
51
- - Bad, because Jest is slightly heavier than newer alternatives
52
- - Bad, because not as fast as Vitest for some use cases
53
- - Neutral, because requires ts-jest dependency for TypeScript support
54
-
55
- ### Confirmation
56
-
57
- Implementation compliance will be confirmed through:
58
-
59
- - Jest configuration properly set up with ts-jest transformer
60
- - ESLint RuleTester tests run successfully without module resolution errors
61
- - All tests pass in CI/CD pipeline using Jest
62
- - package.json scripts include Jest-based testing commands
63
- - Test files use Jest APIs and follow Jest patterns
64
- - TypeScript source files can be tested directly without compilation issues
65
-
66
- ## Pros and Cons of the Options
67
-
68
- ### Jest with TypeScript support
69
-
70
- Jest is the most widely used testing framework in the ESLint ecosystem with mature TypeScript integration.
71
-
72
- - Good, because native CommonJS support without configuration
73
- - Good, because ESLint's RuleTester designed to work with Jest
74
- - Good, because extensive use in @typescript-eslint project provides proven patterns
75
- - Good, because excellent TypeScript support via ts-jest
76
- - Good, because mature snapshot testing for validating rule outputs
77
- - Good, because built-in mocking for testing file system operations
78
- - Good, because extensive community knowledge and examples
79
- - Good, because comprehensive assertion library and testing utilities
80
- - Neutral, because larger bundle size than alternatives
81
- - Neutral, because slower startup than Vitest
82
- - Bad, because not as modern as newer testing frameworks
83
-
84
- ### Vitest with CommonJS configuration
85
-
86
- Vitest is a modern testing framework built on Vite with fast execution but requires configuration for CommonJS.
87
-
88
- - Good, because very fast test execution and hot reloading
89
- - Good, because modern API and excellent DX
90
- - Good, because good TypeScript support out of the box
91
- - Good, because lighter weight than Jest
92
- - Neutral, because growing but smaller community than Jest
93
- - Bad, because requires complex configuration for CommonJS compatibility
94
- - Bad, because ESLint RuleTester integration not well-documented
95
- - Bad, because fewer examples in ESLint plugin development
96
- - Bad, because potential issues with CommonJS module transformation
97
- - Bad, because ESM-first design conflicts with CommonJS requirement
98
-
99
- ### Node.js built-in test runner with TypeScript
100
-
101
- Node.js native test runner provides minimal testing without external dependencies.
102
-
103
- - Good, because no external testing dependencies
104
- - Good, because fast startup and execution
105
- - Good, because growing support in Node.js ecosystem
106
- - Neutral, because basic feature set may be sufficient for simple tests
107
- - Bad, because no built-in TypeScript support (requires compilation)
108
- - Bad, because no established patterns for ESLint rule testing
109
- - Bad, because limited assertion library (requires additional dependencies)
110
- - Bad, because no built-in mocking capabilities
111
- - Bad, because minimal tooling and IDE integration
112
- - Bad, because ESLint RuleTester compatibility unknown
113
-
114
- ## More Information
115
-
116
- This decision supports REQ-TEST-SETUP in story 001.0-DEV-PLUGIN-SETUP. The implementation should use ts-jest for TypeScript compilation and follow patterns established by @typescript-eslint project. ESLint's RuleTester should be the primary tool for rule validation testing.
117
-
118
- Key implementation considerations:
119
-
120
- - Use ts-jest transformer for TypeScript source testing
121
- - Configure Jest to handle both source TypeScript and compiled CommonJS
122
- - Follow ESLint RuleTester patterns for rule validation
123
- - Include snapshot testing for error message validation
124
- - Set up proper mocking for file system operations
125
-
126
- This decision should be re-evaluated if:
127
-
128
- - ESLint ecosystem moves away from Jest as standard
129
- - CommonJS requirement changes for ESLint plugins
130
- - Vitest significantly improves CommonJS support
131
- - Team expertise with Jest becomes insufficient
132
-
133
- Related resources:
134
-
135
- - [ESLint RuleTester Documentation](https://eslint.org/docs/latest/integrate/nodejs-api#ruletester)
136
- - [@typescript-eslint Testing Patterns](https://github.com/typescript-eslint/typescript-eslint/tree/main/packages/eslint-plugin/tests)
137
- - [Jest with TypeScript Guide](https://jestjs.io/docs/getting-started#using-typescript)
@@ -1,48 +0,0 @@
1
- ---
2
- status: "accepted"
3
- date: 2025-11-16
4
- decision-makers: [Development Team]
5
- consulted: [Implementation Plan, ESLint Documentation]
6
- informed: [All Contributors]
7
- ---
8
-
9
- # 003-Code Quality Ratcheting Plan
10
-
11
- ## Context and Decision Drivers
12
-
13
- The project currently enforces maintainability through ESLint `max-lines-per-function` and `max-lines` rules with thresholds set to 200 lines/function and 1000 lines/file. These loose thresholds present technical debt and allow overly large functions and files, which can hinder readability, maintainability, and increase complexity over time.
14
-
15
- ## Considered Options
16
-
17
- 1. Adopt strict industry-standard thresholds immediately (e.g., 100 lines/function, 500 lines/file).
18
- 2. Maintain the current loose thresholds indefinitely.
19
- 3. Implement an incremental ratcheting plan to gradually reduce thresholds over multiple sprints.
20
-
21
- ## Decision Outcome
22
-
23
- We will implement option 3: an incremental ratcheting plan to gradually reduce the ESLint thresholds:
24
-
25
- - **Sprint 0 (Now)**: Reduce `max-lines-per-function` to 150 and `max-lines` to 800.
26
- - **Sprint 2 (Completed 2025-11-16)**: Reduce `max-lines-per-function` to 120 and `max-lines` to 600.
27
- - **Sprint 4**: Reduce `max-lines-per-function` to 100 and `max-lines` to 500.
28
-
29
- Automation:
30
-
31
- - Update the ESLint configuration to enforce the new thresholds immediately.
32
- - Configure the CI pipeline to fail on any new violations of these rules.
33
- - Document the ratcheting schedule in this ADR and revisit the plan at each milestone.
34
-
35
- ## Consequences
36
-
37
- - Ensures maintainability improves in manageable increments, reducing developer overhead per sprint.
38
- - Provides clear visibility into the schedule and expectations for code size reductions.
39
- - Allows refactoring efforts to be planned and executed incrementally, avoiding large-scale rewrites.
40
- - Guarantees continuous improvement by automating enforcement in CI.
41
-
42
- ## Future Review
43
-
44
- At the end of each milestone sprint, the team will:
45
-
46
- - Review existing violations.
47
- - Refactor code to comply with the new thresholds.
48
- - Update this ADR if any adjustments to the schedule are required.
@@ -1,196 +0,0 @@
1
- ---
2
- status: "superseded"
3
- date: 2025-11-17
4
- decision-makers: [Development Team]
5
- consulted:
6
- [
7
- npm Documentation,
8
- GitHub Actions Best Practices,
9
- Semantic Versioning Specification,
10
- ]
11
- informed: [Project Stakeholders, CI/CD Pipeline Maintainers]
12
- superseded-by: "006-semantic-release-for-automated-publishing"
13
- superseded-date: "2025-11-17"
14
- ---
15
-
16
- # Automated Version Bumping for CI/CD Publishing
17
-
18
- ## Context and Problem Statement
19
-
20
- The current CI/CD pipeline attempts to publish the package to npm on every push to the main branch, but lacks any mechanism to automatically increment the package version. This causes publish failures when the same version number already exists on npm, as npm does not allow republishing the same version. The pipeline fails with errors like "You cannot publish over the previously published versions" or similar npm publish conflicts.
21
-
22
- Currently, version bumping requires manual intervention through direct package.json edits, which is error-prone, interrupts the automated delivery flow, and creates a disconnect between the continuous integration process and package publishing. This breaks the principle of continuous delivery and creates friction in the development workflow.
23
-
24
- ## Decision Drivers
25
-
26
- - Need for reliable automated publishing without manual intervention
27
- - Prevention of npm publish failures due to version conflicts
28
- - Alignment with semantic versioning principles for clear change communication
29
- - Integration with existing CI/CD pipeline and GitHub workflow
30
- - Maintainability of version history and changelog automation
31
- - Support for different types of releases (patch, minor, major)
32
- - Traceability of version changes to specific commits or pull requests
33
- - Minimal friction for developers while maintaining version discipline
34
-
35
- ## Considered Options
36
-
37
- - npm version command with automated execution in CI/CD
38
- - Semantic Release with automated version detection
39
- - Manual version bumping with CI/CD workflow triggers
40
- - Version bumping through GitHub Actions with npm version
41
-
42
- ## Decision Outcome
43
-
44
- Chosen option: "Version Increment Without Git Commits", because it eliminates CI/CD loop complexity, requires no git write permissions, solves the immediate npm publish failures, and provides the simplest implementation while maintaining full automation.
45
-
46
- ### Implementation Strategy
47
-
48
- The CI/CD pipeline will use in-memory version increments without git write-back:
49
-
50
- 1. **Pre-publish Version Check**: Before attempting to publish, check if the current package.json version already exists on npm using `npm view eslint-plugin-traceability@<version>`
51
- 2. **In-Memory Version Increment**: If the version exists on npm, increment the patch version in the pipeline workspace using `npm version patch --no-git-tag-version`
52
- 3. **Immediate Publish**: Proceed with npm publish using the incremented version without any git operations
53
- 4. **Pipeline Logging**: Log the version increment action for visibility and debugging
54
- 5. **No Git Write-Back**: The incremented version exists only in the pipeline workspace and is never committed back to the repository
55
-
56
- ### Primary Approach Considered
57
-
58
- **Git Write-Back with Version Commits**: Increment version in pipeline, publish to npm, then commit version changes and create git tags with `[skip ci]` to prevent recursion. This approach was rejected due to complexity concerns including git write permissions, infinite loop prevention, post-publish failure handling, and potential race conditions in concurrent pipeline runs.
59
-
60
- ### Consequences
61
-
62
- - Good, because prevents all npm publish failures due to version conflicts
63
- - Good, because maintains fully automated delivery without any manual intervention
64
- - Good, because eliminates infinite CI/CD loop risks entirely
65
- - Good, because requires no git write permissions or credentials in CI/CD
66
- - Good, because uses standard npm tooling that developers understand
67
- - Good, because simplest possible implementation with minimal failure modes
68
- - Good, because each pipeline run is completely independent
69
- - Good, because immediate resolution to publish failures with no complexity overhead
70
- - Neutral, because package.json version may lag behind published npm version
71
- - Neutral, because developers can check published version via `npm view eslint-plugin-traceability version`
72
- - Bad, because does not automatically determine semantic version type (major/minor/patch)
73
- - Bad, because no automatic git tags or version history created
74
-
75
- ### Confirmation
76
-
77
- Implementation compliance will be confirmed through:
78
-
79
- - CI/CD pipeline successfully publishes without version conflicts
80
- - No npm publish failures due to existing version numbers
81
- - No git write operations or credentials required in CI/CD
82
- - No infinite pipeline loops or `[skip ci]` complexity needed
83
- - Pipeline logs clearly show when version increments occur
84
- - Published npm versions can be verified via `npm view eslint-plugin-traceability versions`
85
- - No manual intervention required for routine publishing
86
-
87
- ## Pros and Cons of the Options
88
-
89
- ### Version Increment Without Git Commits
90
-
91
- In-memory version increments during pipeline execution without any git write-back operations.
92
-
93
- - Good, because eliminates all CI/CD loop complexity and infinite recursion risks
94
- - Good, because requires no git write permissions or credentials in CI/CD environment
95
- - Good, because simplest possible implementation with minimal failure modes
96
- - Good, because each pipeline run is completely independent with no race conditions
97
- - Good, because immediate resolution to npm publish failures
98
- - Good, because uses standard npm version tooling familiar to developers
99
- - Good, because no complex error handling for git operations required
100
- - Neutral, because package.json version may not reflect latest published version
101
- - Neutral, because published version always discoverable via npm registry
102
- - Bad, because no automatic git tags created for release tracking
103
- - Bad, because requires manual version management for major/minor releases
104
- - Bad, because no automated version commit history
105
-
106
- ### Git Write-Back with Version Commits
107
-
108
- Increment version in pipeline, publish to npm, then commit version changes and create git tags.
109
-
110
- - Good, because creates proper git tags and version commits automatically
111
- - Good, because maintains package.json synchronization with published versions
112
- - Good, because provides complete version history in git repository
113
- - Good, because allows for automated CHANGELOG.md updates
114
- - Good, because follows traditional npm ecosystem patterns
115
- - Neutral, because requires configuration of git credentials in CI/CD
116
- - Neutral, because creates automated commits with CI skip directives
117
- - Bad, because requires complex infinite loop prevention with `[skip ci]`
118
- - Bad, because potential for git write failures after successful npm publish
119
- - Bad, because introduces race conditions in concurrent pipeline runs
120
- - Bad, because requires git write permissions and credential management
121
- - Bad, because adds multiple failure modes beyond the core publish operation
122
-
123
- ### Semantic Release with automated version detection
124
-
125
- Automated semantic versioning based on commit message analysis and release automation.
126
-
127
- - Good, because fully automated semantic version determination
128
- - Good, because analyzes commit messages for version type
129
- - Good, because comprehensive release note generation
130
- - Good, because follows semantic versioning specification strictly
131
- - Good, because popular in open source ecosystem
132
- - Neutral, because requires standardized commit message format
133
- - Bad, because adds significant complexity to CI/CD pipeline
134
- - Bad, because requires team discipline for commit message formatting
135
- - Bad, because may be overkill for the current project size
136
- - Bad, because introduces external dependency on semantic-release tool
137
- - Bad, because harder to override for exceptional cases
138
-
139
- ### Manual version bumping with CI/CD workflow triggers
140
-
141
- Requiring manual version increments before publishing with workflow validation.
142
-
143
- - Good, because provides full developer control over versioning
144
- - Good, because ensures deliberate version decisions
145
- - Good, because no automated commits or git history noise
146
- - Good, because simple to understand and implement
147
- - Neutral, because requires developer discipline for version management
148
- - Bad, because breaks continuous delivery principle
149
- - Bad, because requires manual intervention for every release
150
- - Bad, because prone to human error and forgotten version bumps
151
- - Bad, because does not solve the original npm publish failure problem
152
- - Bad, because creates friction in development workflow
153
-
154
- ## More Information
155
-
156
- This decision addresses the immediate CI/CD publish failures with the simplest possible solution that eliminates complexity while maintaining full automation. The in-memory version increment approach provides immediate relief from npm publish conflicts without introducing git write-back complexity.
157
-
158
- Key implementation details:
159
-
160
- ```yaml
161
- - name: Prepare version for publish
162
- run: |
163
- CURRENT_VERSION=$(node -p "require('./package.json').version")
164
- echo "Current package.json version: $CURRENT_VERSION"
165
-
166
- # Check if this version exists on npm
167
- if npm view eslint-plugin-traceability@$CURRENT_VERSION version >/dev/null 2>&1; then
168
- echo "Version $CURRENT_VERSION already exists on npm, incrementing..."
169
- npm version patch --no-git-tag-version
170
- NEW_VERSION=$(node -p "require('./package.json').version")
171
- echo "Bumped version to: $NEW_VERSION"
172
- else
173
- echo "Version $CURRENT_VERSION is available, proceeding with publish"
174
- fi
175
-
176
- - name: Publish package
177
- run: npm publish --access public
178
- ```
179
-
180
- Implementation considerations:
181
-
182
- - No git credentials or write permissions required in CI/CD
183
- - Version increments are logged for visibility and debugging
184
- - Each pipeline run operates independently with no side effects
185
- - Published versions remain discoverable via `npm view eslint-plugin-traceability versions`
186
- - Manual version bumps for major/minor releases can still be done via git commits
187
- - Future migration to git write-back approach remains possible if needed
188
-
189
- This decision should be re-evaluated if:
190
-
191
- - Package.json/npm version drift becomes problematic for development workflow
192
- - Automatic git tagging becomes a requirement for release management
193
- - The team adopts semantic versioning discipline requiring commit message analysis
194
- - Integration with automated changelog generation becomes necessary
195
-
196
- The simplicity of this approach allows for easy migration to more complex solutions later while solving the immediate problem with minimal risk and complexity.