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.
Files changed (110) hide show
  1. package/CHANGELOG.md +5 -5
  2. package/README.md +28 -29
  3. package/SECURITY.md +135 -0
  4. package/lib/src/index.d.ts +6 -35
  5. package/lib/src/index.js +8 -5
  6. package/lib/src/maintenance/cli.js +12 -16
  7. package/lib/src/maintenance/detect.js +28 -1
  8. package/lib/src/rules/helpers/require-story-io.d.ts +2 -2
  9. package/lib/src/rules/helpers/require-story-io.js +13 -13
  10. package/lib/src/rules/helpers/valid-annotation-format-internal.d.ts +2 -2
  11. package/lib/src/rules/helpers/valid-annotation-format-internal.js +3 -3
  12. package/lib/src/rules/helpers/valid-annotation-utils.d.ts +5 -0
  13. package/lib/src/rules/helpers/valid-annotation-utils.js +43 -5
  14. package/lib/src/rules/helpers/valid-implements-utils.d.ts +11 -11
  15. package/lib/src/rules/helpers/valid-implements-utils.js +11 -11
  16. package/lib/src/rules/helpers/valid-story-reference-helpers.js +19 -0
  17. package/lib/src/rules/prefer-implements-annotation.d.ts +7 -7
  18. package/lib/src/rules/prefer-implements-annotation.js +21 -21
  19. package/lib/src/rules/valid-annotation-format.js +50 -24
  20. package/lib/src/rules/valid-req-reference.js +9 -9
  21. package/lib/src/utils/annotation-checker.js +3 -1
  22. package/lib/src/utils/reqAnnotationDetection.d.ts +2 -2
  23. package/lib/src/utils/reqAnnotationDetection.js +28 -28
  24. package/lib/tests/config/flat-config-presets-integration.test.d.ts +1 -0
  25. package/lib/tests/config/flat-config-presets-integration.test.js +75 -0
  26. package/lib/tests/maintenance/batch.test.js +11 -11
  27. package/lib/tests/maintenance/cli.test.js +34 -27
  28. package/lib/tests/maintenance/report.test.js +7 -7
  29. package/lib/tests/plugin-default-export-and-configs.test.js +0 -2
  30. package/lib/tests/rules/prefer-implements-annotation.test.js +48 -15
  31. package/lib/tests/rules/require-branch-annotation.test.js +15 -36
  32. package/lib/tests/rules/require-req-annotation.test.js +31 -104
  33. package/lib/tests/rules/require-story-annotation.test.js +3 -3
  34. package/lib/tests/rules/require-story-io-behavior.test.js +2 -7
  35. package/lib/tests/rules/require-story-io.edgecases.test.js +2 -7
  36. package/lib/tests/rules/require-story-visitors-edgecases.test.js +8 -8
  37. package/lib/tests/rules/valid-annotation-format.test.js +23 -23
  38. package/lib/tests/rules/valid-req-reference.test.js +9 -9
  39. package/lib/tests/rules/valid-story-reference.test.js +4 -43
  40. package/lib/tests/utils/annotation-checker.test.js +2 -6
  41. package/lib/tests/utils/fsTestHelpers.d.ts +7 -0
  42. package/lib/tests/utils/fsTestHelpers.js +26 -0
  43. package/lib/tests/utils/ioTestHelpers.d.ts +7 -0
  44. package/lib/tests/utils/ioTestHelpers.js +24 -0
  45. package/lib/tests/utils/temp-dir-helpers.d.ts +14 -0
  46. package/lib/tests/utils/temp-dir-helpers.js +61 -0
  47. package/package.json +8 -7
  48. package/user-docs/api-reference.md +37 -20
  49. package/user-docs/eslint-9-setup-guide.md +89 -6
  50. package/user-docs/migration-guide.md +37 -21
  51. package/docs/ci-cd-pipeline.md +0 -224
  52. package/docs/cli-integration.md +0 -22
  53. package/docs/code-quality-refactor-opportunities-2025-12-03.md +0 -78
  54. package/docs/config-presets.md +0 -38
  55. package/docs/conventional-commits-guide.md +0 -185
  56. package/docs/custom-rules-development-guide.md +0 -659
  57. package/docs/decisions/0001-allow-dynamic-require-for-built-plugins.md +0 -26
  58. package/docs/decisions/001-typescript-for-eslint-plugin.accepted.md +0 -111
  59. package/docs/decisions/002-jest-for-eslint-testing.accepted.md +0 -137
  60. package/docs/decisions/003-code-quality-ratcheting-plan.md +0 -48
  61. package/docs/decisions/004-automated-version-bumping-for-ci-cd.md +0 -196
  62. package/docs/decisions/005-github-actions-validation-tooling.accepted.md +0 -144
  63. package/docs/decisions/006-semantic-release-for-automated-publishing.accepted.md +0 -227
  64. package/docs/decisions/007-github-releases-over-changelog.accepted.md +0 -216
  65. package/docs/decisions/008-ci-audit-flags.accepted.md +0 -60
  66. package/docs/decisions/009-security-focused-lint-rules.accepted.md +0 -64
  67. package/docs/decisions/010-implements-annotation-for-multi-story-requirements.proposed.md +0 -184
  68. package/docs/decisions/adr-0001-console-usage-for-cli-guards.md +0 -190
  69. package/docs/decisions/adr-accept-dev-dep-risk-glob.md +0 -40
  70. package/docs/decisions/adr-commit-branch-tests.md +0 -54
  71. package/docs/decisions/adr-maintenance-cli-interface.md +0 -140
  72. package/docs/decisions/adr-pre-push-parity.md +0 -112
  73. package/docs/decisions/code-quality-ratcheting-plan.md +0 -53
  74. package/docs/dependency-health.md +0 -238
  75. package/docs/eslint-9-setup-guide.md +0 -517
  76. package/docs/eslint-plugin-development-guide.md +0 -487
  77. package/docs/functionality-coverage-2025-12-03.md +0 -250
  78. package/docs/jest-testing-guide.md +0 -100
  79. package/docs/rules/prefer-implements-annotation.md +0 -219
  80. package/docs/rules/require-branch-annotation.md +0 -71
  81. package/docs/rules/require-req-annotation.md +0 -203
  82. package/docs/rules/require-story-annotation.md +0 -159
  83. package/docs/rules/valid-annotation-format.md +0 -418
  84. package/docs/rules/valid-req-reference.md +0 -153
  85. package/docs/rules/valid-story-reference.md +0 -120
  86. package/docs/security-incidents/2025-11-17-glob-cli-incident.md +0 -45
  87. package/docs/security-incidents/2025-11-18-brace-expansion-redos.md +0 -45
  88. package/docs/security-incidents/2025-11-18-bundled-dev-deps-accepted-risk.md +0 -93
  89. package/docs/security-incidents/2025-11-18-tar-race-condition.md +0 -43
  90. package/docs/security-incidents/2025-12-03-dependency-health-review.md +0 -58
  91. package/docs/security-incidents/SECURITY-INCIDENT-2025-11-18-semantic-release-bundled-npm.known-error.md +0 -104
  92. package/docs/security-incidents/SECURITY-INCIDENT-TEMPLATE.md +0 -37
  93. package/docs/security-incidents/dependency-override-rationale.md +0 -57
  94. package/docs/security-incidents/dev-deps-high.json +0 -116
  95. package/docs/security-incidents/handling-procedure.md +0 -54
  96. package/docs/stories/001.0-DEV-PLUGIN-SETUP.story.md +0 -92
  97. package/docs/stories/002.0-DEV-ESLINT-CONFIG.story.md +0 -82
  98. package/docs/stories/003.0-DEV-FUNCTION-ANNOTATIONS.story.md +0 -112
  99. package/docs/stories/004.0-DEV-BRANCH-ANNOTATIONS.story.md +0 -153
  100. package/docs/stories/005.0-DEV-ANNOTATION-VALIDATION.story.md +0 -138
  101. package/docs/stories/006.0-DEV-FILE-VALIDATION.story.md +0 -144
  102. package/docs/stories/007.0-DEV-ERROR-REPORTING.story.md +0 -163
  103. package/docs/stories/008.0-DEV-AUTO-FIX.story.md +0 -150
  104. package/docs/stories/009.0-DEV-MAINTENANCE-TOOLS.story.md +0 -117
  105. package/docs/stories/010.0-DEV-DEEP-VALIDATION.story.md +0 -124
  106. package/docs/stories/010.1-DEV-CONFIGURABLE-PATTERNS.story.md +0 -149
  107. package/docs/stories/010.2-DEV-MULTI-STORY-SUPPORT.story.md +0 -216
  108. package/docs/stories/010.3-DEV-MIGRATE-TO-IMPLEMENTS.story.md +0 -236
  109. package/docs/stories/developer-story.map.md +0 -120
  110. package/docs/ts-jest-presets-guide.md +0 -548
