eslint-plugin-traceability 1.0.3 → 1.0.5
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/.github/workflows/ci-cd.yml +41 -35
- package/.husky/pre-commit +1 -1
- package/.husky/pre-push +1 -1
- package/.prettierignore +5 -1
- package/.releaserc.json +15 -0
- package/.voder/history.md +138 -264
- package/.voder/implementation-progress.md +110 -112
- package/.voder/last-action.md +62 -204
- package/.voder/plan.md +10 -10
- package/.voder/progress-chart.png +0 -0
- package/.voder/progress-log-areas.csv +4 -0
- package/.voder/progress-log.csv +4 -0
- package/CHANGELOG.md +20 -1
- package/CONTRIBUTING.md +15 -13
- package/README.md +2 -2
- package/cli-integration.js +61 -115
- package/docs/cli-integration.md +3 -1
- package/docs/conventional-commits-guide.md +185 -0
- package/docs/decisions/004-automated-version-bumping-for-ci-cd.md +3 -1
- package/docs/decisions/005-github-actions-validation-tooling.accepted.md +144 -0
- package/docs/decisions/006-semantic-release-for-automated-publishing.accepted.md +227 -0
- package/eslint.config.js +4 -4
- package/package.json +7 -2
- package/tests/{basic.test.ts → plugin-setup.test.ts} +1 -1
- package/user-docs/migration-guide.md +71 -0
- package/lib/index.d.ts +0 -26
- package/lib/index.js +0 -11
- package/lib/src/index.d.ts +0 -80
- package/lib/src/index.js +0 -58
- package/lib/src/maintenance/batch.d.ts +0 -16
- package/lib/src/maintenance/batch.js +0 -28
- package/lib/src/maintenance/detect.d.ts +0 -6
- package/lib/src/maintenance/detect.js +0 -69
- package/lib/src/maintenance/index.d.ts +0 -14
- package/lib/src/maintenance/index.js +0 -22
- package/lib/src/maintenance/report.d.ts +0 -7
- package/lib/src/maintenance/report.js +0 -17
- package/lib/src/maintenance/update.d.ts +0 -6
- package/lib/src/maintenance/update.js +0 -67
- package/lib/src/maintenance/utils.d.ts +0 -6
- package/lib/src/maintenance/utils.js +0 -64
- package/lib/src/rules/require-branch-annotation.d.ts +0 -7
- package/lib/src/rules/require-branch-annotation.js +0 -111
- package/lib/src/rules/require-req-annotation.d.ts +0 -7
- package/lib/src/rules/require-req-annotation.js +0 -38
- package/lib/src/rules/require-story-annotation.d.ts +0 -7
- package/lib/src/rules/require-story-annotation.js +0 -50
- package/lib/src/rules/valid-annotation-format.d.ts +0 -10
- package/lib/src/rules/valid-annotation-format.js +0 -60
- package/lib/src/rules/valid-req-reference.d.ts +0 -3
- package/lib/src/rules/valid-req-reference.js +0 -104
- package/lib/src/rules/valid-story-reference.d.ts +0 -3
- package/lib/src/rules/valid-story-reference.js +0 -168
- package/lib/tests/basic.test.d.ts +0 -1
- package/lib/tests/basic.test.js +0 -51
- package/lib/tests/fixtures/stale/example.d.ts +0 -0
- package/lib/tests/fixtures/stale/example.js +0 -3
- package/lib/tests/fixtures/update/example.d.ts +0 -0
- package/lib/tests/fixtures/update/example.js +0 -3
- package/lib/tests/fixtures/valid-annotations/example.d.ts +0 -0
- package/lib/tests/fixtures/valid-annotations/example.js +0 -3
- package/lib/tests/index.test.d.ts +0 -1
- package/lib/tests/index.test.js +0 -72
- package/lib/tests/integration/file-validation.test.d.ts +0 -1
- package/lib/tests/integration/file-validation.test.js +0 -71
- package/lib/tests/integration/plugin-validation.test.d.ts +0 -1
- package/lib/tests/integration/plugin-validation.test.js +0 -83
- package/lib/tests/maintenance/batch.test.d.ts +0 -1
- package/lib/tests/maintenance/batch.test.js +0 -79
- package/lib/tests/maintenance/detect-isolated.test.d.ts +0 -1
- package/lib/tests/maintenance/detect-isolated.test.js +0 -95
- package/lib/tests/maintenance/detect.test.d.ts +0 -1
- package/lib/tests/maintenance/detect.test.js +0 -23
- package/lib/tests/maintenance/report.test.d.ts +0 -1
- package/lib/tests/maintenance/report.test.js +0 -67
- package/lib/tests/maintenance/update-isolated.test.d.ts +0 -1
- package/lib/tests/maintenance/update-isolated.test.js +0 -66
- package/lib/tests/maintenance/update.test.d.ts +0 -1
- package/lib/tests/maintenance/update.test.js +0 -26
- package/lib/tests/rules/require-branch-annotation.test.d.ts +0 -1
- package/lib/tests/rules/require-branch-annotation.test.js +0 -253
- package/lib/tests/rules/require-req-annotation.test.d.ts +0 -1
- package/lib/tests/rules/require-req-annotation.test.js +0 -41
- package/lib/tests/rules/require-story-annotation.test.d.ts +0 -1
- package/lib/tests/rules/require-story-annotation.test.js +0 -36
- package/lib/tests/rules/valid-annotation-format.test.d.ts +0 -1
- package/lib/tests/rules/valid-annotation-format.test.js +0 -58
- package/lib/tests/rules/valid-req-reference.test.d.ts +0 -1
- package/lib/tests/rules/valid-req-reference.test.js +0 -87
- package/lib/tests/rules/valid-story-reference.test.d.ts +0 -1
- package/lib/tests/rules/valid-story-reference.test.js +0 -69
- package/tests/integration/file-validation.test.ts +0 -78
- package/tests/integration/plugin-validation.test.ts +0 -84
- /package/tests/{index.test.ts → plugin-default-export-and-configs.test.ts} +0 -0
|
@@ -1,23 +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
|
-
* Tests for: docs/stories/009.0-DEV-MAINTENANCE-TOOLS.story.md
|
|
8
|
-
* @story docs/stories/009.0-DEV-MAINTENANCE-TOOLS.story.md
|
|
9
|
-
* @req REQ-MAINT-DETECT - Detect stale annotation references
|
|
10
|
-
*/
|
|
11
|
-
const fs_1 = __importDefault(require("fs"));
|
|
12
|
-
const path_1 = __importDefault(require("path"));
|
|
13
|
-
const os_1 = __importDefault(require("os"));
|
|
14
|
-
const detect_1 = require("../../src/maintenance/detect");
|
|
15
|
-
describe("detectStaleAnnotations (Story 009.0-DEV-MAINTENANCE-TOOLS)", () => {
|
|
16
|
-
it("[REQ-MAINT-DETECT] should return empty array when no stale annotations", () => {
|
|
17
|
-
const tmpDir = fs_1.default.mkdtempSync(path_1.default.join(os_1.default.tmpdir(), "detect-test-"));
|
|
18
|
-
// No annotation files are created in tmpDir to simulate no stale annotations
|
|
19
|
-
const result = (0, detect_1.detectStaleAnnotations)(tmpDir);
|
|
20
|
-
expect(result).toEqual([]);
|
|
21
|
-
fs_1.default.rmSync(tmpDir, { recursive: true, force: true });
|
|
22
|
-
});
|
|
23
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
/**
|
|
37
|
-
* Tests for: docs/stories/009.0-DEV-MAINTENANCE-TOOLS.story.md
|
|
38
|
-
* @story docs/stories/009.0-DEV-MAINTENANCE-TOOLS.story.md
|
|
39
|
-
* @req REQ-MAINT-REPORT - Generate maintenance report
|
|
40
|
-
* @req REQ-MAINT-SAFE - Ensure operations are safe and reversible
|
|
41
|
-
*/
|
|
42
|
-
const fs = __importStar(require("fs"));
|
|
43
|
-
const path = __importStar(require("path"));
|
|
44
|
-
const os = __importStar(require("os"));
|
|
45
|
-
const report_1 = require("../../src/maintenance/report");
|
|
46
|
-
describe("generateMaintenanceReport (Story 009.0-DEV-MAINTENANCE-TOOLS)", () => {
|
|
47
|
-
let tmpDir;
|
|
48
|
-
beforeAll(() => {
|
|
49
|
-
tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), "report-test-"));
|
|
50
|
-
});
|
|
51
|
-
afterAll(() => {
|
|
52
|
-
fs.rmSync(tmpDir, { recursive: true, force: true });
|
|
53
|
-
});
|
|
54
|
-
it("[REQ-MAINT-REPORT] should return empty string when no operations", () => {
|
|
55
|
-
const report = (0, report_1.generateMaintenanceReport)(tmpDir);
|
|
56
|
-
expect(report).toBe("");
|
|
57
|
-
});
|
|
58
|
-
it("[REQ-MAINT-REPORT] should report stale story annotation", () => {
|
|
59
|
-
const filePath = path.join(tmpDir, "stub.md");
|
|
60
|
-
const content = `/**
|
|
61
|
-
* @story non-existent.md
|
|
62
|
-
*/`;
|
|
63
|
-
fs.writeFileSync(filePath, content);
|
|
64
|
-
const report = (0, report_1.generateMaintenanceReport)(tmpDir);
|
|
65
|
-
expect(report).toContain("non-existent.md");
|
|
66
|
-
});
|
|
67
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
/**
|
|
37
|
-
* Tests for: docs/stories/009.0-DEV-MAINTENANCE-TOOLS.story.md
|
|
38
|
-
* @story docs/stories/009.0-DEV-MAINTENANCE-TOOLS.story.md
|
|
39
|
-
* @req REQ-MAINT-UPDATE - Update annotation references
|
|
40
|
-
*/
|
|
41
|
-
const fs = __importStar(require("fs"));
|
|
42
|
-
const path = __importStar(require("path"));
|
|
43
|
-
const os = __importStar(require("os"));
|
|
44
|
-
const update_1 = require("../../src/maintenance/update");
|
|
45
|
-
describe("updateAnnotationReferences isolated (Story 009.0-DEV-MAINTENANCE-TOOLS)", () => {
|
|
46
|
-
it("[REQ-MAINT-UPDATE] updates @story annotations in files", () => {
|
|
47
|
-
// Create a temporary directory for testing
|
|
48
|
-
const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), "tmp-"));
|
|
49
|
-
const filePath = path.join(tmpDir, "file.ts");
|
|
50
|
-
const originalContent = `
|
|
51
|
-
/**
|
|
52
|
-
* @story old.path.md
|
|
53
|
-
*/
|
|
54
|
-
function foo() {}
|
|
55
|
-
`;
|
|
56
|
-
fs.writeFileSync(filePath, originalContent, "utf8");
|
|
57
|
-
// Run the function under test
|
|
58
|
-
const count = (0, update_1.updateAnnotationReferences)(tmpDir, "old.path.md", "new.path.md");
|
|
59
|
-
expect(count).toBe(1);
|
|
60
|
-
// Verify the file content was updated
|
|
61
|
-
const updatedContent = fs.readFileSync(filePath, "utf8");
|
|
62
|
-
expect(updatedContent).toContain("@story new.path.md");
|
|
63
|
-
// Cleanup temporary directory
|
|
64
|
-
fs.rmSync(tmpDir, { recursive: true, force: true });
|
|
65
|
-
});
|
|
66
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,26 +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
|
-
* Tests for: docs/stories/009.0-DEV-MAINTENANCE-TOOLS.story.md
|
|
8
|
-
* @story docs/stories/009.0-DEV-MAINTENANCE-TOOLS.story.md
|
|
9
|
-
* @req REQ-MAINT-UPDATE - Update annotation references
|
|
10
|
-
*/
|
|
11
|
-
const fs_1 = __importDefault(require("fs"));
|
|
12
|
-
const os_1 = __importDefault(require("os"));
|
|
13
|
-
const path_1 = __importDefault(require("path"));
|
|
14
|
-
const update_1 = require("../../src/maintenance/update");
|
|
15
|
-
describe("updateAnnotationReferences (Story 009.0-DEV-MAINTENANCE-TOOLS)", () => {
|
|
16
|
-
it("[REQ-MAINT-UPDATE] should return 0 when no updates made", () => {
|
|
17
|
-
const tmpDir = fs_1.default.mkdtempSync(path_1.default.join(os_1.default.tmpdir(), "update-test-"));
|
|
18
|
-
try {
|
|
19
|
-
const count = (0, update_1.updateAnnotationReferences)(tmpDir, "old.md", "new.md");
|
|
20
|
-
expect(count).toBe(0);
|
|
21
|
-
}
|
|
22
|
-
finally {
|
|
23
|
-
fs_1.default.rmSync(tmpDir, { recursive: true, force: true });
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,253 +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
|
-
* Tests for: docs/stories/004.0-DEV-BRANCH-ANNOTATIONS.story.md
|
|
8
|
-
* @story docs/stories/004.0-DEV-BRANCH-ANNOTATIONS.story.md
|
|
9
|
-
* @req REQ-BRANCH-DETECTION - Verify require-branch-annotation rule enforces branch annotations
|
|
10
|
-
*/
|
|
11
|
-
const eslint_1 = require("eslint");
|
|
12
|
-
const require_branch_annotation_1 = __importDefault(require("../../src/rules/require-branch-annotation"));
|
|
13
|
-
const ruleTester = new eslint_1.RuleTester({
|
|
14
|
-
languageOptions: { parserOptions: { ecmaVersion: 2020 } },
|
|
15
|
-
});
|
|
16
|
-
describe("Require Branch Annotation Rule (Story 004.0-DEV-BRANCH-ANNOTATIONS)", () => {
|
|
17
|
-
ruleTester.run("require-branch-annotation", require_branch_annotation_1.default, {
|
|
18
|
-
valid: [
|
|
19
|
-
{
|
|
20
|
-
name: "[REQ-BRANCH-DETECTION] valid fallback scanning comment detection",
|
|
21
|
-
code: `switch (value) {
|
|
22
|
-
|
|
23
|
-
// @story docs/stories/004.0-DEV-BRANCH-ANNOTATIONS.story.md
|
|
24
|
-
// @req REQ-BRANCH-DETECTION
|
|
25
|
-
case 'z':
|
|
26
|
-
break;
|
|
27
|
-
}`,
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
name: "[REQ-BRANCH-DETECTION] valid if-statement with annotations",
|
|
31
|
-
code: `// @story docs/stories/004.0-DEV-BRANCH-ANNOTATIONS.story.md
|
|
32
|
-
// @req REQ-BRANCH-DETECTION
|
|
33
|
-
if (condition) {}`,
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
name: "[REQ-BRANCH-DETECTION] valid for loop with block comment annotations",
|
|
37
|
-
code: `/* @story docs/stories/004.0-DEV-BRANCH-ANNOTATIONS.story.md */
|
|
38
|
-
/* @req REQ-BRANCH-DETECTION */
|
|
39
|
-
for (let i = 0; i < 10; i++) {}`,
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
name: "[REQ-BRANCH-DETECTION] valid switch-case with annotations",
|
|
43
|
-
code: `switch (value) {
|
|
44
|
-
// @story docs/stories/004.0-DEV-BRANCH-ANNOTATIONS.story.md
|
|
45
|
-
// @req REQ-BRANCH-DETECTION
|
|
46
|
-
case 'a':
|
|
47
|
-
break;
|
|
48
|
-
default:
|
|
49
|
-
break;
|
|
50
|
-
}`,
|
|
51
|
-
},
|
|
52
|
-
{
|
|
53
|
-
name: "[REQ-BRANCH-DETECTION] valid try-finally with annotations",
|
|
54
|
-
code: `/* @story docs/stories/004.0-DEV-BRANCH-ANNOTATIONS.story.md */
|
|
55
|
-
/* @req REQ-BRANCH-DETECTION */
|
|
56
|
-
try {
|
|
57
|
-
doSomething();
|
|
58
|
-
} finally {
|
|
59
|
-
cleanUp();
|
|
60
|
-
}`,
|
|
61
|
-
},
|
|
62
|
-
{
|
|
63
|
-
name: "[REQ-BRANCH-DETECTION] valid catch with annotations",
|
|
64
|
-
code: `/* @story docs/stories/004.0-DEV-BRANCH-ANNOTATIONS.story.md */
|
|
65
|
-
/* @req REQ-BRANCH-DETECTION */
|
|
66
|
-
try {
|
|
67
|
-
doSomething();
|
|
68
|
-
}
|
|
69
|
-
/* @story docs/stories/004.0-DEV-BRANCH-ANNOTATIONS.story.md */
|
|
70
|
-
/* @req REQ-BRANCH-DETECTION */
|
|
71
|
-
catch (error) {
|
|
72
|
-
handleError(error);
|
|
73
|
-
}`,
|
|
74
|
-
},
|
|
75
|
-
{
|
|
76
|
-
name: "[REQ-BRANCH-DETECTION] valid do-while loop with annotations",
|
|
77
|
-
code: `/* @story docs/stories/004.0-DEV-BRANCH-ANNOTATIONS.story.md */
|
|
78
|
-
/* @req REQ-BRANCH-DETECTION */
|
|
79
|
-
do {
|
|
80
|
-
process();
|
|
81
|
-
} while (condition);`,
|
|
82
|
-
},
|
|
83
|
-
{
|
|
84
|
-
name: "[REQ-BRANCH-DETECTION] valid for-of loop with annotations",
|
|
85
|
-
code: `/* @story docs/stories/004.0-DEV-BRANCH-ANNOTATIONS.story.md */
|
|
86
|
-
/* @req REQ-BRANCH-DETECTION */
|
|
87
|
-
for (const item of items) {
|
|
88
|
-
process(item);
|
|
89
|
-
}`,
|
|
90
|
-
},
|
|
91
|
-
{
|
|
92
|
-
name: "[REQ-BRANCH-DETECTION] valid for-in loop with annotations",
|
|
93
|
-
code: `/* @story docs/stories/004.0-DEV-BRANCH-ANNOTATIONS.story.md */
|
|
94
|
-
/* @req REQ-BRANCH-DETECTION */
|
|
95
|
-
for (const key in object) {
|
|
96
|
-
console.log(key);
|
|
97
|
-
}`,
|
|
98
|
-
},
|
|
99
|
-
{
|
|
100
|
-
name: "[REQ-BRANCH-DETECTION] valid while loop with annotations",
|
|
101
|
-
code: `/* @story docs/stories/004.0-DEV-BRANCH-ANNOTATIONS.story.md */
|
|
102
|
-
/* @req REQ-BRANCH-DETECTION */
|
|
103
|
-
while (condition) {
|
|
104
|
-
iterate();
|
|
105
|
-
}`,
|
|
106
|
-
},
|
|
107
|
-
{
|
|
108
|
-
name: "[REQ-BRANCH-DETECTION] valid switch-case with inline annotation",
|
|
109
|
-
code: `switch (value) {
|
|
110
|
-
// @story docs/stories/004.0-DEV-BRANCH-ANNOTATIONS.story.md
|
|
111
|
-
// @req REQ-BRANCH-DETECTION
|
|
112
|
-
case 'a':
|
|
113
|
-
break;
|
|
114
|
-
}`,
|
|
115
|
-
},
|
|
116
|
-
{
|
|
117
|
-
name: "[REQ-BRANCH-DETECTION] valid default case without annotations",
|
|
118
|
-
code: `switch (value) {
|
|
119
|
-
default:
|
|
120
|
-
doSomething();
|
|
121
|
-
}`,
|
|
122
|
-
},
|
|
123
|
-
],
|
|
124
|
-
invalid: [
|
|
125
|
-
{
|
|
126
|
-
name: "[REQ-BRANCH-DETECTION] missing annotations on if-statement",
|
|
127
|
-
code: `if (condition) {}`,
|
|
128
|
-
output: `// @story <story-file>.story.md
|
|
129
|
-
if (condition) {}`,
|
|
130
|
-
errors: [
|
|
131
|
-
{ messageId: "missingAnnotation", data: { missing: "@story" } },
|
|
132
|
-
{ messageId: "missingAnnotation", data: { missing: "@req" } },
|
|
133
|
-
],
|
|
134
|
-
},
|
|
135
|
-
{
|
|
136
|
-
name: "[REQ-BRANCH-DETECTION] missing @req on for loop when only story present",
|
|
137
|
-
code: `// @story docs/stories/004.0-DEV-BRANCH-ANNOTATIONS.story.md
|
|
138
|
-
for (let i = 0; i < 5; i++) {}`,
|
|
139
|
-
output: `// @story docs/stories/004.0-DEV-BRANCH-ANNOTATIONS.story.md
|
|
140
|
-
// @req <REQ-ID>
|
|
141
|
-
for (let i = 0; i < 5; i++) {}`,
|
|
142
|
-
errors: [{ messageId: "missingAnnotation", data: { missing: "@req" } }],
|
|
143
|
-
},
|
|
144
|
-
{
|
|
145
|
-
name: "[REQ-BRANCH-DETECTION] missing @story on while loop when only req present",
|
|
146
|
-
code: `// @req REQ-BRANCH-DETECTION
|
|
147
|
-
while (true) {}`,
|
|
148
|
-
output: `// @req REQ-BRANCH-DETECTION
|
|
149
|
-
// @story <story-file>.story.md
|
|
150
|
-
while (true) {}`,
|
|
151
|
-
errors: [
|
|
152
|
-
{ messageId: "missingAnnotation", data: { missing: "@story" } },
|
|
153
|
-
],
|
|
154
|
-
},
|
|
155
|
-
{
|
|
156
|
-
name: "[REQ-BRANCH-DETECTION] missing annotations on switch-case",
|
|
157
|
-
code: `switch (value) {
|
|
158
|
-
case 'a':
|
|
159
|
-
break;
|
|
160
|
-
}`,
|
|
161
|
-
output: `switch (value) {
|
|
162
|
-
// @story <story-file>.story.md
|
|
163
|
-
case 'a':
|
|
164
|
-
break;
|
|
165
|
-
}`,
|
|
166
|
-
errors: [
|
|
167
|
-
{ messageId: "missingAnnotation", data: { missing: "@story" } },
|
|
168
|
-
{ messageId: "missingAnnotation", data: { missing: "@req" } },
|
|
169
|
-
],
|
|
170
|
-
},
|
|
171
|
-
{
|
|
172
|
-
name: "[REQ-BRANCH-DETECTION] missing annotations on do-while loop",
|
|
173
|
-
code: `do {
|
|
174
|
-
action();
|
|
175
|
-
} while (condition);`,
|
|
176
|
-
output: `// @story <story-file>.story.md
|
|
177
|
-
do {
|
|
178
|
-
action();
|
|
179
|
-
} while (condition);`,
|
|
180
|
-
errors: [
|
|
181
|
-
{ messageId: "missingAnnotation", data: { missing: "@story" } },
|
|
182
|
-
{ messageId: "missingAnnotation", data: { missing: "@req" } },
|
|
183
|
-
],
|
|
184
|
-
},
|
|
185
|
-
{
|
|
186
|
-
name: "[REQ-BRANCH-DETECTION] missing annotations on for-of loop",
|
|
187
|
-
code: `for (const item of items) {
|
|
188
|
-
process(item);
|
|
189
|
-
}`,
|
|
190
|
-
output: `// @story <story-file>.story.md
|
|
191
|
-
for (const item of items) {
|
|
192
|
-
process(item);
|
|
193
|
-
}`,
|
|
194
|
-
errors: [
|
|
195
|
-
{ messageId: "missingAnnotation", data: { missing: "@story" } },
|
|
196
|
-
{ messageId: "missingAnnotation", data: { missing: "@req" } },
|
|
197
|
-
],
|
|
198
|
-
},
|
|
199
|
-
{
|
|
200
|
-
name: "[REQ-BRANCH-DETECTION] missing annotations on for-in loop",
|
|
201
|
-
code: `for (const key in object) {
|
|
202
|
-
console.log(key);
|
|
203
|
-
}`,
|
|
204
|
-
output: `// @story <story-file>.story.md
|
|
205
|
-
for (const key in object) {
|
|
206
|
-
console.log(key);
|
|
207
|
-
}`,
|
|
208
|
-
errors: [
|
|
209
|
-
{ messageId: "missingAnnotation", data: { missing: "@story" } },
|
|
210
|
-
{ messageId: "missingAnnotation", data: { missing: "@req" } },
|
|
211
|
-
],
|
|
212
|
-
},
|
|
213
|
-
{
|
|
214
|
-
name: "[REQ-BRANCH-DETECTION] missing annotations on try-catch blocks",
|
|
215
|
-
code: `try {
|
|
216
|
-
doSomething();
|
|
217
|
-
} catch (error) {
|
|
218
|
-
handleError(error);
|
|
219
|
-
}`,
|
|
220
|
-
output: `// @story <story-file>.story.md
|
|
221
|
-
try {
|
|
222
|
-
doSomething();
|
|
223
|
-
} catch (error) {
|
|
224
|
-
handleError(error);
|
|
225
|
-
}`,
|
|
226
|
-
errors: [
|
|
227
|
-
{ messageId: "missingAnnotation", data: { missing: "@story" } },
|
|
228
|
-
{ messageId: "missingAnnotation", data: { missing: "@req" } },
|
|
229
|
-
{ messageId: "missingAnnotation", data: { missing: "@story" } },
|
|
230
|
-
{ messageId: "missingAnnotation", data: { missing: "@req" } },
|
|
231
|
-
],
|
|
232
|
-
},
|
|
233
|
-
{
|
|
234
|
-
name: "[REQ-BRANCH-DETECTION] missing annotations on switch-case with blank line",
|
|
235
|
-
code: `switch (value) {
|
|
236
|
-
|
|
237
|
-
case 'a':
|
|
238
|
-
break;
|
|
239
|
-
}`,
|
|
240
|
-
output: `switch (value) {
|
|
241
|
-
|
|
242
|
-
// @story <story-file>.story.md
|
|
243
|
-
case 'a':
|
|
244
|
-
break;
|
|
245
|
-
}`,
|
|
246
|
-
errors: [
|
|
247
|
-
{ messageId: "missingAnnotation", data: { missing: "@story" } },
|
|
248
|
-
{ messageId: "missingAnnotation", data: { missing: "@req" } },
|
|
249
|
-
],
|
|
250
|
-
},
|
|
251
|
-
],
|
|
252
|
-
});
|
|
253
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,41 +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
|
-
* Tests for: docs/stories/003.0-DEV-FUNCTION-ANNOTATIONS.story.md
|
|
8
|
-
* @story docs/stories/003.0-DEV-FUNCTION-ANNOTATIONS.story.md
|
|
9
|
-
* @req REQ-ANNOTATION-REQUIRED - Verify require-req-annotation rule enforces @req on functions
|
|
10
|
-
*/
|
|
11
|
-
const eslint_1 = require("eslint");
|
|
12
|
-
const require_req_annotation_1 = __importDefault(require("../../src/rules/require-req-annotation"));
|
|
13
|
-
const ruleTester = new eslint_1.RuleTester();
|
|
14
|
-
describe("Require Req Annotation Rule (Story 003.0-DEV-FUNCTION-ANNOTATIONS)", () => {
|
|
15
|
-
ruleTester.run("require-req-annotation", require_req_annotation_1.default, {
|
|
16
|
-
valid: [
|
|
17
|
-
{
|
|
18
|
-
name: "[REQ-ANNOTATION-REQUIRED] valid with only @req annotation",
|
|
19
|
-
code: `/**\n * @req REQ-EXAMPLE\n */\nfunction foo() {}`,
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
name: "[REQ-ANNOTATION-REQUIRED] valid with @story and @req annotations",
|
|
23
|
-
code: `/**\n * @story docs/stories/003.0-DEV-FUNCTION-ANNOTATIONS.story.md\n * @req REQ-EXAMPLE\n */\nfunction bar() {}`,
|
|
24
|
-
},
|
|
25
|
-
],
|
|
26
|
-
invalid: [
|
|
27
|
-
{
|
|
28
|
-
name: "[REQ-ANNOTATION-REQUIRED] missing @req on function without JSDoc",
|
|
29
|
-
code: `function baz() {}`,
|
|
30
|
-
output: `/** @req <REQ-ID> */\nfunction baz() {}`,
|
|
31
|
-
errors: [{ messageId: "missingReq" }],
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
name: "[REQ-ANNOTATION-REQUIRED] missing @req on function with only @story annotation",
|
|
35
|
-
code: `/**\n * @story docs/stories/003.0-DEV-FUNCTION-ANNOTATIONS.story.md\n */\nfunction qux() {}`,
|
|
36
|
-
output: `/**\n * @story docs/stories/003.0-DEV-FUNCTION-ANNOTATIONS.story.md\n */\n/** @req <REQ-ID> */\nfunction qux() {}`,
|
|
37
|
-
errors: [{ messageId: "missingReq" }],
|
|
38
|
-
},
|
|
39
|
-
],
|
|
40
|
-
});
|
|
41
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,36 +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
|
-
* Tests for: docs/stories/003.0-DEV-FUNCTION-ANNOTATIONS.story.md
|
|
8
|
-
* @story docs/stories/003.0-DEV-FUNCTION-ANNOTATIONS.story.md
|
|
9
|
-
* @req REQ-ANNOTATION-REQUIRED - Verify require-story-annotation rule enforces @story annotation on functions
|
|
10
|
-
*/
|
|
11
|
-
const eslint_1 = require("eslint");
|
|
12
|
-
const require_story_annotation_1 = __importDefault(require("../../src/rules/require-story-annotation"));
|
|
13
|
-
const ruleTester = new eslint_1.RuleTester();
|
|
14
|
-
describe("Require Story Annotation Rule (Story 003.0-DEV-FUNCTION-ANNOTATIONS)", () => {
|
|
15
|
-
ruleTester.run("require-story-annotation", require_story_annotation_1.default, {
|
|
16
|
-
valid: [
|
|
17
|
-
{
|
|
18
|
-
name: "[REQ-ANNOTATION-REQUIRED] valid with JSDoc @story annotation",
|
|
19
|
-
code: `/**\n * @story docs/stories/003.0-DEV-FUNCTION-ANNOTATIONS.story.md\n */\nfunction foo() {}`,
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
name: "[REQ-ANNOTATION-REQUIRED] valid with line comment @story annotation",
|
|
23
|
-
code: `// @story docs/stories/003.0-DEV-FUNCTION-ANNOTATIONS.story.md
|
|
24
|
-
function foo() {}`,
|
|
25
|
-
},
|
|
26
|
-
],
|
|
27
|
-
invalid: [
|
|
28
|
-
{
|
|
29
|
-
name: "[REQ-ANNOTATION-REQUIRED] missing @story annotation on function",
|
|
30
|
-
code: `function bar() {}`,
|
|
31
|
-
output: `/** @story <story-file>.story.md */\nfunction bar() {}`,
|
|
32
|
-
errors: [{ messageId: "missingStory" }],
|
|
33
|
-
},
|
|
34
|
-
],
|
|
35
|
-
});
|
|
36
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,58 +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
|
-
* Tests for: docs/stories/005.0-DEV-ANNOTATION-VALIDATION.story.md
|
|
8
|
-
* @story docs/stories/005.0-DEV-ANNOTATION-VALIDATION.story.md
|
|
9
|
-
* @req REQ-FORMAT-SPECIFICATION - Verify valid-annotation-format rule enforces annotation format syntax
|
|
10
|
-
*/
|
|
11
|
-
const eslint_1 = require("eslint");
|
|
12
|
-
const valid_annotation_format_1 = __importDefault(require("../../src/rules/valid-annotation-format"));
|
|
13
|
-
const ruleTester = new eslint_1.RuleTester({
|
|
14
|
-
languageOptions: { parserOptions: { ecmaVersion: 2020 } },
|
|
15
|
-
});
|
|
16
|
-
describe("Valid Annotation Format Rule (Story 005.0-DEV-ANNOTATION-VALIDATION)", () => {
|
|
17
|
-
ruleTester.run("valid-annotation-format", valid_annotation_format_1.default, {
|
|
18
|
-
valid: [
|
|
19
|
-
{
|
|
20
|
-
name: "[REQ-PATH-FORMAT] valid story annotation format",
|
|
21
|
-
code: `// @story docs/stories/005.0-DEV-ANNOTATION-VALIDATION.story.md`,
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
name: "[REQ-REQ-FORMAT] valid req annotation format",
|
|
25
|
-
code: `// @req REQ-EXAMPLE`,
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
name: "[REQ-FORMAT-SPECIFICATION] valid block annotations",
|
|
29
|
-
code: `/**
|
|
30
|
-
* @story docs/stories/005.0-DEV-ANNOTATION-VALIDATION.story.md
|
|
31
|
-
* @req REQ-VALID-EXAMPLE
|
|
32
|
-
*/`,
|
|
33
|
-
},
|
|
34
|
-
],
|
|
35
|
-
invalid: [
|
|
36
|
-
{
|
|
37
|
-
name: "[REQ-PATH-FORMAT] missing story path",
|
|
38
|
-
code: `// @story`,
|
|
39
|
-
errors: [{ messageId: "invalidStoryFormat" }],
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
name: "[REQ-PATH-FORMAT] invalid story file extension",
|
|
43
|
-
code: `// @story docs/stories/005.0-DEV-ANNOTATION-VALIDATION.story`,
|
|
44
|
-
errors: [{ messageId: "invalidStoryFormat" }],
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
name: "[REQ-REQ-FORMAT] missing req id",
|
|
48
|
-
code: `// @req`,
|
|
49
|
-
errors: [{ messageId: "invalidReqFormat" }],
|
|
50
|
-
},
|
|
51
|
-
{
|
|
52
|
-
name: "[REQ-REQ-FORMAT] invalid req id format",
|
|
53
|
-
code: `// @req invalid-format`,
|
|
54
|
-
errors: [{ messageId: "invalidReqFormat" }],
|
|
55
|
-
},
|
|
56
|
-
],
|
|
57
|
-
});
|
|
58
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|