eslint-plugin-traceability 1.23.0 → 1.24.0
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 +2 -2
- package/lib/{src/rules → rules}/require-traceability.js +49 -4
- package/package.json +8 -8
- package/user-docs/api-reference.md +25 -0
- 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 -264
- 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-req-annotation.js +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}/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,163 +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/027.0-DEV-REDUNDANT-ANNOTATION-DETECTION.story.md
|
|
8
|
-
* @story docs/stories/027.0-DEV-REDUNDANT-ANNOTATION-DETECTION.story.md
|
|
9
|
-
* @req REQ-SCOPE-ANALYSIS - Verify that the rule understands scope coverage for branch and block annotations
|
|
10
|
-
* @req REQ-DUPLICATION-DETECTION - Verify detection of duplicate annotations within the same scope
|
|
11
|
-
* @req REQ-STATEMENT-SIGNIFICANCE - Verify that simple statements are treated as redundant when covered by scope
|
|
12
|
-
* @req REQ-SAFE-REMOVAL - Verify that auto-fix removes only redundant annotations and preserves code
|
|
13
|
-
* @req REQ-DIFFERENT-REQUIREMENTS - Verify that annotations with different requirement IDs are preserved
|
|
14
|
-
* @req REQ-CATCH-BLOCK-HANDLING - Verify that catch block annotations are not incorrectly treated as redundant
|
|
15
|
-
* @supports docs/stories/027.0-DEV-REDUNDANT-ANNOTATION-DETECTION.story.md REQ-SCOPE-ANALYSIS REQ-DUPLICATION-DETECTION REQ-STATEMENT-SIGNIFICANCE REQ-SAFE-REMOVAL REQ-DIFFERENT-REQUIREMENTS REQ-CATCH-BLOCK-HANDLING REQ-SUPPORTS-COVERAGE REQ-SCOPE-INHERITANCE REQ-CONFIGURABLE-STRICTNESS
|
|
16
|
-
*/
|
|
17
|
-
const eslint_1 = require("eslint");
|
|
18
|
-
const no_redundant_annotation_1 = __importDefault(require("../../src/rules/no-redundant-annotation"));
|
|
19
|
-
const ruleTester = new eslint_1.RuleTester({
|
|
20
|
-
languageOptions: { parserOptions: { ecmaVersion: 2020 } },
|
|
21
|
-
});
|
|
22
|
-
const runRule = (tests) => ruleTester.run("no-redundant-annotation", no_redundant_annotation_1.default, tests);
|
|
23
|
-
describe("no-redundant-annotation rule (Story 027.0-DEV-REDUNDANT-ANNOTATION-DETECTION)", () => {
|
|
24
|
-
runRule({
|
|
25
|
-
valid: [
|
|
26
|
-
{
|
|
27
|
-
name: "[REQ-DIFFERENT-REQUIREMENTS] preserves child annotation with different requirement ID",
|
|
28
|
-
code: `function example() {\n // @story docs/stories/002.0-EXAMPLE.story.md\n // @req REQ-EXAMPLE-PARENT\n if (flag) {\n // @story docs/stories/002.0-EXAMPLE.story.md\n // @req REQ-EXAMPLE-CHILD\n doWork();\n }\n}`,
|
|
29
|
-
},
|
|
30
|
-
{
|
|
31
|
-
name: "[REQ-STATEMENT-SIGNIFICANCE] preserves annotation on complex nested branch",
|
|
32
|
-
code: `function example() {\n // @story docs/stories/006.0-EXAMPLE.story.md\n // @req REQ-OUTER-CHECK\n if (enabled) {\n // @story docs/stories/006.0-EXAMPLE.story.md\n // @req REQ-INNER-VALIDATION\n if (validate) {\n validate(data);\n }\n }\n}`,
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
name: "[REQ-SUPPORTS-COVERAGE] preserves non-redundant mixed @supports/@req pairs when only partially covered by scope",
|
|
36
|
-
code: `function example() {\n /**\n * @story docs/stories/010.0-EXAMPLE.story.md\n * @req REQ-FN-LEVEL\n * @supports REQ-SHARED\n */\n if (flag) {\n // @story docs/stories/010.0-EXAMPLE.story.md\n // @req REQ-BRANCH-SPECIFIC\n // @supports REQ-SHARED\n doThing();\n }\n}`,
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
name: "[REQ-SCOPE-ANALYSIS] preserves annotations on both branch and statement when they intentionally duplicate each other",
|
|
40
|
-
code: `function example() {\n if (condition) { // @story docs/stories/007.0-EXAMPLE.story.md @req REQ-BRANCH\n // @story docs/stories/007.0-EXAMPLE.story.md\n // @req REQ-BRANCH\n doBranchWork();\n }\n}`,
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
name: "[REQ-CATCH-BLOCK-HANDLING] preserves catch block annotation from issue #6 scenario",
|
|
44
|
-
code: `async function example() {\n try {\n // @story prompts/004.0-DEV-FILTER-VULNERABLE-VERSIONS.story.md\n // @supports prompts/004.0-DEV-FILTER-VULNERABLE-VERSIONS.md REQ-SAFE-ONLY\n if (isSafeVersion({ version, vulnerabilityData })) {\n return version;\n }\n\n // @story prompts/004.0-DEV-FILTER-VULNERABLE-VERSIONS.story.md\n // @supports prompts/004.0-DEV-FILTER-VULNERABLE-VERSIONS.md REQ-SAFE-ONLY\n if (!vulnerabilityData.isVulnerable) {\n return version;\n }\n } catch (error) {\n // @story prompts/004.0-DEV-FILTER-VULNERABLE-VERSIONS.story.md\n // @supports prompts/004.0-DEV-FILTER-VULNERABLE-VERSIONS.md REQ-SAFE-ONLY\n return null;\n }\n}`,
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
name: "[REQ-CATCH-BLOCK-HANDLING] preserves annotations in nested catch blocks with repeated requirements",
|
|
48
|
-
code: `async function nestedCatches() {\n try {\n await checkPrimary();\n } catch (outerError) {\n // @supports prompts/004.0-DEV-FILTER-VULNERABLE-VERSIONS.md REQ-SAFE-ONLY\n try {\n await attemptRecovery(outerError);\n } catch (innerError) {\n // @supports prompts/004.0-DEV-FILTER-VULNERABLE-VERSIONS.md REQ-SAFE-ONLY\n await reportFailure(innerError);\n }\n }\n}`,
|
|
49
|
-
},
|
|
50
|
-
],
|
|
51
|
-
invalid: [
|
|
52
|
-
{
|
|
53
|
-
name: "[REQ-SCOPE-ANALYSIS][REQ-STATEMENT-SIGNIFICANCE] flags redundant annotation on simple return inside annotated if",
|
|
54
|
-
code: `function example() {
|
|
55
|
-
// @story docs/stories/004.0-EXAMPLE.story.md
|
|
56
|
-
// @req REQ-PROCESS
|
|
57
|
-
if (condition) {
|
|
58
|
-
/* @story docs/stories/004.0-EXAMPLE.story.md\n * @req REQ-PROCESS
|
|
59
|
-
*/
|
|
60
|
-
return value;
|
|
61
|
-
}
|
|
62
|
-
}`,
|
|
63
|
-
output: `function example() {
|
|
64
|
-
// @story docs/stories/004.0-EXAMPLE.story.md
|
|
65
|
-
// @req REQ-PROCESS
|
|
66
|
-
if (condition) {
|
|
67
|
-
return value;
|
|
68
|
-
}
|
|
69
|
-
}`,
|
|
70
|
-
errors: [
|
|
71
|
-
{
|
|
72
|
-
messageId: "redundantAnnotation",
|
|
73
|
-
},
|
|
74
|
-
],
|
|
75
|
-
},
|
|
76
|
-
{
|
|
77
|
-
name: "[REQ-DUPLICATION-DETECTION] flags redundant annotations on sequential simple statements in same scope",
|
|
78
|
-
code: `// @story docs/stories/003.0-EXAMPLE.story.md\n// @req REQ-INIT\nfunction init() {\n // @story docs/stories/003.0-EXAMPLE.story.md\n // @req REQ-INIT\n const config = loadConfig();\n const validator = new Validator(config);\n}`,
|
|
79
|
-
output: `// @story docs/stories/003.0-EXAMPLE.story.md\n// @req REQ-INIT\nfunction init() {\n const config = loadConfig();\n const validator = new Validator(config);\n}`,
|
|
80
|
-
errors: [{ messageId: "redundantAnnotation" }],
|
|
81
|
-
},
|
|
82
|
-
{
|
|
83
|
-
name: "[REQ-SAFE-REMOVAL] removes full-line redundant comment without touching code on same line above",
|
|
84
|
-
code: `function example() {\n const keep = 1;\n // @story docs/stories/003.0-EXAMPLE.story.md\n // @req REQ-INIT\n if (flag) {\n // @story docs/stories/003.0-EXAMPLE.story.md\n // @req REQ-INIT\n const value = 1;\n }\n}`,
|
|
85
|
-
output: `function example() {\n const keep = 1;\n // @story docs/stories/003.0-EXAMPLE.story.md\n // @req REQ-INIT\n if (flag) {\n const value = 1;\n }\n}`,
|
|
86
|
-
errors: [{ messageId: "redundantAnnotation" }],
|
|
87
|
-
},
|
|
88
|
-
{
|
|
89
|
-
name: "[REQ-SCOPE-INHERITANCE] flags redundant statement annotation when scopePairs come from parent function JSDoc",
|
|
90
|
-
code: `/**\n * @story docs/stories/008.0-EXAMPLE.story.md\n * @req REQ-FUNC\n */\nfunction example() {\n // @story docs/stories/008.0-EXAMPLE.story.md\n // @req REQ-FUNC\n const result = compute();\n}`,
|
|
91
|
-
output: `/**\n * @story docs/stories/008.0-EXAMPLE.story.md\n * @req REQ-FUNC\n */\nfunction example() {\n const result = compute();\n}`,
|
|
92
|
-
errors: [{ messageId: "redundantAnnotation" }],
|
|
93
|
-
},
|
|
94
|
-
{
|
|
95
|
-
name: "[REQ-SUPPORTS-COVERAGE][REQ-DUPLICATION-DETECTION] flags redundant statement with multiple fully-covered @supports pairs",
|
|
96
|
-
code: `/**\n * @story docs/stories/009.0-EXAMPLE.story.md\n * @supports REQ-SUP-A, REQ-SUP-B\n */\nfunction example() {\n // @story docs/stories/009.0-EXAMPLE.story.md\n // @supports REQ-SUP-A, REQ-SUP-B\n const supported = checkSupport();\n}`,
|
|
97
|
-
output: `/**\n * @story docs/stories/009.0-EXAMPLE.story.md\n * @supports REQ-SUP-A, REQ-SUP-B\n */\nfunction example() {\n const supported = checkSupport();\n}`,
|
|
98
|
-
errors: [{ messageId: "redundantAnnotation" }],
|
|
99
|
-
},
|
|
100
|
-
{
|
|
101
|
-
name: "[REQ-SCOPE-ANALYSIS][REQ-STATEMENT-SIGNIFICANCE] flags redundant annotation in finally block that repeats try-path coverage",
|
|
102
|
-
code: `async function example() {\n // @supports docs/stories/010.0-EXAMPLE.story.md REQ-SAFE-OPERATION\n try {\n await doWork();\n } finally {\n // @supports docs/stories/010.0-EXAMPLE.story.md REQ-SAFE-OPERATION\n await cleanUp();\n }\n}`,
|
|
103
|
-
output: `async function example() {\n // @supports docs/stories/010.0-EXAMPLE.story.md REQ-SAFE-OPERATION\n try {\n await doWork();\n } finally {\n await cleanUp();\n }\n}`,
|
|
104
|
-
errors: [{ messageId: "redundantAnnotation" }],
|
|
105
|
-
},
|
|
106
|
-
// TODO: rule implementation exists; full invalid-case behavior tests pending refinement
|
|
107
|
-
// {
|
|
108
|
-
// name: "[REQ-SCOPE-ANALYSIS][REQ-STATEMENT-SIGNIFICANCE] flags redundant annotation on simple return inside annotated if",
|
|
109
|
-
// code: `function example() {\n // @story docs/stories/004.0-EXAMPLE.story.md\n // @req REQ-PROCESS\n if (condition) {\n // @req REQ-PROCESS\n return value;\n }\n}`,
|
|
110
|
-
// output: `function example() {\n // @story docs/stories/004.0-EXAMPLE.story.md\n // @req REQ-PROCESS\n if (condition) {\n return value;\n }\n}`,
|
|
111
|
-
// errors: [
|
|
112
|
-
// {
|
|
113
|
-
// messageId: "redundantAnnotation",
|
|
114
|
-
// },
|
|
115
|
-
// ],
|
|
116
|
-
// },
|
|
117
|
-
// {
|
|
118
|
-
// name: "[REQ-DUPLICATION-DETECTION] flags redundant annotations on sequential simple statements in same scope",
|
|
119
|
-
// code: `// @story docs/stories/003.0-EXAMPLE.story.md\n// @req REQ-INIT\nfunction init() {\n // @req REQ-INIT\n const config = loadConfig();\n const validator = new Validator(config);\n}`,
|
|
120
|
-
// output: `// @story docs/stories/003.0-EXAMPLE.story.md\n// @req REQ-INIT\nfunction init() {\n const config = loadConfig();\n const validator = new Validator(config);\n}`,
|
|
121
|
-
// errors: [
|
|
122
|
-
// { messageId: "redundantAnnotation" },
|
|
123
|
-
// ],
|
|
124
|
-
// },
|
|
125
|
-
// {
|
|
126
|
-
// name: "[REQ-SAFE-REMOVAL] removes full-line redundant comment without touching code on same line above",
|
|
127
|
-
// code: `function example() {\n const keep = 1;\n // @story docs/stories/003.0-EXAMPLE.story.md\n // @req REQ-INIT\n if (flag) {\n // @req REQ-INIT\n const value = 1;\n }\n}`,
|
|
128
|
-
// output: `function example() {\n const keep = 1;\n // @story docs/stories/003.0-EXAMPLE.story.md\n // @req REQ-INIT\n if (flag) {\n const value = 1;\n }\n}`,
|
|
129
|
-
// errors: [
|
|
130
|
-
// { messageId: "redundantAnnotation" },
|
|
131
|
-
// ],
|
|
132
|
-
// },
|
|
133
|
-
],
|
|
134
|
-
});
|
|
135
|
-
runRule({
|
|
136
|
-
valid: [
|
|
137
|
-
{
|
|
138
|
-
name: "[REQ-CONFIGURABLE-STRICTNESS] permissive mode does not flag expression statements as redundant",
|
|
139
|
-
options: [{ strictness: "permissive" }],
|
|
140
|
-
code: `function example() {\n // @story docs/stories/004.0-EXAMPLE.story.md\n // @req REQ-PROCESS\n if (condition) {\n // @story docs/stories/004.0-EXAMPLE.story.md\n // @req REQ-PROCESS\n doSomething();\n }\n}`,
|
|
141
|
-
},
|
|
142
|
-
{
|
|
143
|
-
name: "[REQ-CONFIGURABLE-STRICTNESS] allowEmphasisDuplication skips single covered pair",
|
|
144
|
-
options: [{ allowEmphasisDuplication: true }],
|
|
145
|
-
code: `function example() {\n // @story docs/stories/004.0-EXAMPLE.story.md\n // @req REQ-PROCESS\n if (condition) {\n // @story docs/stories/004.0-EXAMPLE.story.md\n // @req REQ-PROCESS\n return value;\n }\n}`,
|
|
146
|
-
},
|
|
147
|
-
{
|
|
148
|
-
name: "[REQ-SCOPE-INHERITANCE] maxScopeDepth=1 does not treat grandparent function annotations as covering nested block",
|
|
149
|
-
options: [{ maxScopeDepth: 1 }],
|
|
150
|
-
code: `/**\n * @story docs/stories/004.0-EXAMPLE.story.md\n * @req REQ-PROCESS\n */\nfunction example() {\n if (outer) {\n {\n // @story docs/stories/004.0-EXAMPLE.story.md\n // @req REQ-PROCESS\n const value = compute();\n }\n }\n}`,
|
|
151
|
-
},
|
|
152
|
-
],
|
|
153
|
-
invalid: [
|
|
154
|
-
{
|
|
155
|
-
name: "[REQ-SCOPE-INHERITANCE] maxScopeDepth>1 treats function-level annotations as covering nested block statements",
|
|
156
|
-
options: [{ maxScopeDepth: 4 }],
|
|
157
|
-
code: `/**\n * @story docs/stories/004.0-EXAMPLE.story.md\n * @req REQ-PROCESS\n */\nfunction example() {\n if (outer) {\n {\n // @story docs/stories/004.0-EXAMPLE.story.md\n // @req REQ-PROCESS\n const value = compute();\n }\n }\n}`,
|
|
158
|
-
output: `/**\n * @story docs/stories/004.0-EXAMPLE.story.md\n * @req REQ-PROCESS\n */\nfunction example() {\n if (outer) {\n {\n const value = compute();\n }\n }\n}`,
|
|
159
|
-
errors: [{ messageId: "redundantAnnotation" }],
|
|
160
|
-
},
|
|
161
|
-
],
|
|
162
|
-
});
|
|
163
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,162 +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/010.3-DEV-MIGRATE-TO-SUPPORTS.story.md
|
|
8
|
-
* @story docs/stories/010.3-DEV-MIGRATE-TO-SUPPORTS.story.md
|
|
9
|
-
* @req REQ-OPTIONAL-WARNING - Verify rule emits recommendations for legacy @story/@req usage and migration to @supports
|
|
10
|
-
* @req REQ-MULTI-STORY-DETECT - Verify rule detects multi-story and mixed-annotation patterns involving @supports
|
|
11
|
-
* @req REQ-CONFIG-SEVERITY - Verify rule is disabled by default and can be enabled as warn/error
|
|
12
|
-
*/
|
|
13
|
-
const eslint_1 = require("eslint");
|
|
14
|
-
const prefer_implements_annotation_1 = __importDefault(require("../../src/rules/prefer-implements-annotation"));
|
|
15
|
-
const src_1 = require("../../src");
|
|
16
|
-
const ruleTester = new eslint_1.RuleTester({
|
|
17
|
-
languageOptions: {
|
|
18
|
-
parserOptions: { ecmaVersion: 2020, sourceType: "module" },
|
|
19
|
-
},
|
|
20
|
-
});
|
|
21
|
-
describe("prefer-supports-annotation / prefer-implements-annotation aliasing (Story 010.3-DEV-MIGRATE-TO-SUPPORTS)", () => {
|
|
22
|
-
const valid = [
|
|
23
|
-
{
|
|
24
|
-
name: "[REQ-BACKWARD-COMP-VALIDATION] comment with only @story is ignored",
|
|
25
|
-
code: `/**\n * @story docs/stories/003.0-DEV-FUNCTION-ANNOTATIONS.story.md\n */\nfunction onlyStory() {}`,
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
name: "[REQ-BACKWARD-COMP-VALIDATION] comment with only @req is ignored",
|
|
29
|
-
code: `/**\n * @req REQ-ONLY\n */\nfunction onlyReq() {}`,
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
name: "[REQ-BACKWARD-COMP-VALIDATION] comment with @supports only is ignored",
|
|
33
|
-
code: `/**\n * @supports docs/stories/003.0-DEV-FUNCTION-ANNOTATIONS.story.md REQ-ANNOTATION-REQUIRED\n */\nfunction alreadyImplements() {}`,
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
name: "[REQ-BACKWARD-COMP-VALIDATION] comment with @story and @supports but no @req is ignored",
|
|
37
|
-
code: `/**\n * @story docs/stories/003.0-DEV-FUNCTION-ANNOTATIONS.story.md\n * @supports docs/stories/003.0-DEV-FUNCTION-ANNOTATIONS.story.md REQ-ANNOTATION-REQUIRED\n */\nfunction storyAndSupportsNoReq() {}`,
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
name: "[REQ-BACKWARD-COMP-VALIDATION] comment with @req and @supports but no @story is ignored",
|
|
41
|
-
code: `/**\n * @req REQ-ANNOTATION-REQUIRED\n * @supports docs/stories/003.0-DEV-FUNCTION-ANNOTATIONS.story.md REQ-ANNOTATION-REQUIRED\n */\nfunction reqAndSupportsNoStory() {}`,
|
|
42
|
-
},
|
|
43
|
-
];
|
|
44
|
-
const invalid = [
|
|
45
|
-
{
|
|
46
|
-
name: "[REQ-OPTIONAL-WARNING] single-story @story + @req block triggers preferImplements message",
|
|
47
|
-
code: `/**\n * @story docs/stories/003.0-DEV-FUNCTION-ANNOTATIONS.story.md\n * @req REQ-ANNOTATION-REQUIRED\n */\nfunction legacy() {}`,
|
|
48
|
-
output: `/**\n * @supports docs/stories/003.0-DEV-FUNCTION-ANNOTATIONS.story.md REQ-ANNOTATION-REQUIRED\n */\nfunction legacy() {}`,
|
|
49
|
-
errors: [{ messageId: "preferImplements" }],
|
|
50
|
-
},
|
|
51
|
-
{
|
|
52
|
-
name: "[REQ-MULTI-STORY-DETECT] mixed @story/@req and @supports triggers cannotAutoFix",
|
|
53
|
-
code: `/**\n * @story docs/stories/003.0-DEV-FUNCTION-ANNOTATIONS.story.md\n * @req REQ-ANNOTATION-REQUIRED\n * @supports docs/stories/003.0-DEV-FUNCTION-ANNOTATIONS.story.md REQ-ANNOTATION-REQUIRED\n */\nfunction mixed() {}`,
|
|
54
|
-
errors: [
|
|
55
|
-
{
|
|
56
|
-
messageId: "cannotAutoFix",
|
|
57
|
-
data: {
|
|
58
|
-
reason: "comment mixes @story/@req with existing @supports annotations",
|
|
59
|
-
},
|
|
60
|
-
},
|
|
61
|
-
],
|
|
62
|
-
},
|
|
63
|
-
{
|
|
64
|
-
name: "[REQ-MULTI-STORY-DETECT] multiple @story paths in same block trigger multiStoryDetected",
|
|
65
|
-
code: `/**\n * @story docs/stories/003.0-DEV-FUNCTION-ANNOTATIONS.story.md\n * @req REQ-ANNOTATION-REQUIRED\n * @story docs/stories/004.0-DEV-BRANCH-ANNOTATIONS.story.md\n * @req REQ-BRANCH-DETECTION\n */\nfunction multiStory() {}`,
|
|
66
|
-
errors: [{ messageId: "multiStoryDetected" }],
|
|
67
|
-
},
|
|
68
|
-
{
|
|
69
|
-
name: "[REQ-AUTO-FIX] single @story + single @req auto-fixes to single @supports line",
|
|
70
|
-
code: `/**\n * @story docs/stories/003.0-DEV-FUNCTION-ANNOTATIONS.story.md\n * @req REQ-ANNOTATION-REQUIRED\n */\nfunction autoFixSingleReq() {}`,
|
|
71
|
-
output: `/**\n * @supports docs/stories/003.0-DEV-FUNCTION-ANNOTATIONS.story.md REQ-ANNOTATION-REQUIRED\n */\nfunction autoFixSingleReq() {}`,
|
|
72
|
-
errors: [{ messageId: "preferImplements" }],
|
|
73
|
-
},
|
|
74
|
-
{
|
|
75
|
-
name: "[REQ-SINGLE-STORY-FIX] single @story with multiple @req lines auto-fixes to single @supports line containing all REQ IDs",
|
|
76
|
-
code: `/**\n * @story docs/stories/003.0-DEV-FUNCTION-ANNOTATIONS.story.md\n * @req REQ-ONE\n * @req REQ-TWO\n * @req REQ-THREE\n */\nfunction autoFixMultiReq() {}`,
|
|
77
|
-
output: `/**\n * @supports docs/stories/003.0-DEV-FUNCTION-ANNOTATIONS.story.md REQ-ONE REQ-TWO REQ-THREE\n */\nfunction autoFixMultiReq() {}`,
|
|
78
|
-
errors: [{ messageId: "preferImplements" }],
|
|
79
|
-
},
|
|
80
|
-
{
|
|
81
|
-
name: "[REQ-AUTO-FIX] complex @req content (extra description) does not auto-fix but still warns",
|
|
82
|
-
code: `/**\n * @story docs/stories/003.0-DEV-FUNCTION-ANNOTATIONS.story.md\n * @req REQ-ANNOTATION-REQUIRED must handle extra description\n */\nfunction complexReqNoAutoFix() {}`,
|
|
83
|
-
errors: [{ messageId: "preferImplements" }],
|
|
84
|
-
},
|
|
85
|
-
{
|
|
86
|
-
name: "[REQ-AUTO-FIX] complex @story content (extra description) does not auto-fix but still warns",
|
|
87
|
-
code: `/**\n * @story docs/stories/003.0-DEV-FUNCTION-ANNOTATIONS.story.md additional descriptive text\n * @req REQ-ANNOTATION-REQUIRED\n */\nfunction complexStoryNoAutoFix() {}`,
|
|
88
|
-
errors: [{ messageId: "preferImplements" }],
|
|
89
|
-
},
|
|
90
|
-
{
|
|
91
|
-
name: "[REQ-INLINE-COMMENT-SUPPORT] single inline // @story + // @req auto-fixes to single // @supports line above function",
|
|
92
|
-
code: `// @story docs/stories/010.3-DEV-MIGRATE-TO-SUPPORTS.story.md\n// @req REQ-INLINE-COMMENT-SUPPORT\nfunction inlineLegacy() {}`,
|
|
93
|
-
output: `// @supports docs/stories/010.3-DEV-MIGRATE-TO-SUPPORTS.story.md REQ-INLINE-COMMENT-SUPPORT\nfunction inlineLegacy() {}`,
|
|
94
|
-
errors: [{ messageId: "preferImplements" }],
|
|
95
|
-
},
|
|
96
|
-
{
|
|
97
|
-
name: "[REQ-INLINE-COMMENT-SUPPORT] single inline // @story with multiple // @req lines auto-fixes to single // @supports containing all REQ IDs",
|
|
98
|
-
code: `// @story docs/stories/010.3-DEV-MIGRATE-TO-SUPPORTS.story.md\n// @req REQ-INLINE-COMMENT-SUPPORT\n// @req REQ-BRANCH-POSITION-PRESERVE\nfunction inlineMultiReq() {}`,
|
|
99
|
-
output: `// @supports docs/stories/010.3-DEV-MIGRATE-TO-SUPPORTS.story.md REQ-INLINE-COMMENT-SUPPORT REQ-BRANCH-POSITION-PRESERVE\nfunction inlineMultiReq() {}`,
|
|
100
|
-
errors: [{ messageId: "preferImplements" }],
|
|
101
|
-
},
|
|
102
|
-
{
|
|
103
|
-
name: "[REQ-INLINE-COMMENT-SUPPORT] inline // @story + // @req above statement is auto-fixed preserving branch position (REQ-BRANCH-POSITION-PRESERVE)",
|
|
104
|
-
code: `if (flag) {\n // @story docs/stories/010.3-DEV-MIGRATE-TO-SUPPORTS.story.md\n // @req REQ-BRANCH-POSITION-PRESERVE\n doSomething();\n}`,
|
|
105
|
-
output: `if (flag) {\n // @supports docs/stories/010.3-DEV-MIGRATE-TO-SUPPORTS.story.md REQ-BRANCH-POSITION-PRESERVE\n doSomething();\n}`,
|
|
106
|
-
errors: [{ messageId: "preferImplements" }],
|
|
107
|
-
},
|
|
108
|
-
{
|
|
109
|
-
name: "[REQ-INLINE-COMMENT-SUPPORT] complex inline // @req content is not safely auto-fixable but still reports preferImplements",
|
|
110
|
-
code: `// @story docs/stories/010.3-DEV-MIGRATE-TO-SUPPORTS.story.md\n// @req REQ-INLINE-COMMENT-SUPPORT extra description inline\nfunction inlineComplexReqNoAutoFix() {}`,
|
|
111
|
-
errors: [{ messageId: "preferImplements" }],
|
|
112
|
-
},
|
|
113
|
-
];
|
|
114
|
-
ruleTester.run("prefer-implements-annotation", prefer_implements_annotation_1.default, {
|
|
115
|
-
valid,
|
|
116
|
-
invalid,
|
|
117
|
-
});
|
|
118
|
-
ruleTester.run("prefer-supports-annotation", prefer_implements_annotation_1.default, {
|
|
119
|
-
valid,
|
|
120
|
-
invalid,
|
|
121
|
-
});
|
|
122
|
-
});
|
|
123
|
-
describe("prefer-implements-annotation configuration severity (REQ-CONFIG-SEVERITY)", () => {
|
|
124
|
-
// Story 010.3 / REQ-RULE-NAME: verify aliasing semantics for new primary rule name and deprecated alias
|
|
125
|
-
test("rule is disabled by default in recommended and strict presets (not present in preset rule maps)", () => {
|
|
126
|
-
const recommended = src_1.configs.recommended;
|
|
127
|
-
expect(Array.isArray(recommended)).toBe(true);
|
|
128
|
-
const firstConfig = recommended[0];
|
|
129
|
-
expect(firstConfig).toBeDefined();
|
|
130
|
-
const rules = firstConfig.rules || {};
|
|
131
|
-
expect(rules["traceability/prefer-implements-annotation"]).toBeUndefined();
|
|
132
|
-
expect(rules["traceability/prefer-supports-annotation"]).toBeUndefined();
|
|
133
|
-
const strict = src_1.configs.strict;
|
|
134
|
-
expect(Array.isArray(strict)).toBe(true);
|
|
135
|
-
const strictFirstConfig = strict[0];
|
|
136
|
-
expect(strictFirstConfig).toBeDefined();
|
|
137
|
-
const strictRules = strictFirstConfig.rules || {};
|
|
138
|
-
expect(strictRules["traceability/prefer-implements-annotation"]).toBeUndefined();
|
|
139
|
-
expect(strictRules["traceability/prefer-supports-annotation"]).toBeUndefined();
|
|
140
|
-
});
|
|
141
|
-
test("rule can be configured with severity 'warn' or 'error' in flat config", () => {
|
|
142
|
-
// Story 010.3 / REQ-RULE-NAME: both primary and alias rule keys must be accepted in flat config
|
|
143
|
-
const flatWarnConfig = {
|
|
144
|
-
files: ["**/*.ts"],
|
|
145
|
-
rules: {
|
|
146
|
-
"traceability/prefer-implements-annotation": "warn",
|
|
147
|
-
"traceability/prefer-supports-annotation": "warn",
|
|
148
|
-
},
|
|
149
|
-
};
|
|
150
|
-
expect(flatWarnConfig.rules["traceability/prefer-implements-annotation"]).toBe("warn");
|
|
151
|
-
expect(flatWarnConfig.rules["traceability/prefer-supports-annotation"]).toBe("warn");
|
|
152
|
-
const flatErrorConfig = {
|
|
153
|
-
files: ["**/*.ts"],
|
|
154
|
-
rules: {
|
|
155
|
-
"traceability/prefer-implements-annotation": "error",
|
|
156
|
-
"traceability/prefer-supports-annotation": "error",
|
|
157
|
-
},
|
|
158
|
-
};
|
|
159
|
-
expect(flatErrorConfig.rules["traceability/prefer-implements-annotation"]).toBe("error");
|
|
160
|
-
expect(flatErrorConfig.rules["traceability/prefer-supports-annotation"]).toBe("error");
|
|
161
|
-
});
|
|
162
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|