eslint-plugin-traceability 1.0.3 → 1.0.4

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 (33) hide show
  1. package/.github/workflows/ci-cd.yml +26 -28
  2. package/.husky/pre-commit +1 -1
  3. package/.husky/pre-push +1 -1
  4. package/.prettierignore +5 -1
  5. package/.voder/history.md +138 -264
  6. package/.voder/implementation-progress.md +110 -112
  7. package/.voder/last-action.md +62 -204
  8. package/.voder/plan.md +10 -10
  9. package/.voder/progress-chart.png +0 -0
  10. package/.voder/progress-log-areas.csv +4 -0
  11. package/.voder/progress-log.csv +4 -0
  12. package/CHANGELOG.md +12 -0
  13. package/README.md +2 -2
  14. package/cli-integration.js +61 -115
  15. package/docs/cli-integration.md +3 -1
  16. package/docs/decisions/005-github-actions-validation-tooling.accepted.md +144 -0
  17. package/eslint.config.js +4 -4
  18. package/lib/tests/{basic.test.js → plugin-setup.test.js} +1 -1
  19. package/package.json +1 -1
  20. package/tests/{basic.test.ts → plugin-setup.test.ts} +1 -1
  21. package/user-docs/migration-guide.md +71 -0
  22. package/lib/index.d.ts +0 -26
  23. package/lib/index.js +0 -11
  24. package/lib/tests/integration/file-validation.test.d.ts +0 -1
  25. package/lib/tests/integration/file-validation.test.js +0 -71
  26. package/lib/tests/integration/plugin-validation.test.d.ts +0 -1
  27. package/lib/tests/integration/plugin-validation.test.js +0 -83
  28. package/tests/integration/file-validation.test.ts +0 -78
  29. package/tests/integration/plugin-validation.test.ts +0 -84
  30. /package/lib/tests/{basic.test.d.ts → plugin-default-export-and-configs.test.d.ts} +0 -0
  31. /package/lib/tests/{index.test.js → plugin-default-export-and-configs.test.js} +0 -0
  32. /package/lib/tests/{index.test.d.ts → plugin-setup.test.d.ts} +0 -0
  33. /package/tests/{index.test.ts → plugin-default-export-and-configs.test.ts} +0 -0
