eslint-plugin-traceability 1.22.0 → 1.23.1
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/CHANGELOG.md +8 -7
- package/lib/{src/rules → rules}/require-req-annotation.js +51 -45
- package/package.json +9 -13
- package/user-docs/api-reference.md +2 -2
- package/lib/tests/cli-error-handling.test.d.ts +0 -1
- package/lib/tests/cli-error-handling.test.js +0 -54
- package/lib/tests/config/eslint-config-validation.test.d.ts +0 -9
- package/lib/tests/config/eslint-config-validation.test.js +0 -101
- package/lib/tests/config/flat-config-presets-integration.test.d.ts +0 -1
- package/lib/tests/config/flat-config-presets-integration.test.js +0 -76
- package/lib/tests/config/require-story-annotation-config.test.d.ts +0 -10
- package/lib/tests/config/require-story-annotation-config.test.js +0 -26
- package/lib/tests/fixtures/stale/example.d.ts +0 -0
- package/lib/tests/fixtures/stale/example.js +0 -4
- package/lib/tests/fixtures/update/example.d.ts +0 -0
- package/lib/tests/fixtures/update/example.js +0 -4
- package/lib/tests/fixtures/valid-annotations/example.d.ts +0 -0
- package/lib/tests/fixtures/valid-annotations/example.js +0 -3
- package/lib/tests/integration/annotation-placement-inside-prettier.integration.test.d.ts +0 -1
- package/lib/tests/integration/annotation-placement-inside-prettier.integration.test.js +0 -133
- package/lib/tests/integration/catch-annotation-prettier.integration.test.d.ts +0 -1
- package/lib/tests/integration/catch-annotation-prettier.integration.test.js +0 -121
- package/lib/tests/integration/cli-integration.test.d.ts +0 -1
- package/lib/tests/integration/cli-integration.test.js +0 -96
- package/lib/tests/integration/else-if-annotation-prettier.integration.test.d.ts +0 -1
- package/lib/tests/integration/else-if-annotation-prettier.integration.test.js +0 -100
- package/lib/tests/integration/no-redundant-annotation.integration.test.d.ts +0 -1
- package/lib/tests/integration/no-redundant-annotation.integration.test.js +0 -129
- package/lib/tests/integration/prettier-test-helpers.d.ts +0 -9
- package/lib/tests/integration/prettier-test-helpers.js +0 -35
- package/lib/tests/integration/require-traceability-aliases.integration.test.d.ts +0 -1
- package/lib/tests/integration/require-traceability-aliases.integration.test.js +0 -152
- package/lib/tests/integration/require-traceability-test-callbacks.integration.test.d.ts +0 -1
- package/lib/tests/integration/require-traceability-test-callbacks.integration.test.js +0 -149
- package/lib/tests/maintenance/batch.test.d.ts +0 -1
- package/lib/tests/maintenance/batch.test.js +0 -80
- package/lib/tests/maintenance/cli.test.d.ts +0 -1
- package/lib/tests/maintenance/cli.test.js +0 -306
- package/lib/tests/maintenance/detect-isolated.test.d.ts +0 -1
- package/lib/tests/maintenance/detect-isolated.test.js +0 -187
- package/lib/tests/maintenance/detect.test.d.ts +0 -1
- package/lib/tests/maintenance/detect.test.js +0 -46
- package/lib/tests/maintenance/index.test.d.ts +0 -1
- package/lib/tests/maintenance/index.test.js +0 -26
- package/lib/tests/maintenance/report.test.d.ts +0 -1
- package/lib/tests/maintenance/report.test.js +0 -68
- package/lib/tests/maintenance/storyParser.test.d.ts +0 -8
- package/lib/tests/maintenance/storyParser.test.js +0 -505
- package/lib/tests/maintenance/update-isolated.test.d.ts +0 -1
- package/lib/tests/maintenance/update-isolated.test.js +0 -71
- package/lib/tests/maintenance/update.test.d.ts +0 -1
- package/lib/tests/maintenance/update.test.js +0 -27
- package/lib/tests/perf/maintenance-cli-large-workspace.test.d.ts +0 -1
- package/lib/tests/perf/maintenance-cli-large-workspace.test.js +0 -229
- package/lib/tests/perf/maintenance-large-workspace.test.d.ts +0 -1
- package/lib/tests/perf/maintenance-large-workspace.test.js +0 -169
- package/lib/tests/perf/require-branch-annotation-large-file.test.d.ts +0 -1
- package/lib/tests/perf/require-branch-annotation-large-file.test.js +0 -67
- package/lib/tests/perf/valid-annotation-format-large-file.test.d.ts +0 -1
- package/lib/tests/perf/valid-annotation-format-large-file.test.js +0 -75
- package/lib/tests/plugin-default-export-and-configs.test.d.ts +0 -1
- package/lib/tests/plugin-default-export-and-configs.test.js +0 -121
- package/lib/tests/plugin-setup-error.test.d.ts +0 -6
- package/lib/tests/plugin-setup-error.test.js +0 -38
- package/lib/tests/plugin-setup.test.d.ts +0 -1
- package/lib/tests/plugin-setup.test.js +0 -63
- package/lib/tests/rules/auto-fix-behavior-008.test.d.ts +0 -1
- package/lib/tests/rules/auto-fix-behavior-008.test.js +0 -285
- package/lib/tests/rules/error-reporting.test.d.ts +0 -1
- package/lib/tests/rules/error-reporting.test.js +0 -99
- package/lib/tests/rules/no-redundant-annotation.test.d.ts +0 -1
- package/lib/tests/rules/no-redundant-annotation.test.js +0 -163
- package/lib/tests/rules/prefer-implements-annotation.test.d.ts +0 -1
- package/lib/tests/rules/prefer-implements-annotation.test.js +0 -162
- package/lib/tests/rules/require-branch-annotation.test.d.ts +0 -1
- package/lib/tests/rules/require-branch-annotation.test.js +0 -593
- package/lib/tests/rules/require-req-annotation.test.d.ts +0 -1
- package/lib/tests/rules/require-req-annotation.test.js +0 -246
- package/lib/tests/rules/require-story-annotation.test.d.ts +0 -1
- package/lib/tests/rules/require-story-annotation.test.js +0 -376
- package/lib/tests/rules/require-story-core-edgecases.test.d.ts +0 -1
- package/lib/tests/rules/require-story-core-edgecases.test.js +0 -15
- package/lib/tests/rules/require-story-core.autofix.test.d.ts +0 -1
- package/lib/tests/rules/require-story-core.autofix.test.js +0 -66
- package/lib/tests/rules/require-story-core.test.d.ts +0 -1
- package/lib/tests/rules/require-story-core.test.js +0 -65
- package/lib/tests/rules/require-story-helpers-edgecases.test.d.ts +0 -7
- package/lib/tests/rules/require-story-helpers-edgecases.test.js +0 -80
- package/lib/tests/rules/require-story-helpers.test.d.ts +0 -1
- package/lib/tests/rules/require-story-helpers.test.js +0 -474
- package/lib/tests/rules/require-story-io-behavior.test.d.ts +0 -7
- package/lib/tests/rules/require-story-io-behavior.test.js +0 -46
- package/lib/tests/rules/require-story-io.edgecases.test.d.ts +0 -7
- package/lib/tests/rules/require-story-io.edgecases.test.js +0 -46
- package/lib/tests/rules/require-story-utils.test.d.ts +0 -7
- package/lib/tests/rules/require-story-utils.test.js +0 -158
- package/lib/tests/rules/require-story-visitors-edgecases.test.d.ts +0 -7
- package/lib/tests/rules/require-story-visitors-edgecases.test.js +0 -27
- package/lib/tests/rules/require-test-traceability.test.d.ts +0 -1
- package/lib/tests/rules/require-test-traceability.test.js +0 -95
- package/lib/tests/rules/valid-annotation-format-internal.test.d.ts +0 -8
- package/lib/tests/rules/valid-annotation-format-internal.test.js +0 -47
- package/lib/tests/rules/valid-annotation-format.test.d.ts +0 -1
- package/lib/tests/rules/valid-annotation-format.test.js +0 -634
- package/lib/tests/rules/valid-req-reference.test.d.ts +0 -1
- package/lib/tests/rules/valid-req-reference.test.js +0 -129
- package/lib/tests/rules/valid-story-reference.test.d.ts +0 -1
- package/lib/tests/rules/valid-story-reference.test.js +0 -413
- package/lib/tests/utils/annotation-checker-autofix-behavior.test.d.ts +0 -5
- package/lib/tests/utils/annotation-checker-autofix-behavior.test.js +0 -103
- package/lib/tests/utils/annotation-checker.test.d.ts +0 -24
- package/lib/tests/utils/annotation-checker.test.js +0 -84
- package/lib/tests/utils/annotation-scope-analyzer.test.d.ts +0 -1
- package/lib/tests/utils/annotation-scope-analyzer.test.js +0 -211
- package/lib/tests/utils/branch-annotation-catch-insert-position.test.d.ts +0 -1
- package/lib/tests/utils/branch-annotation-catch-insert-position.test.js +0 -69
- package/lib/tests/utils/branch-annotation-catch-position.test.d.ts +0 -1
- package/lib/tests/utils/branch-annotation-catch-position.test.js +0 -115
- package/lib/tests/utils/branch-annotation-else-if-insert-position.test.d.ts +0 -1
- package/lib/tests/utils/branch-annotation-else-if-insert-position.test.js +0 -82
- package/lib/tests/utils/branch-annotation-else-if-position.test.d.ts +0 -1
- package/lib/tests/utils/branch-annotation-else-if-position.test.js +0 -145
- package/lib/tests/utils/branch-annotation-helpers.test.d.ts +0 -1
- package/lib/tests/utils/branch-annotation-helpers.test.js +0 -462
- package/lib/tests/utils/fsTestHelpers.d.ts +0 -7
- package/lib/tests/utils/fsTestHelpers.js +0 -26
- package/lib/tests/utils/ioTestHelpers.d.ts +0 -7
- package/lib/tests/utils/ioTestHelpers.js +0 -24
- package/lib/tests/utils/req-annotation-detection.test.d.ts +0 -1
- package/lib/tests/utils/req-annotation-detection.test.js +0 -358
- package/lib/tests/utils/require-story-core-test-helpers.d.ts +0 -10
- package/lib/tests/utils/require-story-core-test-helpers.js +0 -75
- package/lib/tests/utils/temp-dir-helpers.d.ts +0 -19
- package/lib/tests/utils/temp-dir-helpers.js +0 -62
- package/lib/tests/utils/ts-language-options.d.ts +0 -16
- package/lib/tests/utils/ts-language-options.js +0 -30
- /package/lib/{src/index.d.ts → index.d.ts} +0 -0
- /package/lib/{src/index.js → index.js} +0 -0
- /package/lib/{src/maintenance → maintenance}/batch.d.ts +0 -0
- /package/lib/{src/maintenance → maintenance}/batch.js +0 -0
- /package/lib/{src/maintenance → maintenance}/cli.d.ts +0 -0
- /package/lib/{src/maintenance → maintenance}/cli.js +0 -0
- /package/lib/{src/maintenance → maintenance}/commands.d.ts +0 -0
- /package/lib/{src/maintenance → maintenance}/commands.js +0 -0
- /package/lib/{src/maintenance → maintenance}/detect.d.ts +0 -0
- /package/lib/{src/maintenance → maintenance}/detect.js +0 -0
- /package/lib/{src/maintenance → maintenance}/flags.d.ts +0 -0
- /package/lib/{src/maintenance → maintenance}/flags.js +0 -0
- /package/lib/{src/maintenance → maintenance}/index.d.ts +0 -0
- /package/lib/{src/maintenance → maintenance}/index.js +0 -0
- /package/lib/{src/maintenance → maintenance}/report.d.ts +0 -0
- /package/lib/{src/maintenance → maintenance}/report.js +0 -0
- /package/lib/{src/maintenance → maintenance}/storyParser.d.ts +0 -0
- /package/lib/{src/maintenance → maintenance}/storyParser.js +0 -0
- /package/lib/{src/maintenance → maintenance}/update.d.ts +0 -0
- /package/lib/{src/maintenance → maintenance}/update.js +0 -0
- /package/lib/{src/maintenance → maintenance}/utils.d.ts +0 -0
- /package/lib/{src/maintenance → maintenance}/utils.js +0 -0
- /package/lib/{src/rules → rules}/helpers/pattern-validators.d.ts +0 -0
- /package/lib/{src/rules → rules}/helpers/pattern-validators.js +0 -0
- /package/lib/{src/rules → rules}/helpers/prefer-implements-inline.d.ts +0 -0
- /package/lib/{src/rules → rules}/helpers/prefer-implements-inline.js +0 -0
- /package/lib/{src/rules → rules}/helpers/require-story-comment-detection.d.ts +0 -0
- /package/lib/{src/rules → rules}/helpers/require-story-comment-detection.js +0 -0
- /package/lib/{src/rules → rules}/helpers/require-story-core.d.ts +0 -0
- /package/lib/{src/rules → rules}/helpers/require-story-core.js +0 -0
- /package/lib/{src/rules → rules}/helpers/require-story-helpers.d.ts +0 -0
- /package/lib/{src/rules → rules}/helpers/require-story-helpers.js +0 -0
- /package/lib/{src/rules → rules}/helpers/require-story-io.d.ts +0 -0
- /package/lib/{src/rules → rules}/helpers/require-story-io.js +0 -0
- /package/lib/{src/rules → rules}/helpers/require-story-name-extraction.d.ts +0 -0
- /package/lib/{src/rules → rules}/helpers/require-story-name-extraction.js +0 -0
- /package/lib/{src/rules → rules}/helpers/require-story-node-utils.d.ts +0 -0
- /package/lib/{src/rules → rules}/helpers/require-story-node-utils.js +0 -0
- /package/lib/{src/rules → rules}/helpers/require-story-utils.d.ts +0 -0
- /package/lib/{src/rules → rules}/helpers/require-story-utils.js +0 -0
- /package/lib/{src/rules → rules}/helpers/require-story-visitors.d.ts +0 -0
- /package/lib/{src/rules → rules}/helpers/require-story-visitors.js +0 -0
- /package/lib/{src/rules → rules}/helpers/require-test-traceability-helpers.d.ts +0 -0
- /package/lib/{src/rules → rules}/helpers/require-test-traceability-helpers.js +0 -0
- /package/lib/{src/rules → rules}/helpers/test-callback-exclusion.d.ts +0 -0
- /package/lib/{src/rules → rules}/helpers/test-callback-exclusion.js +0 -0
- /package/lib/{src/rules → rules}/helpers/valid-annotation-format-internal.d.ts +0 -0
- /package/lib/{src/rules → rules}/helpers/valid-annotation-format-internal.js +0 -0
- /package/lib/{src/rules → rules}/helpers/valid-annotation-format-validators.d.ts +0 -0
- /package/lib/{src/rules → rules}/helpers/valid-annotation-format-validators.js +0 -0
- /package/lib/{src/rules → rules}/helpers/valid-annotation-options.d.ts +0 -0
- /package/lib/{src/rules → rules}/helpers/valid-annotation-options.js +0 -0
- /package/lib/{src/rules → rules}/helpers/valid-annotation-utils.d.ts +0 -0
- /package/lib/{src/rules → rules}/helpers/valid-annotation-utils.js +0 -0
- /package/lib/{src/rules → rules}/helpers/valid-implements-utils.d.ts +0 -0
- /package/lib/{src/rules → rules}/helpers/valid-implements-utils.js +0 -0
- /package/lib/{src/rules → rules}/helpers/valid-req-reference-helpers.d.ts +0 -0
- /package/lib/{src/rules → rules}/helpers/valid-req-reference-helpers.js +0 -0
- /package/lib/{src/rules → rules}/helpers/valid-story-reference-helpers.d.ts +0 -0
- /package/lib/{src/rules → rules}/helpers/valid-story-reference-helpers.js +0 -0
- /package/lib/{src/rules → rules}/no-redundant-annotation.d.ts +0 -0
- /package/lib/{src/rules → rules}/no-redundant-annotation.js +0 -0
- /package/lib/{src/rules → rules}/prefer-implements-annotation.d.ts +0 -0
- /package/lib/{src/rules → rules}/prefer-implements-annotation.js +0 -0
- /package/lib/{src/rules → rules}/require-branch-annotation.d.ts +0 -0
- /package/lib/{src/rules → rules}/require-branch-annotation.js +0 -0
- /package/lib/{src/rules → rules}/require-req-annotation.d.ts +0 -0
- /package/lib/{src/rules → rules}/require-story-annotation.d.ts +0 -0
- /package/lib/{src/rules → rules}/require-story-annotation.js +0 -0
- /package/lib/{src/rules → rules}/require-test-traceability.d.ts +0 -0
- /package/lib/{src/rules → rules}/require-test-traceability.js +0 -0
- /package/lib/{src/rules → rules}/require-traceability.d.ts +0 -0
- /package/lib/{src/rules → rules}/require-traceability.js +0 -0
- /package/lib/{src/rules → rules}/valid-annotation-format.d.ts +0 -0
- /package/lib/{src/rules → rules}/valid-annotation-format.js +0 -0
- /package/lib/{src/rules → rules}/valid-req-reference.d.ts +0 -0
- /package/lib/{src/rules → rules}/valid-req-reference.js +0 -0
- /package/lib/{src/rules → rules}/valid-story-reference.d.ts +0 -0
- /package/lib/{src/rules → rules}/valid-story-reference.js +0 -0
- /package/lib/{src/utils → utils}/annotation-checker.d.ts +0 -0
- /package/lib/{src/utils → utils}/annotation-checker.js +0 -0
- /package/lib/{src/utils → utils}/annotation-scope-analyzer.d.ts +0 -0
- /package/lib/{src/utils → utils}/annotation-scope-analyzer.js +0 -0
- /package/lib/{src/utils → utils}/branch-annotation-catch-helpers.d.ts +0 -0
- /package/lib/{src/utils → utils}/branch-annotation-catch-helpers.js +0 -0
- /package/lib/{src/utils → utils}/branch-annotation-helpers.d.ts +0 -0
- /package/lib/{src/utils → utils}/branch-annotation-helpers.js +0 -0
- /package/lib/{src/utils → utils}/branch-annotation-if-helpers.d.ts +0 -0
- /package/lib/{src/utils → utils}/branch-annotation-if-helpers.js +0 -0
- /package/lib/{src/utils → utils}/branch-annotation-indent-helpers.d.ts +0 -0
- /package/lib/{src/utils → utils}/branch-annotation-indent-helpers.js +0 -0
- /package/lib/{src/utils → utils}/branch-annotation-loop-helpers.d.ts +0 -0
- /package/lib/{src/utils → utils}/branch-annotation-loop-helpers.js +0 -0
- /package/lib/{src/utils → utils}/branch-annotation-report-helpers.d.ts +0 -0
- /package/lib/{src/utils → utils}/branch-annotation-report-helpers.js +0 -0
- /package/lib/{src/utils → utils}/branch-annotation-story-fix-helpers.d.ts +0 -0
- /package/lib/{src/utils → utils}/branch-annotation-story-fix-helpers.js +0 -0
- /package/lib/{src/utils → utils}/branch-annotation-switch-helpers.d.ts +0 -0
- /package/lib/{src/utils → utils}/branch-annotation-switch-helpers.js +0 -0
- /package/lib/{src/utils → utils}/branch-validation.d.ts +0 -0
- /package/lib/{src/utils → utils}/branch-validation.js +0 -0
- /package/lib/{src/utils → utils}/comment-text-helpers.d.ts +0 -0
- /package/lib/{src/utils → utils}/comment-text-helpers.js +0 -0
- /package/lib/{src/utils → utils}/function-annotation-helpers.d.ts +0 -0
- /package/lib/{src/utils → utils}/function-annotation-helpers.js +0 -0
- /package/lib/{src/utils → utils}/redundancy-detector.d.ts +0 -0
- /package/lib/{src/utils → utils}/redundancy-detector.js +0 -0
- /package/lib/{src/utils → utils}/reqAnnotationDetection.d.ts +0 -0
- /package/lib/{src/utils → utils}/reqAnnotationDetection.js +0 -0
- /package/lib/{src/utils → utils}/storyReferenceUtils.d.ts +0 -0
- /package/lib/{src/utils → utils}/storyReferenceUtils.js +0 -0
|
@@ -1,152 +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
|
-
* Integration tests for unified require-traceability rule and its legacy aliases.
|
|
38
|
-
*
|
|
39
|
-
* @supports docs/stories/010.4-DEV-UNIFIED-FUNCTION-RULE-AND-ALIASES.story.md REQ-UNIFIED-ALIAS-ENGINE REQ-SUPPORTS-FIRST-MODEL REQ-PRESETS-CANONICAL-RULE
|
|
40
|
-
*/
|
|
41
|
-
const use_at_your_own_risk_1 = require("eslint/use-at-your-own-risk");
|
|
42
|
-
const index_1 = __importStar(require("../../src/index"));
|
|
43
|
-
async function lintTextWithConfig(text, filename, extraConfig) {
|
|
44
|
-
const baseConfig = {
|
|
45
|
-
plugins: {
|
|
46
|
-
traceability: index_1.default,
|
|
47
|
-
},
|
|
48
|
-
};
|
|
49
|
-
const eslint = new use_at_your_own_risk_1.FlatESLint({
|
|
50
|
-
overrideConfig: [baseConfig, ...extraConfig],
|
|
51
|
-
overrideConfigFile: true,
|
|
52
|
-
ignore: false,
|
|
53
|
-
});
|
|
54
|
-
const [result] = await eslint.lintText(text, { filePath: filename });
|
|
55
|
-
return result;
|
|
56
|
-
}
|
|
57
|
-
describe("Unified require-traceability and aliases integration (Story 010.4-DEV-UNIFIED-FUNCTION-RULE-AND-ALIASES)", () => {
|
|
58
|
-
const codeMissingAll = "function foo() {}";
|
|
59
|
-
const codeWithSupportsOnly = `/**\n * @supports docs/stories/003.0-DEV-FUNCTION-ANNOTATIONS.story.md REQ-ANNOTATION-REQUIRED\n */\nfunction foo() {}`;
|
|
60
|
-
const codeWithStoryAndReq = `/**\n * @story docs/stories/003.0-DEV-FUNCTION-ANNOTATIONS.story.md\n * @req REQ-ANNOTATION-REQUIRED\n */\nfunction foo() {}`;
|
|
61
|
-
async function getDiagnosticsForRule(ruleKey, code) {
|
|
62
|
-
const config = [
|
|
63
|
-
{
|
|
64
|
-
rules: {
|
|
65
|
-
[ruleKey]: "error",
|
|
66
|
-
},
|
|
67
|
-
},
|
|
68
|
-
];
|
|
69
|
-
const result = await lintTextWithConfig(code, "example.js", config);
|
|
70
|
-
return result.messages.map((m) => ({
|
|
71
|
-
ruleId: m.ruleId,
|
|
72
|
-
messageId: m.messageId,
|
|
73
|
-
}));
|
|
74
|
-
}
|
|
75
|
-
it("[REQ-UNIFIED-ALIAS-ENGINE] canonical and alias keys all report missing traceability on unannotated function", async () => {
|
|
76
|
-
const ruleKeys = [
|
|
77
|
-
"traceability/require-traceability",
|
|
78
|
-
"traceability/require-story-annotation",
|
|
79
|
-
"traceability/require-req-annotation",
|
|
80
|
-
];
|
|
81
|
-
const results = await Promise.all(ruleKeys.map((ruleKey) => getDiagnosticsForRule(ruleKey, codeMissingAll)));
|
|
82
|
-
results.forEach((messages, index) => {
|
|
83
|
-
const ruleKey = ruleKeys[index];
|
|
84
|
-
expect(messages.length).toBeGreaterThan(0);
|
|
85
|
-
messages.forEach((msg) => {
|
|
86
|
-
expect(msg.ruleId).toBe(ruleKey);
|
|
87
|
-
});
|
|
88
|
-
});
|
|
89
|
-
});
|
|
90
|
-
it("[REQ-SUPPORTS-FIRST-MODEL] @supports-only annotation satisfies all three rule keys", async () => {
|
|
91
|
-
const ruleKeys = [
|
|
92
|
-
"traceability/require-traceability",
|
|
93
|
-
"traceability/require-story-annotation",
|
|
94
|
-
"traceability/require-req-annotation",
|
|
95
|
-
];
|
|
96
|
-
const results = await Promise.all(ruleKeys.map((ruleKey) => getDiagnosticsForRule(ruleKey, codeWithSupportsOnly)));
|
|
97
|
-
results.forEach((messages) => {
|
|
98
|
-
expect(messages).toHaveLength(0);
|
|
99
|
-
});
|
|
100
|
-
});
|
|
101
|
-
it("[REQ-SUPPORTS-FIRST-MODEL] @story + @req annotation satisfies all three rule keys", async () => {
|
|
102
|
-
const ruleKeys = [
|
|
103
|
-
"traceability/require-traceability",
|
|
104
|
-
"traceability/require-story-annotation",
|
|
105
|
-
"traceability/require-req-annotation",
|
|
106
|
-
];
|
|
107
|
-
const results = await Promise.all(ruleKeys.map((ruleKey) => getDiagnosticsForRule(ruleKey, codeWithStoryAndReq)));
|
|
108
|
-
results.forEach((messages) => {
|
|
109
|
-
expect(messages).toHaveLength(0);
|
|
110
|
-
});
|
|
111
|
-
});
|
|
112
|
-
it("[REQ-INSIDE-BRACE-PLACEMENT][REQ-ALL-BLOCK-TYPES] unified rule and aliases accept inside-brace annotations when annotationPlacement is 'inside'", async () => {
|
|
113
|
-
const codeWithInsideAnnotations = `function foo() {\n // @supports docs/stories/028.0-DEV-ANNOTATION-PLACEMENT-STANDARDIZATION.story.md REQ-FN-INSIDE\n return 1;\n}`;
|
|
114
|
-
const config = [
|
|
115
|
-
{
|
|
116
|
-
rules: {
|
|
117
|
-
"traceability/require-traceability": "error",
|
|
118
|
-
"traceability/require-story-annotation": [
|
|
119
|
-
"error",
|
|
120
|
-
{
|
|
121
|
-
annotationPlacement: "inside",
|
|
122
|
-
},
|
|
123
|
-
],
|
|
124
|
-
"traceability/require-req-annotation": [
|
|
125
|
-
"error",
|
|
126
|
-
{
|
|
127
|
-
annotationPlacement: "inside",
|
|
128
|
-
},
|
|
129
|
-
],
|
|
130
|
-
},
|
|
131
|
-
},
|
|
132
|
-
];
|
|
133
|
-
const result = await lintTextWithConfig(codeWithInsideAnnotations, "example.js", config);
|
|
134
|
-
const ruleIds = result.messages.map((m) => m.ruleId);
|
|
135
|
-
expect(ruleIds).not.toContain("traceability/require-story-annotation");
|
|
136
|
-
expect(ruleIds).not.toContain("traceability/require-req-annotation");
|
|
137
|
-
});
|
|
138
|
-
it("[REQ-PRESETS-CANONICAL-RULE] recommended preset surfaces unified and legacy diagnostics together for missing annotations", async () => {
|
|
139
|
-
const result = await lintTextWithConfig(codeMissingAll, "example.js", index_1.configs.recommended);
|
|
140
|
-
const ruleIds = result.messages.map((m) => m.ruleId).sort();
|
|
141
|
-
expect(ruleIds).toContain("traceability/require-traceability");
|
|
142
|
-
expect(ruleIds).toContain("traceability/require-story-annotation");
|
|
143
|
-
expect(ruleIds).toContain("traceability/require-req-annotation");
|
|
144
|
-
});
|
|
145
|
-
it("[REQ-PRESETS-CANONICAL-RULE] strict preset surfaces unified and legacy diagnostics together for missing annotations", async () => {
|
|
146
|
-
const result = await lintTextWithConfig(codeMissingAll, "example.js", index_1.configs.strict);
|
|
147
|
-
const ruleIds = result.messages.map((m) => m.ruleId).sort();
|
|
148
|
-
expect(ruleIds).toContain("traceability/require-traceability");
|
|
149
|
-
expect(ruleIds).toContain("traceability/require-story-annotation");
|
|
150
|
-
expect(ruleIds).toContain("traceability/require-req-annotation");
|
|
151
|
-
});
|
|
152
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,149 +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
|
-
/* eslint-disable traceability/valid-annotation-format */
|
|
7
|
-
/**
|
|
8
|
-
* Integration tests for require-traceability with configurable test callback exclusion.
|
|
9
|
-
*
|
|
10
|
-
* @supports docs/stories/010.4-DEV-UNIFIED-FUNCTION-RULE-AND-ALIASES.story.md REQ-UNIFIED-ALIAS-ENGINE
|
|
11
|
-
* @supports docs/stories/003.0-DEV-FUNCTION-ANNOTATIONS.story.md REQ-ANNOTATION-REQUIRED REQ-FUNCTION-DETECTION
|
|
12
|
-
* @supports docs/stories/013-exclude-test-framework-callbacks.proposed.md REQ-TEST-CALLBACK-EXCLUSION
|
|
13
|
-
*/
|
|
14
|
-
const use_at_your_own_risk_1 = require("eslint/use-at-your-own-risk");
|
|
15
|
-
const index_1 = __importDefault(require("../../src/index"));
|
|
16
|
-
async function lintTextWithConfig(text, filename, extraConfig) {
|
|
17
|
-
const baseConfig = {
|
|
18
|
-
plugins: {
|
|
19
|
-
traceability: index_1.default,
|
|
20
|
-
},
|
|
21
|
-
};
|
|
22
|
-
const eslint = new use_at_your_own_risk_1.FlatESLint({
|
|
23
|
-
overrideConfig: [baseConfig, ...extraConfig],
|
|
24
|
-
overrideConfigFile: true,
|
|
25
|
-
ignore: false,
|
|
26
|
-
});
|
|
27
|
-
const [result] = await eslint.lintText(text, { filePath: filename });
|
|
28
|
-
return result;
|
|
29
|
-
}
|
|
30
|
-
describe("Unified require-traceability with configurable test callback exclusion (Story 013-exclude-test-framework-callbacks)", () => {
|
|
31
|
-
const baseHeader = `/**\n * @supports docs/stories/003.0-DEV-FUNCTION-ANNOTATIONS.story.md REQ-ANNOTATION-REQUIRED\n */`;
|
|
32
|
-
const jsTestCallback = `${baseHeader}\n
|
|
33
|
-
describe('suite', () => {\n it('does something', () => {\n const value = 1;\n });\n});`;
|
|
34
|
-
const tsTestCallback = `${baseHeader}\n
|
|
35
|
-
import { describe, it } from 'vitest';
|
|
36
|
-
|
|
37
|
-
describe('suite', () => {\n it('does something', () => {\n const value = 1;\n });\n});`;
|
|
38
|
-
const jsBenchCallback = `${baseHeader}\n
|
|
39
|
-
import { bench } from 'vitest';
|
|
40
|
-
|
|
41
|
-
bench('bench case', () => {\n function helper() {}\n helper();\n});`;
|
|
42
|
-
const jsCustomHelperCallback = `${baseHeader}\n
|
|
43
|
-
function helperWrapper(fn) {\n return fn;\n}
|
|
44
|
-
|
|
45
|
-
helperWrapper(() => {\n function helper() {}\n helper();\n});`;
|
|
46
|
-
async function getRuleMessages(code, filename, extraConfig) {
|
|
47
|
-
const result = await lintTextWithConfig(code, filename, extraConfig);
|
|
48
|
-
return result.messages.filter((m) => m.ruleId === "traceability/require-traceability" ||
|
|
49
|
-
m.ruleId === "traceability/require-story-annotation");
|
|
50
|
-
}
|
|
51
|
-
it("[REQ-TEST-CALLBACK-EXCLUSION] excludes callbacks under known test helpers when configured", async () => {
|
|
52
|
-
const config = [
|
|
53
|
-
{
|
|
54
|
-
rules: {
|
|
55
|
-
"traceability/require-traceability": ["error"],
|
|
56
|
-
"traceability/require-story-annotation": [
|
|
57
|
-
"error",
|
|
58
|
-
{
|
|
59
|
-
excludeTestCallbacks: true,
|
|
60
|
-
},
|
|
61
|
-
],
|
|
62
|
-
},
|
|
63
|
-
},
|
|
64
|
-
];
|
|
65
|
-
const messagesJs = await getRuleMessages(jsTestCallback, "example.test.js", config);
|
|
66
|
-
const messagesTs = await getRuleMessages(tsTestCallback, "example.test.ts", config);
|
|
67
|
-
expect(messagesJs).toHaveLength(0);
|
|
68
|
-
expect(messagesTs).toHaveLength(0);
|
|
69
|
-
});
|
|
70
|
-
it("[REQ-TEST-CALLBACK-EXCLUSION] never excludes Vitest bench callbacks via test-callback exclusion, even when exclusion is enabled", async () => {
|
|
71
|
-
const baseConfig = [
|
|
72
|
-
{
|
|
73
|
-
rules: {
|
|
74
|
-
"traceability/require-traceability": ["error"],
|
|
75
|
-
"traceability/require-story-annotation": [
|
|
76
|
-
"error",
|
|
77
|
-
{
|
|
78
|
-
excludeTestCallbacks: true,
|
|
79
|
-
},
|
|
80
|
-
],
|
|
81
|
-
},
|
|
82
|
-
},
|
|
83
|
-
];
|
|
84
|
-
const withBenchAsHelperConfig = [
|
|
85
|
-
{
|
|
86
|
-
rules: {
|
|
87
|
-
"traceability/require-traceability": ["error"],
|
|
88
|
-
"traceability/require-story-annotation": [
|
|
89
|
-
"error",
|
|
90
|
-
{
|
|
91
|
-
excludeTestCallbacks: true,
|
|
92
|
-
additionalTestHelperNames: ["bench"],
|
|
93
|
-
},
|
|
94
|
-
],
|
|
95
|
-
},
|
|
96
|
-
},
|
|
97
|
-
];
|
|
98
|
-
const baseResult = await lintTextWithConfig(jsBenchCallback, "bench.test.ts", baseConfig);
|
|
99
|
-
const withBenchHelperResult = await lintTextWithConfig(jsBenchCallback, "bench.test.ts", withBenchAsHelperConfig);
|
|
100
|
-
const baseMessages = baseResult.messages.filter((m) => m.ruleId === "traceability/require-traceability" ||
|
|
101
|
-
m.ruleId === "traceability/require-story-annotation");
|
|
102
|
-
const withBenchHelperMessages = withBenchHelperResult.messages.filter((m) => m.ruleId === "traceability/require-traceability" ||
|
|
103
|
-
m.ruleId === "traceability/require-story-annotation");
|
|
104
|
-
expect(withBenchHelperMessages.length).toBeGreaterThanOrEqual(baseMessages.length);
|
|
105
|
-
});
|
|
106
|
-
it("[REQ-TEST-CALLBACK-EXCLUSION] respects additionalTestHelperNames for custom helpers but not for bench callbacks", async () => {
|
|
107
|
-
const baseConfig = [
|
|
108
|
-
{
|
|
109
|
-
rules: {
|
|
110
|
-
"traceability/require-traceability": ["error"],
|
|
111
|
-
"traceability/require-story-annotation": [
|
|
112
|
-
"error",
|
|
113
|
-
{
|
|
114
|
-
excludeTestCallbacks: true,
|
|
115
|
-
},
|
|
116
|
-
],
|
|
117
|
-
},
|
|
118
|
-
},
|
|
119
|
-
];
|
|
120
|
-
const withAdditionalHelpersConfig = [
|
|
121
|
-
{
|
|
122
|
-
rules: {
|
|
123
|
-
"traceability/require-traceability": ["error"],
|
|
124
|
-
"traceability/require-story-annotation": [
|
|
125
|
-
"error",
|
|
126
|
-
{
|
|
127
|
-
excludeTestCallbacks: true,
|
|
128
|
-
additionalTestHelperNames: ["helperWrapper", "bench"],
|
|
129
|
-
},
|
|
130
|
-
],
|
|
131
|
-
},
|
|
132
|
-
},
|
|
133
|
-
];
|
|
134
|
-
const wrapperBaseResult = await lintTextWithConfig(jsCustomHelperCallback, "helper-wrapper.test.ts", baseConfig);
|
|
135
|
-
const wrapperWithHelpersResult = await lintTextWithConfig(jsCustomHelperCallback, "helper-wrapper.test.ts", withAdditionalHelpersConfig);
|
|
136
|
-
const benchBaseResult = await lintTextWithConfig(jsBenchCallback, "bench.test.ts", baseConfig);
|
|
137
|
-
const benchWithHelpersResult = await lintTextWithConfig(jsBenchCallback, "bench.test.ts", withAdditionalHelpersConfig);
|
|
138
|
-
const wrapperBaseMessages = wrapperBaseResult.messages.filter((m) => m.ruleId === "traceability/require-traceability" ||
|
|
139
|
-
m.ruleId === "traceability/require-story-annotation");
|
|
140
|
-
const wrapperWithHelpersMessages = wrapperWithHelpersResult.messages.filter((m) => m.ruleId === "traceability/require-traceability" ||
|
|
141
|
-
m.ruleId === "traceability/require-story-annotation");
|
|
142
|
-
const benchBaseMessages = benchBaseResult.messages.filter((m) => m.ruleId === "traceability/require-traceability" ||
|
|
143
|
-
m.ruleId === "traceability/require-story-annotation");
|
|
144
|
-
const benchWithHelpersMessages = benchWithHelpersResult.messages.filter((m) => m.ruleId === "traceability/require-traceability" ||
|
|
145
|
-
m.ruleId === "traceability/require-story-annotation");
|
|
146
|
-
expect(wrapperWithHelpersMessages.length).toBeLessThanOrEqual(wrapperBaseMessages.length);
|
|
147
|
-
expect(benchWithHelpersMessages.length).toBeGreaterThanOrEqual(benchBaseMessages.length);
|
|
148
|
-
});
|
|
149
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,80 +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-BATCH - Perform batch updates
|
|
40
|
-
* @req REQ-MAINT-VERIFY - Verify annotation references
|
|
41
|
-
* @supports docs/stories/009.0-DEV-MAINTENANCE-TOOLS.story.md REQ-MAINT-BATCH REQ-MAINT-VERIFY
|
|
42
|
-
*/
|
|
43
|
-
const fs = __importStar(require("fs"));
|
|
44
|
-
const path = __importStar(require("path"));
|
|
45
|
-
const temp_dir_helpers_1 = require("../utils/temp-dir-helpers");
|
|
46
|
-
const batch_1 = require("../../src/maintenance/batch");
|
|
47
|
-
describe("batchUpdateAnnotations (Story 009.0-DEV-MAINTENANCE-TOOLS)", () => {
|
|
48
|
-
let temp;
|
|
49
|
-
beforeAll(() => {
|
|
50
|
-
temp = (0, temp_dir_helpers_1.createTempDir)("batch-test-");
|
|
51
|
-
});
|
|
52
|
-
afterAll(() => {
|
|
53
|
-
temp.cleanup();
|
|
54
|
-
});
|
|
55
|
-
it("[REQ-MAINT-BATCH] should return 0 when no mappings applied", () => {
|
|
56
|
-
const count = (0, batch_1.batchUpdateAnnotations)(temp.dir, []);
|
|
57
|
-
expect(count).toBe(0);
|
|
58
|
-
});
|
|
59
|
-
});
|
|
60
|
-
describe("verifyAnnotations (Story 009.0-DEV-MAINTENANCE-TOOLS)", () => {
|
|
61
|
-
let temp;
|
|
62
|
-
beforeAll(() => {
|
|
63
|
-
temp = (0, temp_dir_helpers_1.createTempDir)("verify-test-");
|
|
64
|
-
const tsContent = `
|
|
65
|
-
/**
|
|
66
|
-
* Tests for: my-story.story.md
|
|
67
|
-
* @story my-story.story.md
|
|
68
|
-
*/
|
|
69
|
-
`;
|
|
70
|
-
fs.writeFileSync(path.join(temp.dir, "test.ts"), tsContent);
|
|
71
|
-
fs.writeFileSync(path.join(temp.dir, "my-story.story.md"), "# Dummy Story");
|
|
72
|
-
});
|
|
73
|
-
afterAll(() => {
|
|
74
|
-
temp.cleanup();
|
|
75
|
-
});
|
|
76
|
-
it("[REQ-MAINT-VERIFY] should return true when annotations are valid", () => {
|
|
77
|
-
const valid = (0, batch_1.verifyAnnotations)(temp.dir);
|
|
78
|
-
expect(valid).toBe(true);
|
|
79
|
-
});
|
|
80
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|