@@ -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.
@@ -1,144 +0,0 @@
1
- ---
2
- status: "accepted"
3
- date: 2025-11-17
4
- decision-makers: [Development Team]
5
- consulted:
6
- [
7
- GitHub Actions Documentation,
8
- Super-Linter Community,
9
- actionlint Documentation,
10
- ]
11
- informed: [Project Contributors, CI/CD Pipeline Maintainers]
12
- ---
13
-
14
- # GitHub Actions Validation Tooling Selection
15
-
16
- ## Context and Problem Statement
17
-
18
- The project uses GitHub Actions for CI/CD workflows defined in `.github/workflows/`. To prevent broken GitHub Actions files from being pushed to the repository, we need to implement pre-commit validation for GitHub Actions YAML files. This validation should catch syntax errors, invalid action references, and misconfigured job dependencies before they are committed, as broken workflow files could prevent CI/CD from running at all.
19
-
20
- ## Decision Drivers
21
-
22
- - Need for pre-commit validation to prevent broken GitHub Actions files from being pushed
23
- - Performance requirements for fast local development workflows
24
- - Prevention of workflow files that would break CI/CD execution
25
- - Integration with existing development tools and pre-commit hooks
26
- - Maintainability and configuration simplicity
27
- - Resource efficiency for local development environments
28
-
29
- ## Considered Options
30
-
31
- - actionlint for pre-commit hooks only
32
- - actionlint for both pre-commit and CI/CD
33
- - Super-Linter for pre-commit hooks
34
- - GitHub's built-in validation only
35
-
36
- ## Decision Outcome
37
-
38
- Chosen option: "actionlint for pre-commit hooks only", because it prevents broken GitHub Actions files from being pushed while maintaining fast local development workflow. Once files reach CI/CD, if the workflow runs successfully, the files are valid by definition.
39
-
40
- ### Consequences
41
-
42
- - Good, because actionlint provides fast pre-commit validation without container overhead
43
- - Good, because prevents broken GitHub Actions files from being pushed
44
- - Good, because specifically designed for GitHub Actions validation
45
- - Good, because simple configuration and maintenance
46
- - Good, because no Docker dependencies for local development
47
- - Good, because excellent performance for pre-commit hooks
48
- - Good, because integrates seamlessly with existing Husky-based pre-commit hooks
49
- - Neutral, because CI/CD validation is unnecessary if workflows execute successfully
50
- - Bad, because limited to GitHub Actions validation only
51
- - Bad, because no security vulnerability detection in pre-commit phase
52
-
53
- ### Confirmation
54
-
55
- Implementation compliance will be confirmed through:
56
-
57
- - actionlint added to Husky pre-commit hook in `.husky/pre-commit`
58
- - Pre-commit hook blocks commits with GitHub Actions validation errors
59
- - actionlint configured to validate files in `.github/workflows/`
60
- - Documentation updated to explain Husky-based pre-commit validation approach
61
-
62
- ### Implementation Approach
63
-
64
- actionlint will be integrated into existing Husky-based pre-commit hooks by:
65
-
66
- - Installing actionlint as a development dependency
67
- - Adding actionlint validation to `.husky/pre-commit` hook
68
- - Configuring actionlint to check `.github/workflows/*.yml` files
69
- - Documenting the validation process for contributors
70
-
71
- ## Pros and Cons of the Options
72
-
73
- ### actionlint for pre-commit hooks only
74
-
75
- Lightweight, focused pre-commit validation to prevent broken GitHub Actions files.
76
-
77
- - Good, because fast execution without container overhead
78
- - Good, because specifically designed for GitHub Actions validation
79
- - Good, because no Docker dependencies for local development
80
- - Good, because simple configuration and maintenance
81
- - Good, because excellent performance for pre-commit hooks
82
- - Good, because prevents broken workflow files from being pushed
83
- - Good, because minimal tooling - only runs where validation is needed
84
- - Neutral, because focused scope reduces complexity
85
- - Neutral, because CI/CD validation unnecessary if workflows execute successfully
86
- - Bad, because limited to GitHub Actions validation only
87
- - Bad, because no security vulnerability detection in pre-commit phase
88
-
89
- ### actionlint for both pre-commit and CI/CD
90
-
91
- Validation in both development and CI/CD environments.
92
-
93
- - Good, because fast execution in all environments
94
- - Good, because specifically designed for GitHub Actions
95
- - Good, because consistent validation across environments
96
- - Neutral, because focused scope reduces complexity
97
- - Bad, because unnecessary duplication - CI/CD execution validates workflow correctness
98
- - Bad, because adds CI/CD overhead for validation that's already proven by execution
99
- - Bad, because limited to GitHub Actions validation only
100
-
101
- ### Super-Linter for pre-commit hooks
102
-
103
- Comprehensive linting solution for pre-commit validation.
104
-
105
- - Good, because comprehensive validation including security checks
106
- - Good, because validates multiple file types beyond GitHub Actions
107
- - Neutral, because well-maintained and widely adopted
108
- - Bad, because container overhead makes pre-commit hooks slow
109
- - Bad, because heavy resource usage for simple syntax checking
110
- - Bad, because Docker dependency required for local development
111
- - Bad, because not optimized for frequent pre-commit execution
112
- - Bad, because overkill for the specific problem of preventing broken workflow files
113
-
114
- ### GitHub's built-in validation only
115
-
116
- Rely solely on GitHub's native workflow validation.
117
-
118
- - Good, because no additional tooling or configuration required
119
- - Good, because automatically available in GitHub interface
120
- - Good, because validated by the same system that executes workflows
121
- - Neutral, because basic validation is always performed
122
- - Bad, because no pre-commit validation for early error detection
123
- - Bad, because broken files can be pushed, preventing CI/CD execution
124
- - Bad, because errors only discovered after push to repository
125
- - Bad, because no local development feedback
126
-
127
- ## More Information
128
-
129
- This decision focuses on solving the specific problem of preventing broken GitHub Actions files from being pushed to the repository. If CI/CD workflows execute successfully, the files are validated by definition - there's no need for redundant validation in the CI/CD pipeline itself.
130
-
131
- actionlint configuration should be added to the existing Husky pre-commit hook in `.husky/pre-commit`, targeting `.github/workflows/*.yml` files to catch syntax and configuration errors before commit.
132
-
133
- The decision should be re-evaluated if:
134
-
135
- - Security vulnerability detection becomes a requirement for pre-commit validation
136
- - Comprehensive multi-language linting becomes necessary for pre-commit
137
- - Alternative tools with better GitHub Actions-specific features emerge
138
- - The problem scope expands beyond preventing broken workflow files
139
-
140
- Related resources:
141
-
142
- - [actionlint Documentation](https://github.com/rhymond/actionlint)
143
- - [GitHub Actions Workflow Syntax](https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions)
144
- - [Husky Documentation](https://typicode.github.io/husky/)