@@ -1,83 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- /**
7
- * Integration tests for ESLint plugin via CLI
8
- * @story docs/stories/001.0-DEV-PLUGIN-SETUP.story.md
9
- * @req REQ-PLUGIN-STRUCTURE - Validate plugin registers via CLI
10
- */
11
- /* eslint-env node, jest */
12
- const child_process_1 = require("child_process");
13
- const path_1 = __importDefault(require("path"));
14
- // Ensure ESLint CLI uses built plugin
15
- const eslintBin = path_1.default.resolve(__dirname, "../../node_modules/.bin/eslint");
16
- const configPath = path_1.default.resolve(__dirname, "../../eslint.config.js");
17
- describe("ESLint CLI Integration (Story 001.0-DEV-PLUGIN-SETUP)", () => {
18
- /**
19
- * Helper to run ESLint CLI with the traceability plugin and custom rule
20
- * @story docs/stories/001.0-DEV-PLUGIN-SETUP.story.md
21
- * @req REQ-PLUGIN-STRUCTURE - Invoke ESLint CLI for integration testing
22
- */
23
- function runEslint(code, rule) {
24
- const args = [
25
- "--no-config-lookup",
26
- "--config",
27
- configPath,
28
- "--stdin",
29
- "--stdin-filename",
30
- "foo.js",
31
- "--rule",
32
- "no-unused-vars:off",
33
- "--rule",
34
- rule,
35
- ];
36
- return (0, child_process_1.spawnSync)("node", [eslintBin, ...args], {
37
- encoding: "utf-8",
38
- input: code,
39
- });
40
- }
41
- it("[REQ-PLUGIN-STRUCTURE] reports error when @story annotation is missing", () => {
42
- // Arrange
43
- const code = "function foo() {}";
44
- const rule = "traceability/require-story-annotation:error";
45
- // Act
46
- const result = runEslint(code, rule);
47
- // Assert
48
- expect(result.status).toBe(1);
49
- expect(result.stdout).toMatch(/require-story-annotation/);
50
- });
51
- it("[REQ-PLUGIN-STRUCTURE] does not report error when @story annotation is present", () => {
52
- // Arrange
53
- const code = `/**
54
- * @story docs/stories/003.0-DEV-FUNCTION-ANNOTATIONS.story.md
55
- */
56
- function foo() {}`;
57
- const rule = "traceability/require-story-annotation:error";
58
- // Act
59
- const result = runEslint(code, rule);
60
- // Assert
61
- expect(result.status).toBe(0);
62
- });
63
- it("[REQ-REQ-CLI] reports error when @req annotation is missing", () => {
64
- // Arrange
65
- const code = "function foo() {}";
66
- const rule = "traceability/require-req-annotation:error";
67
- // Act
68
- const result = runEslint(code, rule);
69
- // Assert
70
- expect(result.status).toBe(1);
71
- expect(result.stdout).toMatch(/require-req-annotation/);
72
- });
73
- it("[REQ-BRANCH-CLI] reports error when branch annotations missing", () => {
74
- // Arrange
75
- const code = "if (true) {}";
76
- const rule = "traceability/require-branch-annotation:error";
77
- // Act
78
- const result = runEslint(code, rule);
79
- // Assert
80
- expect(result.status).toBe(1);
81
- expect(result.stdout).toMatch(/require-branch-annotation/);
82
- });
83
- });
@@ -1,78 +0,0 @@
1
- /**
2
- * Integration tests for file-validation rules via ESLint CLI
3
- * @story docs/stories/006.0-DEV-FILE-VALIDATION.story.md
4
- * @req REQ-PERFORMANCE-OPTIMIZATION - Verify CLI integration of valid-story-reference and valid-req-reference rules
5
- */
6
- import { spawnSync } from "child_process";
7
- import path from "path";
8
-
9
- // Ensure ESLint CLI uses built plugin
10
- const eslintBin = path.resolve(__dirname, "../../node_modules/.bin/eslint");
11
- const configPath = path.resolve(__dirname, "../../eslint.config.js");
12
-
13
- describe("File and Req Validation CLI Integration (Story 006.0-DEV-FILE-VALIDATION)", () => {
14
- function runLint(code: string, rules: string[]) {
15
- const ruleArgs = ["--rule", "no-unused-vars:off"];
16
- for (const r of rules) {
17
- ruleArgs.push("--rule", r);
18
- }
19
- return spawnSync(
20
- "node",
21
- [
22
- eslintBin,
23
- "--no-config-lookup",
24
- "--config",
25
- configPath,
26
- "--stdin",
27
- "--stdin-filename",
28
- "foo.js",
29
- ...ruleArgs,
30
- ],
31
- {
32
- encoding: "utf-8",
33
- input: code,
34
- },
35
- );
36
- }
37
-
38
- it("[REQ-FILE-EXISTENCE] reports missing story file via CLI", () => {
39
- // Arrange
40
- const code = "// @story docs/stories/missing-file.story.md";
41
- // Act
42
- const res = runLint(code, ["traceability/valid-story-reference:error"]);
43
- // Assert
44
- expect(res.status).toBe(1);
45
- expect(res.stdout).toContain("Story file");
46
- });
47
-
48
- it("[REQ-EXTENSION] reports invalid extension via CLI", () => {
49
- // Arrange
50
- const code = "// @story docs/stories/001.0-DEV-PLUGIN-SETUP.md";
51
- // Act
52
- const res = runLint(code, ["traceability/valid-story-reference:error"]);
53
- // Assert
54
- expect(res.status).toBe(1);
55
- expect(res.stdout).toContain("Invalid story file extension");
56
- });
57
-
58
- it("[REQ-DEEP-PARSE] reports missing requirement via CLI", () => {
59
- // Arrange
60
- const code =
61
- "// @story docs/stories/001.0-DEV-PLUGIN-SETUP.story.md\n// @req REQ-UNKNOWN";
62
- // Act
63
- const res = runLint(code, ["traceability/valid-req-reference:error"]);
64
- // Assert
65
- expect(res.status).toBe(1);
66
- expect(res.stdout).toContain("Requirement 'REQ-UNKNOWN' not found");
67
- });
68
-
69
- it("[REQ-DEEP-MATCH] valid story and requirement via CLI", () => {
70
- // Arrange
71
- const code =
72
- "// @story docs/stories/001.0-DEV-PLUGIN-SETUP.story.md\n// @req REQ-PLUGIN-STRUCTURE";
73
- // Act
74
- const res = runLint(code, ["traceability/valid-req-reference:error"]);
75
- // Assert
76
- expect(res.status).toBe(0);
77
- });
78
- });
@@ -1,84 +0,0 @@
1
- /**
2
- * Integration tests for ESLint plugin via CLI
3
- * @story docs/stories/001.0-DEV-PLUGIN-SETUP.story.md
4
- * @req REQ-PLUGIN-STRUCTURE - Validate plugin registers via CLI
5
- */
6
- /* eslint-env node, jest */
7
- import { spawnSync, SpawnSyncReturns } from "child_process";
8
- import path from "path";
9
-
10
- // Ensure ESLint CLI uses built plugin
11
- const eslintBin = path.resolve(__dirname, "../../node_modules/.bin/eslint");
12
- const configPath = path.resolve(__dirname, "../../eslint.config.js");
13
-
14
- describe("ESLint CLI Integration (Story 001.0-DEV-PLUGIN-SETUP)", () => {
15
- /**
16
- * Helper to run ESLint CLI with the traceability plugin and custom rule
17
- * @story docs/stories/001.0-DEV-PLUGIN-SETUP.story.md
18
- * @req REQ-PLUGIN-STRUCTURE - Invoke ESLint CLI for integration testing
19
- */
20
- function runEslint(code: string, rule: string): SpawnSyncReturns<string> {
21
- const args = [
22
- "--no-config-lookup",
23
- "--config",
24
- configPath,
25
- "--stdin",
26
- "--stdin-filename",
27
- "foo.js",
28
- "--rule",
29
- "no-unused-vars:off",
30
- "--rule",
31
- rule,
32
- ];
33
- return spawnSync("node", [eslintBin, ...args], {
34
- encoding: "utf-8",
35
- input: code,
36
- });
37
- }
38
-
39
- it("[REQ-PLUGIN-STRUCTURE] reports error when @story annotation is missing", () => {
40
- // Arrange
41
- const code = "function foo() {}";
42
- const rule = "traceability/require-story-annotation:error";
43
- // Act
44
- const result = runEslint(code, rule);
45
- // Assert
46
- expect(result.status).toBe(1);
47
- expect(result.stdout).toMatch(/require-story-annotation/);
48
- });
49
-
50
- it("[REQ-PLUGIN-STRUCTURE] does not report error when @story annotation is present", () => {
51
- // Arrange
52
- const code = `/**
53
- * @story docs/stories/003.0-DEV-FUNCTION-ANNOTATIONS.story.md
54
- */
55
- function foo() {}`;
56
- const rule = "traceability/require-story-annotation:error";
57
- // Act
58
- const result = runEslint(code, rule);
59
- // Assert
60
- expect(result.status).toBe(0);
61
- });
62
-
63
- it("[REQ-REQ-CLI] reports error when @req annotation is missing", () => {
64
- // Arrange
65
- const code = "function foo() {}";
66
- const rule = "traceability/require-req-annotation:error";
67
- // Act
68
- const result = runEslint(code, rule);
69
- // Assert
70
- expect(result.status).toBe(1);
71
- expect(result.stdout).toMatch(/require-req-annotation/);
72
- });
73
-
74
- it("[REQ-BRANCH-CLI] reports error when branch annotations missing", () => {
75
- // Arrange
76
- const code = "if (true) {}";
77
- const rule = "traceability/require-branch-annotation:error";
78
- // Act
79
- const result = runEslint(code, rule);
80
- // Assert
81
- expect(result.status).toBe(1);
82
- expect(result.stdout).toMatch(/require-branch-annotation/);
83
- });
84
- });