eslint-plugin-traceability 1.1.0 → 1.1.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/lib/src/index.d.ts +80 -0
- package/lib/src/index.js +58 -0
- package/lib/src/maintenance/batch.d.ts +16 -0
- package/lib/src/maintenance/batch.js +28 -0
- package/lib/src/maintenance/detect.d.ts +6 -0
- package/lib/src/maintenance/detect.js +69 -0
- package/lib/src/maintenance/index.js +22 -0
- package/lib/src/maintenance/report.d.ts +7 -0
- package/lib/src/maintenance/report.js +17 -0
- package/lib/src/maintenance/update.d.ts +6 -0
- package/lib/src/maintenance/update.js +67 -0
- package/lib/src/maintenance/utils.d.ts +6 -0
- package/lib/src/maintenance/utils.js +64 -0
- package/lib/src/rules/require-branch-annotation.d.ts +7 -0
- package/lib/src/rules/require-branch-annotation.js +111 -0
- package/lib/src/rules/require-req-annotation.d.ts +7 -0
- package/lib/src/rules/require-req-annotation.js +38 -0
- package/lib/src/rules/require-story-annotation.d.ts +7 -0
- package/lib/src/rules/require-story-annotation.js +50 -0
- package/lib/src/rules/valid-annotation-format.d.ts +10 -0
- package/lib/src/rules/valid-annotation-format.js +60 -0
- package/lib/src/rules/valid-req-reference.d.ts +3 -0
- package/lib/src/rules/valid-req-reference.js +104 -0
- package/lib/src/rules/valid-story-reference.d.ts +3 -0
- package/lib/src/rules/valid-story-reference.js +168 -0
- package/lib/tests/fixtures/stale/example.d.ts +0 -0
- package/{tests/fixtures/stale/example.ts → lib/tests/fixtures/stale/example.js} +1 -0
- package/lib/tests/fixtures/update/example.d.ts +0 -0
- package/{tests/fixtures/update/example.ts → lib/tests/fixtures/update/example.js} +1 -0
- package/lib/tests/fixtures/valid-annotations/example.d.ts +0 -0
- package/{tests/fixtures/valid-annotations/example.ts → lib/tests/fixtures/valid-annotations/example.js} +1 -0
- package/lib/tests/maintenance/batch.test.d.ts +1 -0
- package/lib/tests/maintenance/batch.test.js +79 -0
- package/lib/tests/maintenance/detect-isolated.test.d.ts +1 -0
- package/lib/tests/maintenance/detect-isolated.test.js +95 -0
- package/lib/tests/maintenance/detect.test.d.ts +1 -0
- package/lib/tests/maintenance/detect.test.js +23 -0
- package/lib/tests/maintenance/report.test.d.ts +1 -0
- package/lib/tests/maintenance/report.test.js +67 -0
- package/lib/tests/maintenance/update-isolated.test.d.ts +1 -0
- package/lib/tests/maintenance/update-isolated.test.js +66 -0
- package/lib/tests/maintenance/update.test.d.ts +1 -0
- package/lib/tests/maintenance/update.test.js +26 -0
- package/lib/tests/plugin-default-export-and-configs.test.d.ts +1 -0
- package/lib/tests/plugin-default-export-and-configs.test.js +72 -0
- package/lib/tests/plugin-setup.test.d.ts +1 -0
- package/lib/tests/plugin-setup.test.js +51 -0
- package/lib/tests/rules/require-branch-annotation.test.d.ts +1 -0
- package/lib/tests/rules/require-branch-annotation.test.js +253 -0
- package/lib/tests/rules/require-req-annotation.test.d.ts +1 -0
- package/lib/tests/rules/require-req-annotation.test.js +41 -0
- package/lib/tests/rules/require-story-annotation.test.d.ts +1 -0
- package/lib/tests/rules/require-story-annotation.test.js +36 -0
- package/lib/tests/rules/valid-annotation-format.test.d.ts +1 -0
- package/lib/tests/rules/valid-annotation-format.test.js +58 -0
- package/lib/tests/rules/valid-req-reference.test.d.ts +1 -0
- package/lib/tests/rules/valid-req-reference.test.js +87 -0
- package/lib/tests/rules/valid-story-reference.test.d.ts +1 -0
- package/lib/tests/rules/valid-story-reference.test.js +69 -0
- package/package.json +6 -1
- package/.env.example +0 -6
- package/.github/workflows/ci-cd.yml +0 -107
- package/.husky/pre-commit +0 -1
- package/.husky/pre-push +0 -1
- package/.prettierignore +0 -27
- package/.prettierrc +0 -4
- package/.releaserc.json +0 -15
- package/.voder/history.md +0 -162
- package/.voder/implementation-progress.md +0 -144
- package/.voder/last-action.md +0 -83
- package/.voder/plan.md +0 -12
- package/.voder/progress-chart.png +0 -0
- package/.voder/progress-log-areas.csv +0 -39
- package/.voder/progress-log.csv +0 -38
- package/.voder/traceability/docs-stories-001.0-DEV-PLUGIN-SETUP.story.xml +0 -17
- package/.voder/traceability/docs-stories-002.0-DEV-ESLINT-CONFIG.story.xml +0 -13
- package/.voder/traceability/docs-stories-003.0-DEV-FUNCTION-ANNOTATIONS.story.xml +0 -9
- package/.voder/traceability/docs-stories-004.0-DEV-BRANCH-ANNOTATIONS.story.xml +0 -9
- package/.voder/traceability/docs-stories-005.0-DEV-ANNOTATION-VALIDATION.story.xml +0 -9
- package/.voder/traceability/docs-stories-006.0-DEV-FILE-VALIDATION.story.xml +0 -9
- package/.voder/traceability/docs-stories-007.0-DEV-ERROR-REPORTING.story.xml +0 -9
- package/.voder/traceability/docs-stories-008.0-DEV-AUTO-FIX.story.xml +0 -9
- package/.voder/traceability/docs-stories-009.0-DEV-MAINTENANCE-TOOLS.story.xml +0 -16
- package/.voder/traceability/docs-stories-010.0-DEV-DEEP-VALIDATION.story.xml +0 -11
- package/CHANGELOG.md +0 -57
- package/CONTRIBUTING.md +0 -99
- package/cli-integration.js +0 -103
- package/docs/cli-integration.md +0 -105
- package/docs/config-presets.md +0 -38
- package/docs/conventional-commits-guide.md +0 -185
- 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/eslint-9-setup-guide.md +0 -517
- package/docs/eslint-plugin-development-guide.md +0 -483
- package/docs/jest-testing-guide.md +0 -100
- package/docs/rules/require-branch-annotation.md +0 -34
- package/docs/rules/require-req-annotation.md +0 -39
- package/docs/rules/require-story-annotation.md +0 -36
- package/docs/rules/valid-annotation-format.md +0 -52
- package/docs/rules/valid-req-reference.md +0 -58
- package/docs/rules/valid-story-reference.md +0 -47
- package/docs/security-incidents/unresolved-vulnerabilities.md +0 -11
- package/docs/stories/001.0-DEV-PLUGIN-SETUP.story.md +0 -82
- package/docs/stories/002.0-DEV-ESLINT-CONFIG.story.md +0 -82
- package/docs/stories/003.0-DEV-FUNCTION-ANNOTATIONS.story.md +0 -85
- package/docs/stories/004.0-DEV-BRANCH-ANNOTATIONS.story.md +0 -107
- package/docs/stories/005.0-DEV-ANNOTATION-VALIDATION.story.md +0 -119
- package/docs/stories/006.0-DEV-FILE-VALIDATION.story.md +0 -127
- package/docs/stories/007.0-DEV-ERROR-REPORTING.story.md +0 -89
- package/docs/stories/008.0-DEV-AUTO-FIX.story.md +0 -104
- package/docs/stories/009.0-DEV-MAINTENANCE-TOOLS.story.md +0 -104
- package/docs/stories/010.0-DEV-DEEP-VALIDATION.story.md +0 -110
- package/docs/stories/developer-story.map.md +0 -118
- package/eslint.config.js +0 -146
- package/jest.config.js +0 -21
- package/scripts/smoke-test.sh +0 -45
- package/src/index.ts +0 -56
- package/src/maintenance/batch.ts +0 -29
- package/src/maintenance/detect.ts +0 -42
- package/src/maintenance/report.ts +0 -15
- package/src/maintenance/update.ts +0 -40
- package/src/maintenance/utils.ts +0 -28
- package/src/rules/require-branch-annotation.ts +0 -114
- package/src/rules/require-req-annotation.ts +0 -36
- package/src/rules/require-story-annotation.ts +0 -52
- package/src/rules/valid-annotation-format.ts +0 -62
- package/src/rules/valid-req-reference.ts +0 -114
- package/src/rules/valid-story-reference.ts +0 -213
- package/tests/fixtures/story_bullet.md +0 -6
- package/tests/maintenance/batch.test.ts +0 -55
- package/tests/maintenance/detect-isolated.test.ts +0 -65
- package/tests/maintenance/detect.test.ts +0 -19
- package/tests/maintenance/report.test.ts +0 -37
- package/tests/maintenance/update-isolated.test.ts +0 -39
- package/tests/maintenance/update.test.ts +0 -21
- package/tests/plugin-default-export-and-configs.test.ts +0 -50
- package/tests/plugin-setup.test.ts +0 -17
- package/tests/rules/require-branch-annotation.test.ts +0 -250
- package/tests/rules/require-req-annotation.test.ts +0 -38
- package/tests/rules/require-story-annotation.test.ts +0 -33
- package/tests/rules/valid-annotation-format.test.ts +0 -55
- package/tests/rules/valid-req-reference.test.ts +0 -85
- package/tests/rules/valid-story-reference.test.ts +0 -66
- package/tsconfig.json +0 -15
- package/user-docs/api-reference.md +0 -135
- package/user-docs/examples.md +0 -73
- package/user-docs/migration-guide.md +0 -71
- /package/{src/maintenance/index.ts → lib/src/maintenance/index.d.ts} +0 -0
package/cli-integration.js
DELETED
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* CLI integration tests script for ESLint Traceability Plugin
|
|
4
|
-
* @story docs/stories/001.0-DEV-PLUGIN-SETUP.story.md
|
|
5
|
-
* @req REQ-PLUGIN-STRUCTURE - Validate plugin registers via CLI
|
|
6
|
-
*/
|
|
7
|
-
const { spawnSync } = require("child_process");
|
|
8
|
-
const path = require("path");
|
|
9
|
-
|
|
10
|
-
// Resolve the ESLint CLI binary and configuration path
|
|
11
|
-
const eslintPkgDir = path.dirname(require.resolve("eslint/package.json"));
|
|
12
|
-
const eslintCliPath = path.join(eslintPkgDir, "bin", "eslint.js");
|
|
13
|
-
const configPath = path.resolve(__dirname, "eslint.config.js");
|
|
14
|
-
|
|
15
|
-
// Define CLI integration test scenarios
|
|
16
|
-
const tests = [
|
|
17
|
-
{
|
|
18
|
-
name: "reports error when @story annotation is missing",
|
|
19
|
-
code: "function foo() {}",
|
|
20
|
-
rule: "traceability/require-story-annotation:error",
|
|
21
|
-
expectedStatus: 1,
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
name: "does not report error when @story annotation is present",
|
|
25
|
-
code: `/**
|
|
26
|
-
* @story docs/stories/003.0-DEV-FUNCTION-ANNOTATIONS.story.md
|
|
27
|
-
*/
|
|
28
|
-
function foo() {}`,
|
|
29
|
-
rule: "traceability/require-story-annotation:error",
|
|
30
|
-
expectedStatus: 0,
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
name: "reports error when @req annotation is missing",
|
|
34
|
-
code: "function bar() {}",
|
|
35
|
-
rule: "traceability/require-req-annotation:error",
|
|
36
|
-
expectedStatus: 1,
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
name: "reports error when @story annotation uses path traversal and @req annotation uses path traversal",
|
|
40
|
-
code: `/**
|
|
41
|
-
* @story ../docs/stories/invalid.story.md
|
|
42
|
-
* @req ../docs/requirements/REQ-INVALID.md
|
|
43
|
-
*/
|
|
44
|
-
function bar() {}`,
|
|
45
|
-
rule: "traceability/valid-req-reference:error",
|
|
46
|
-
expectedStatus: 1,
|
|
47
|
-
},
|
|
48
|
-
{
|
|
49
|
-
name: "reports error when @story annotation uses absolute path and @req annotation uses absolute path",
|
|
50
|
-
code: `/**
|
|
51
|
-
* @story /absolute/path/to/story.story.md
|
|
52
|
-
* @req /etc/passwd
|
|
53
|
-
*/
|
|
54
|
-
function baz() {}`,
|
|
55
|
-
rule: "traceability/valid-req-reference:error",
|
|
56
|
-
expectedStatus: 1,
|
|
57
|
-
},
|
|
58
|
-
];
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* Run ESLint CLI with given code and rule override
|
|
62
|
-
* @param {string} code Source code to lint via stdin
|
|
63
|
-
* @param {string} rule ESLint rule override e.g. "traceability/require-story-annotation:error"
|
|
64
|
-
* @returns {object} Result of spawnSync call
|
|
65
|
-
*/
|
|
66
|
-
function runEslint(code, rule) {
|
|
67
|
-
const args = [
|
|
68
|
-
"--no-config-lookup",
|
|
69
|
-
"--config",
|
|
70
|
-
configPath,
|
|
71
|
-
"--stdin",
|
|
72
|
-
"--stdin-filename",
|
|
73
|
-
"foo.js",
|
|
74
|
-
"--rule",
|
|
75
|
-
"no-unused-vars:off",
|
|
76
|
-
"--rule",
|
|
77
|
-
rule,
|
|
78
|
-
];
|
|
79
|
-
return spawnSync(process.execPath, [eslintCliPath, ...args], {
|
|
80
|
-
encoding: "utf-8",
|
|
81
|
-
input: code,
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
// Execute tests and report results
|
|
86
|
-
let failures = 0;
|
|
87
|
-
tests.forEach((test) => {
|
|
88
|
-
const result = runEslint(test.code, test.rule);
|
|
89
|
-
const passed = result.status === test.expectedStatus;
|
|
90
|
-
if (passed) {
|
|
91
|
-
console.log(`✓ ${test.name}`);
|
|
92
|
-
} else {
|
|
93
|
-
console.error(`✗ ${test.name}`);
|
|
94
|
-
console.error(
|
|
95
|
-
` Expected exit code ${test.expectedStatus}, got ${result.status}`,
|
|
96
|
-
);
|
|
97
|
-
if (result.stdout) console.error(` stdout: ${result.stdout}`);
|
|
98
|
-
if (result.stderr) console.error(` stderr: ${result.stderr}`);
|
|
99
|
-
failures++;
|
|
100
|
-
}
|
|
101
|
-
});
|
|
102
|
-
|
|
103
|
-
process.exit(failures > 0 ? 1 : 0);
|
package/docs/cli-integration.md
DELETED
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
# CLI Integration Script Documentation
|
|
2
|
-
|
|
3
|
-
This document provides detailed information about the `cli-integration.js` script, which runs end-to-end CLI integration tests for the `eslint-plugin-traceability` plugin.
|
|
4
|
-
|
|
5
|
-
Story: docs/stories/001.0-DEV-PLUGIN-SETUP.story.md
|
|
6
|
-
Requirement: REQ-PLUGIN-STRUCTURE - Validate plugin registers via CLI
|
|
7
|
-
|
|
8
|
-
## Overview
|
|
9
|
-
|
|
10
|
-
The `cli-integration.js` script automates tests that invoke the ESLint CLI with the plugin configured, verifying that rule errors are reported (or not) as expected when code is passed via `stdin`.
|
|
11
|
-
|
|
12
|
-
It uses Node.js `child_process.spawnSync` to:
|
|
13
|
-
|
|
14
|
-
- Disable default ESLint config resolution
|
|
15
|
-
- Load the plugin via `eslint.config.js` flat config
|
|
16
|
-
- Pass code and rule settings via `--stdin` and `--rule` flags
|
|
17
|
-
|
|
18
|
-
## Tests Implemented
|
|
19
|
-
|
|
20
|
-
The script defines an array of test scenarios, each with:
|
|
21
|
-
|
|
22
|
-
- **name**: A descriptive test name
|
|
23
|
-
- **code**: A string containing JavaScript code to lint
|
|
24
|
-
- **rule**: An ESLint rule override specifying severity
|
|
25
|
-
- **expectedStatus**: The expected exit code (0 or 1)
|
|
26
|
-
|
|
27
|
-
Current test scenarios:
|
|
28
|
-
|
|
29
|
-
1. `reports error when @story annotation is missing`
|
|
30
|
-
- Code: `function foo() {}`
|
|
31
|
-
- Rule: `traceability/require-story-annotation:error`
|
|
32
|
-
- Expected exit code: 1 (error reported)
|
|
33
|
-
|
|
34
|
-
2. `does not report error when @story annotation is present`
|
|
35
|
-
|
|
36
|
-
```js
|
|
37
|
-
/**
|
|
38
|
-
* @story docs/stories/003.0-DEV-FUNCTION-ANNOTATIONS.story.md
|
|
39
|
-
*/
|
|
40
|
-
function foo() {}
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
- Rule: `traceability/require-story-annotation:error`
|
|
44
|
-
- Expected exit code: 0 (no error)
|
|
45
|
-
|
|
46
|
-
3. `reports error when @req annotation is missing`
|
|
47
|
-
- Code: `function bar() {}`
|
|
48
|
-
- Rule: `traceability/valid-req-reference:error`
|
|
49
|
-
- Expected exit code: 1 (error reported)
|
|
50
|
-
|
|
51
|
-
4. `reports error when @req annotation uses path traversal`
|
|
52
|
-
|
|
53
|
-
```js
|
|
54
|
-
/**
|
|
55
|
-
* @req ../docs/requirements/REQ-INVALID.md
|
|
56
|
-
*/
|
|
57
|
-
function bar() {}
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
- Rule: `traceability/valid-req-reference:error`
|
|
61
|
-
- Expected exit code: 1 (error reported)
|
|
62
|
-
|
|
63
|
-
5. `reports error when @req annotation uses absolute path`
|
|
64
|
-
|
|
65
|
-
```js
|
|
66
|
-
/**
|
|
67
|
-
* @req /etc/passwd
|
|
68
|
-
*/
|
|
69
|
-
function baz() {}
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
- Rule: `traceability/valid-req-reference:error`
|
|
73
|
-
- Expected exit code: 1 (error reported)
|
|
74
|
-
|
|
75
|
-
## Usage
|
|
76
|
-
|
|
77
|
-
Note: The script lives at the project root.
|
|
78
|
-
|
|
79
|
-
```bash
|
|
80
|
-
# Run CLI integration tests
|
|
81
|
-
node ./cli-integration.js
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
## Integration into CI
|
|
85
|
-
|
|
86
|
-
The CI workflow (`.github/workflows/ci.yml`) includes a separate `integration-tests` job that runs:
|
|
87
|
-
|
|
88
|
-
```yaml
|
|
89
|
-
jobs:
|
|
90
|
-
integration-tests:
|
|
91
|
-
needs: quality-checks
|
|
92
|
-
run: node cli-integration.js
|
|
93
|
-
```
|
|
94
|
-
|
|
95
|
-
This ensures that CLI-level behavior is verified on all supported Node.js versions.
|
|
96
|
-
|
|
97
|
-
## Extending Tests
|
|
98
|
-
|
|
99
|
-
To add new CLI integration scenarios:
|
|
100
|
-
|
|
101
|
-
1. Open `cli-integration.js`.
|
|
102
|
-
2. Append a new object to the `tests` array with the desired `name`, `code`, `rule`, and `expectedStatus`.
|
|
103
|
-
3. Run `node cli-integration.js` locally to verify.
|
|
104
|
-
|
|
105
|
-
Ensure that any new scenarios have clear test names and cover distinct rule behaviors.
|
package/docs/config-presets.md
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
# Configuration Presets
|
|
2
|
-
|
|
3
|
-
This document describes the built-in configuration presets provided by the `eslint-plugin-traceability` plugin.
|
|
4
|
-
|
|
5
|
-
## Recommended Preset
|
|
6
|
-
|
|
7
|
-
Use the **recommended** preset to enable the core traceability rule set with default settings.
|
|
8
|
-
|
|
9
|
-
```javascript
|
|
10
|
-
// eslint.config.js
|
|
11
|
-
import js from "@eslint/js";
|
|
12
|
-
import traceability from "eslint-plugin-traceability";
|
|
13
|
-
|
|
14
|
-
export default [js.configs.recommended, traceability.configs.recommended];
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
This preset enables the following rules at the `error` level:
|
|
18
|
-
|
|
19
|
-
- `traceability/require-story-annotation`
|
|
20
|
-
- `traceability/require-req-annotation`
|
|
21
|
-
- `traceability/require-branch-annotation`
|
|
22
|
-
- `traceability/valid-annotation-format`
|
|
23
|
-
- `traceability/valid-story-reference`
|
|
24
|
-
- `traceability/valid-req-reference`
|
|
25
|
-
|
|
26
|
-
## Strict Preset
|
|
27
|
-
|
|
28
|
-
Use the **strict** preset to enforce the same core rules, with potential future enhancements for stricter policies.
|
|
29
|
-
|
|
30
|
-
```javascript
|
|
31
|
-
// eslint.config.js
|
|
32
|
-
import js from "@eslint/js";
|
|
33
|
-
import traceability from "eslint-plugin-traceability";
|
|
34
|
-
|
|
35
|
-
export default [js.configs.recommended, traceability.configs.strict];
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
The **strict** preset currently mirrors the **recommended** rules, but may include additional constraints in future plugin versions.
|
|
@@ -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)
|