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
package/CHANGELOG.md
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
|
|
1
|
+
## [1.23.1](https://github.com/voder-ai/eslint-plugin-traceability/compare/v1.23.0...v1.23.1) (2026-01-10)
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
### Bug Fixes
|
|
5
5
|
|
|
6
|
-
*
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
*
|
|
6
|
+
* correct CLI path in smoke test to lib/maintenance/cli.js ([16d595e](https://github.com/voder-ai/eslint-plugin-traceability/commit/16d595e0e5c1256bd2fb25544ff3923201d80526))
|
|
7
|
+
* correct plugin path in smoke test to lib/index.js ([3f343f6](https://github.com/voder-ai/eslint-plugin-traceability/commit/3f343f6686eaad9ce2528f9da7b6895c8bb083b7))
|
|
8
|
+
* correct runtime smoke test path resolution in CI ([bf20b02](https://github.com/voder-ai/eslint-plugin-traceability/commit/bf20b025e4e9743f2a87f259959ba61563196b11))
|
|
9
|
+
* correct smoke test ESLint rule name and test file annotations ([766b767](https://github.com/voder-ai/eslint-plugin-traceability/commit/766b76731713d2cadb36fb5b5619ee3a5c1d0fa9))
|
|
10
|
+
* correct TypeScript output paths from lib/src to lib ([9c82640](https://github.com/voder-ai/eslint-plugin-traceability/commit/9c8264027080ef8333bdd21106fdd773df3e4fd7))
|
|
11
|
+
* use direct path to eslint.js in smoke test ([401c1ee](https://github.com/voder-ai/eslint-plugin-traceability/commit/401c1ee750e43c7dc68f46f67b09be6cc790e809))
|
|
12
|
+
* use project eslint binary instead of npx in smoke test ([1c8cfce](https://github.com/voder-ai/eslint-plugin-traceability/commit/1c8cfcecba6f947808375694a318995421dabab3))
|
|
12
13
|
|
|
13
14
|
# Changelog
|
|
14
15
|
|
|
@@ -2,6 +2,56 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const require_story_helpers_1 = require("./helpers/require-story-helpers");
|
|
4
4
|
const annotation_checker_1 = require("../utils/annotation-checker");
|
|
5
|
+
/**
|
|
6
|
+
* Build visitor handlers for require-req-annotation rule.
|
|
7
|
+
* @story docs/stories/003.0-DEV-FUNCTION-ANNOTATIONS.story.md
|
|
8
|
+
* @req REQ-FUNCTION-DETECTION - Provide visitor construction for all function types
|
|
9
|
+
*/
|
|
10
|
+
function buildReqAnnotationVisitors(runCheck) {
|
|
11
|
+
return {
|
|
12
|
+
/**
|
|
13
|
+
* @story docs/stories/003.0-DEV-FUNCTION-ANNOTATIONS.story.md
|
|
14
|
+
* @req REQ-FUNCTION-DETECTION - Detect function declarations
|
|
15
|
+
* @req REQ-ANNOTATION-REQUIRED - Enforce @req annotation on function declarations
|
|
16
|
+
*/
|
|
17
|
+
FunctionDeclaration: runCheck,
|
|
18
|
+
/**
|
|
19
|
+
* @story docs/stories/003.0-DEV-FUNCTION-ANNOTATIONS.story.md
|
|
20
|
+
* @req REQ-FUNCTION-DETECTION - Detect function expressions
|
|
21
|
+
* @req REQ-ANNOTATION-REQUIRED - Enforce @req annotation on function expressions
|
|
22
|
+
*/
|
|
23
|
+
FunctionExpression(node) {
|
|
24
|
+
if (node.parent && node.parent.type === "MethodDefinition") {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
runCheck(node);
|
|
28
|
+
},
|
|
29
|
+
/**
|
|
30
|
+
* @story docs/stories/003.0-DEV-FUNCTION-ANNOTATIONS.story.md
|
|
31
|
+
* @req REQ-FUNCTION-DETECTION - Detect arrow function expressions
|
|
32
|
+
* @req REQ-ANNOTATION-REQUIRED - Enforce @req annotation on arrow function expressions
|
|
33
|
+
*/
|
|
34
|
+
ArrowFunctionExpression: runCheck,
|
|
35
|
+
/**
|
|
36
|
+
* @story docs/stories/003.0-DEV-FUNCTION-ANNOTATIONS.story.md
|
|
37
|
+
* @req REQ-FUNCTION-DETECTION - Detect method definitions
|
|
38
|
+
* @req REQ-ANNOTATION-REQUIRED - Enforce @req annotation on method definitions
|
|
39
|
+
*/
|
|
40
|
+
MethodDefinition: runCheck,
|
|
41
|
+
/**
|
|
42
|
+
* @story docs/stories/003.0-DEV-FUNCTION-ANNOTATIONS.story.md
|
|
43
|
+
* @req REQ-TYPESCRIPT-SUPPORT - Support TypeScript declare functions
|
|
44
|
+
* @req REQ-ANNOTATION-REQUIRED - Enforce @req annotation on TS declare functions
|
|
45
|
+
*/
|
|
46
|
+
TSDeclareFunction: runCheck,
|
|
47
|
+
/**
|
|
48
|
+
* @story docs/stories/003.0-DEV-FUNCTION-ANNOTATIONS.story.md
|
|
49
|
+
* @req REQ-TYPESCRIPT-SUPPORT - Support TypeScript method signatures
|
|
50
|
+
* @req REQ-ANNOTATION-REQUIRED - Enforce @req annotation on TS method signatures
|
|
51
|
+
*/
|
|
52
|
+
TSMethodSignature: runCheck,
|
|
53
|
+
};
|
|
54
|
+
}
|
|
5
55
|
const rule = {
|
|
6
56
|
meta: {
|
|
7
57
|
type: "problem",
|
|
@@ -78,51 +128,7 @@ const rule = {
|
|
|
78
128
|
annotationPlacement,
|
|
79
129
|
});
|
|
80
130
|
};
|
|
81
|
-
return
|
|
82
|
-
/**
|
|
83
|
-
* @story docs/stories/003.0-DEV-FUNCTION-ANNOTATIONS.story.md
|
|
84
|
-
* @req REQ-FUNCTION-DETECTION - Detect function declarations
|
|
85
|
-
* @req REQ-ANNOTATION-REQUIRED - Enforce @req annotation on function declarations
|
|
86
|
-
*/
|
|
87
|
-
FunctionDeclaration(node) {
|
|
88
|
-
runCheck(node);
|
|
89
|
-
},
|
|
90
|
-
/**
|
|
91
|
-
* @story docs/stories/003.0-DEV-FUNCTION-ANNOTATIONS.story.md
|
|
92
|
-
* @req REQ-FUNCTION-DETECTION - Detect function expressions
|
|
93
|
-
* @req REQ-ANNOTATION-REQUIRED - Enforce @req annotation on function expressions
|
|
94
|
-
*/
|
|
95
|
-
FunctionExpression(node) {
|
|
96
|
-
if (node.parent && node.parent.type === "MethodDefinition") {
|
|
97
|
-
return;
|
|
98
|
-
}
|
|
99
|
-
runCheck(node);
|
|
100
|
-
},
|
|
101
|
-
/**
|
|
102
|
-
* @story docs/stories/003.0-DEV-FUNCTION-ANNOTATIONS.story.md
|
|
103
|
-
* @req REQ-FUNCTION-DETECTION - Detect method definitions
|
|
104
|
-
* @req REQ-ANNOTATION-REQUIRED - Enforce @req annotation on method definitions
|
|
105
|
-
*/
|
|
106
|
-
MethodDefinition(node) {
|
|
107
|
-
runCheck(node);
|
|
108
|
-
},
|
|
109
|
-
/**
|
|
110
|
-
* @story docs/stories/003.0-DEV-FUNCTION-ANNOTATIONS.story.md
|
|
111
|
-
* @req REQ-TYPESCRIPT-SUPPORT - Support TypeScript declare functions
|
|
112
|
-
* @req REQ-ANNOTATION-REQUIRED - Enforce @req annotation on TS declare functions
|
|
113
|
-
*/
|
|
114
|
-
TSDeclareFunction(node) {
|
|
115
|
-
runCheck(node);
|
|
116
|
-
},
|
|
117
|
-
/**
|
|
118
|
-
* @story docs/stories/003.0-DEV-FUNCTION-ANNOTATIONS.story.md
|
|
119
|
-
* @req REQ-TYPESCRIPT-SUPPORT - Support TypeScript method signatures
|
|
120
|
-
* @req REQ-ANNOTATION-REQUIRED - Enforce @req annotation on TS method signatures
|
|
121
|
-
*/
|
|
122
|
-
TSMethodSignature(node) {
|
|
123
|
-
runCheck(node);
|
|
124
|
-
},
|
|
125
|
-
};
|
|
131
|
+
return buildReqAnnotationVisitors(runCheck);
|
|
126
132
|
},
|
|
127
133
|
};
|
|
128
134
|
exports.default = rule;
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-traceability",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.23.1",
|
|
4
4
|
"description": "A customizable ESLint plugin that enforces traceability annotations in your code, ensuring each implementation is linked to its requirement or test case.",
|
|
5
|
-
"main": "lib/
|
|
6
|
-
"types": "lib/
|
|
5
|
+
"main": "lib/index.js",
|
|
6
|
+
"types": "lib/index.d.ts",
|
|
7
7
|
"files": [
|
|
8
8
|
"lib",
|
|
9
9
|
"README.md",
|
|
@@ -16,11 +16,11 @@
|
|
|
16
16
|
"doc": "docs"
|
|
17
17
|
},
|
|
18
18
|
"bin": {
|
|
19
|
-
"traceability-maint": "lib/
|
|
19
|
+
"traceability-maint": "lib/maintenance/cli.js"
|
|
20
20
|
},
|
|
21
21
|
"scripts": {
|
|
22
|
-
"build": "tsc -p tsconfig.json",
|
|
23
|
-
"prepare": "
|
|
22
|
+
"build": "tsc -p tsconfig.build.json",
|
|
23
|
+
"prepare": "node scripts/prepare.js",
|
|
24
24
|
"type-check": "tsc --noEmit -p tsconfig.json",
|
|
25
25
|
"check:traceability": "node scripts/traceability-check.js",
|
|
26
26
|
"lint-plugin-check": "node scripts/lint-plugin-check.js",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"test:unit": "jest --ci --bail --testPathPatterns='tests/(rules|maintenance|utils|unit)' --testPathIgnorePatterns='integration'",
|
|
32
32
|
"test:integration": "jest --ci --bail --testPathPatterns='tests/integration'",
|
|
33
33
|
"ci-verify": "npm run type-check && npm run lint && npm run format:check && npm run duplication && npm run check:traceability && npm test && npm run audit:ci && npm run safety:deps",
|
|
34
|
-
"ci-verify:full": "npm run check:traceability && npm run safety:deps && npm run audit:ci && npm run build && npm run type-check && npm run lint-plugin-check && npm run lint -- --max-warnings=0 && npm run duplication && npm run test -- --coverage && npm run format:check && npm audit --omit=dev --audit-level=high && npm run audit:dev-high && npm run check:ci-artifacts",
|
|
34
|
+
"ci-verify:full": "npm run check:traceability && npm run safety:deps && npm run audit:ci && npm run build && npm run smoke:runtime && npm run type-check && npm run lint-plugin-check && npm run lint -- --max-warnings=0 && npm run duplication && npm run test -- --coverage && npm run format:check && npm audit --omit=dev --audit-level=high && npm run audit:dev-high && npm run check:ci-artifacts",
|
|
35
35
|
"ci-verify:fast": "npm run type-check && npm run check:traceability && npm run duplication && jest --ci --bail --passWithNoTests --testPathPatterns 'tests/(rules|maintenance)'",
|
|
36
36
|
"format": "prettier --write .",
|
|
37
37
|
"format:check": "prettier --check \"src/**/*.ts\" \"tests/**/*.ts\"",
|
|
@@ -46,13 +46,12 @@
|
|
|
46
46
|
"security:secrets": "secretlint \"**/*\"",
|
|
47
47
|
"smoke-test": "./scripts/smoke-test.sh",
|
|
48
48
|
"smoke:runtime": "./scripts/runtime-smoke.sh",
|
|
49
|
-
"run:cli": "node lib/
|
|
49
|
+
"run:cli": "node lib/maintenance/cli.js",
|
|
50
50
|
"debug:cli": "node scripts/cli-debug.js",
|
|
51
51
|
"debug:require-story": "node scripts/debug-require-story.js",
|
|
52
52
|
"debug:repro": "node scripts/debug-repro.js",
|
|
53
53
|
"report:eslint-suppressions": "node scripts/report-eslint-suppressions.js",
|
|
54
|
-
"check:scripts": "node scripts/validate-scripts-nonempty.js"
|
|
55
|
-
"voder": "voder --help"
|
|
54
|
+
"check:scripts": "node scripts/validate-scripts-nonempty.js"
|
|
56
55
|
},
|
|
57
56
|
"lint-staged": {
|
|
58
57
|
"src/**/*.{js,jsx,ts,tsx,json,md}": [
|
|
@@ -100,9 +99,6 @@
|
|
|
100
99
|
"ts-jest": "^29.4.6",
|
|
101
100
|
"typescript": "^5.9.3"
|
|
102
101
|
},
|
|
103
|
-
"optionalDependencies": {
|
|
104
|
-
"@voder-ai/voder-ai": "^5.6.1"
|
|
105
|
-
},
|
|
106
102
|
"peerDependencies": {
|
|
107
103
|
"eslint": "^9.0.0"
|
|
108
104
|
},
|
|
@@ -63,13 +63,13 @@ Among the supported scopes, anonymous callbacks passed directly to common test f
|
|
|
63
63
|
|
|
64
64
|
### traceability/require-req-annotation
|
|
65
65
|
|
|
66
|
-
Description: **Legacy function-level key:** This rule key is retained for backward compatibility and conceptually composes the same checks as `traceability/require-traceability`. New configurations should normally enable `traceability/require-traceability` instead and rely on this key only when you need to tune it independently. Ensures that function-like constructs consistently declare their linked requirements via traceability annotations, preferring `@supports` when possible while still accepting `@req`. The rule targets the same function-like node types as `traceability/require-story-annotation` (standard function declarations,
|
|
66
|
+
Description: **Legacy function-level key:** This rule key is retained for backward compatibility and conceptually composes the same checks as `traceability/require-traceability`. New configurations should normally enable `traceability/require-traceability` instead and rely on this key only when you need to tune it independently. Ensures that function-like constructs consistently declare their linked requirements via traceability annotations, preferring `@supports` when possible while still accepting `@req`. The rule targets the same function-like node types as `traceability/require-story-annotation` (standard function declarations, function expressions, arrow functions, class/object methods, TypeScript declare functions, and interface method signatures), and enforces that each of them has at least one `@req` tag in the nearest associated JSDoc comment. When you adopt multi-story `@supports` annotations, this rule also treats `@supports story-path REQ-ID...` tags as satisfying the requirement coverage check, although deep verification of requirement IDs continues to be handled by `traceability/valid-req-reference`.
|
|
67
67
|
|
|
68
68
|
This rule is typically used alongside `traceability/require-story-annotation` so that each function-level traceability block includes both an `@story` and an `@req` annotation, but it can also be enabled independently if you only want to enforce requirement linkage. Unlike `traceability/require-story-annotation`, this rule does not currently provide an auto-fix mode for inserting placeholder `@req` annotations; it only reports missing or malformed requirement annotations on the configured scopes.
|
|
69
69
|
|
|
70
70
|
Options:
|
|
71
71
|
|
|
72
|
-
- `scope` (string[], optional) – Controls which function-like node types are required to have @req annotations. Allowed values: "FunctionDeclaration", "FunctionExpression", "MethodDefinition", "TSDeclareFunction", "TSMethodSignature". Default: ["FunctionDeclaration", "FunctionExpression", "MethodDefinition", "TSDeclareFunction", "TSMethodSignature"].
|
|
72
|
+
- `scope` (string[], optional) – Controls which function-like node types are required to have @req annotations. Allowed values: "FunctionDeclaration", "FunctionExpression", "ArrowFunctionExpression", "MethodDefinition", "TSDeclareFunction", "TSMethodSignature". Default: ["FunctionDeclaration", "FunctionExpression", "ArrowFunctionExpression", "MethodDefinition", "TSDeclareFunction", "TSMethodSignature"].
|
|
73
73
|
- `exportPriority` ("all" | "exported" | "non-exported", optional) – Controls whether the rule checks all functions, only exported ones, or only non-exported ones. Default: "all".
|
|
74
74
|
- `annotationPlacement` ("before" | "inside", optional) Controls whether the rule treats before-function comments as the source of annotations (`"before"`, the default and backward-compatible behavior) or instead requires annotations as the first comment-only lines inside function and method bodies (`"inside"`). In `"inside"` mode, JSDoc and before-function comments are ignored for block-bodied functions and methods, and only inside-body comments are considered; declaration-only nodes (e.g., TS signatures) continue to use before-node annotations.
|
|
75
75
|
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,54 +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 CLI error handling when plugin loading fails
|
|
8
|
-
* @story docs/stories/001.0-DEV-PLUGIN-SETUP.story.md
|
|
9
|
-
* @req REQ-ERROR-HANDLING - Plugin CLI should exit with error on rule load failure
|
|
10
|
-
* @supports docs/stories/001.0-DEV-PLUGIN-SETUP.story.md REQ-ERROR-HANDLING
|
|
11
|
-
*/
|
|
12
|
-
const child_process_1 = require("child_process");
|
|
13
|
-
const path_1 = __importDefault(require("path"));
|
|
14
|
-
const originalNodePath = process.env.NODE_PATH;
|
|
15
|
-
describe("CLI Error Handling for Traceability Plugin (Story 001.0-DEV-PLUGIN-SETUP)", () => {
|
|
16
|
-
beforeAll(() => {
|
|
17
|
-
// Simulate missing plugin build by deleting lib directory (if exist)
|
|
18
|
-
// In tests, assume plugin built to lib/src/index.js; point plugin import to src/index.ts via env
|
|
19
|
-
process.env.NODE_PATH = path_1.default.resolve(__dirname, "../src");
|
|
20
|
-
});
|
|
21
|
-
afterAll(() => {
|
|
22
|
-
if (originalNodePath === undefined) {
|
|
23
|
-
delete process.env.NODE_PATH;
|
|
24
|
-
}
|
|
25
|
-
else {
|
|
26
|
-
process.env.NODE_PATH = originalNodePath;
|
|
27
|
-
}
|
|
28
|
-
});
|
|
29
|
-
it("[REQ-ERROR-HANDLING] should exit with error when rule module missing", () => {
|
|
30
|
-
const eslintPkgDir = path_1.default.dirname(require.resolve("eslint/package.json"));
|
|
31
|
-
const eslintCliPath = path_1.default.join(eslintPkgDir, "bin", "eslint.js");
|
|
32
|
-
const configPath = path_1.default.resolve(__dirname, "../eslint.config.js");
|
|
33
|
-
const code = `function foo() {}`;
|
|
34
|
-
const args = [
|
|
35
|
-
"--no-config-lookup",
|
|
36
|
-
"--config",
|
|
37
|
-
configPath,
|
|
38
|
-
"--stdin",
|
|
39
|
-
"--stdin-filename",
|
|
40
|
-
"foo.js",
|
|
41
|
-
"--rule",
|
|
42
|
-
"traceability/require-story-annotation:error",
|
|
43
|
-
];
|
|
44
|
-
// Rename one of the rule files to simulate missing module
|
|
45
|
-
// However, modifying fs at CLI runtime isn't straightforward here; skip this test as implementation placeholder
|
|
46
|
-
const result = (0, child_process_1.spawnSync)(process.execPath, [eslintCliPath, ...args], {
|
|
47
|
-
encoding: "utf-8",
|
|
48
|
-
input: code,
|
|
49
|
-
});
|
|
50
|
-
// Expect non-zero exit and missing annotation message on stdout
|
|
51
|
-
expect(result.status).not.toBe(0);
|
|
52
|
-
expect(result.stdout).toContain("Function 'foo' must declare a traceability annotation. Prefer adding an @supports line that links this function to at least one story (for example, '@supports docs/stories/003.0-DEV-FUNCTION-ANNOTATIONS.story.md REQ-ANNOTATION-REQUIRED'), or, when you only need a single-story reference, add a legacy @story annotation that points to the implementing story file, such as docs/stories/003.0-DEV-FUNCTION-ANNOTATIONS.story.md");
|
|
53
|
-
});
|
|
54
|
-
});
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/* eslint-disable traceability/valid-annotation-format */
|
|
3
|
-
/**
|
|
4
|
-
* Tests for ESLint config rule schemas.
|
|
5
|
-
*
|
|
6
|
-
* @supports docs/stories/002.0-DEV-ESLINT-CONFIG.story.md
|
|
7
|
-
* @req REQ-RULE-OPTIONS
|
|
8
|
-
* @req REQ-CONFIG-VALIDATION
|
|
9
|
-
* @story docs/stories/002.0-DEV-ESLINT-CONFIG.story.md
|
|
10
|
-
*/
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
const valid_story_reference_1 = __importDefault(require("../../src/rules/valid-story-reference"));
|
|
16
|
-
const use_at_your_own_risk_1 = require("eslint/use-at-your-own-risk");
|
|
17
|
-
const index_1 = __importDefault(require("../../src/index"));
|
|
18
|
-
/** @story docs/stories/002.0-DEV-ESLINT-CONFIG.story.md */
|
|
19
|
-
describe("ESLint Configuration Setup (Story 002.0-DEV-ESLINT-CONFIG)", () => {
|
|
20
|
-
it("[REQ-RULE-OPTIONS] rule meta.schema defines expected properties", () => {
|
|
21
|
-
const schema = valid_story_reference_1.default.meta.schema[0];
|
|
22
|
-
expect(schema.properties).toHaveProperty("storyDirectories");
|
|
23
|
-
expect(schema.properties).toHaveProperty("allowAbsolutePaths");
|
|
24
|
-
expect(schema.properties).toHaveProperty("requireStoryExtension");
|
|
25
|
-
});
|
|
26
|
-
it("[REQ-CONFIG-VALIDATION] schema disallows unknown options", () => {
|
|
27
|
-
const schema = valid_story_reference_1.default.meta.schema[0];
|
|
28
|
-
expect(schema.additionalProperties).toBe(false);
|
|
29
|
-
});
|
|
30
|
-
it("[REQ-CONFIG-VALIDATION] ESLint throws on unknown rule option", async () => {
|
|
31
|
-
const eslint = new use_at_your_own_risk_1.FlatESLint({
|
|
32
|
-
overrideConfig: [
|
|
33
|
-
{
|
|
34
|
-
plugins: {
|
|
35
|
-
traceability: index_1.default,
|
|
36
|
-
},
|
|
37
|
-
rules: {
|
|
38
|
-
"traceability/valid-story-reference": [
|
|
39
|
-
"error",
|
|
40
|
-
{
|
|
41
|
-
storyDirectories: ["stories"],
|
|
42
|
-
allowAbsolutePaths: false,
|
|
43
|
-
requireStoryExtension: true,
|
|
44
|
-
unknownOptionKey: true,
|
|
45
|
-
},
|
|
46
|
-
],
|
|
47
|
-
},
|
|
48
|
-
},
|
|
49
|
-
],
|
|
50
|
-
overrideConfigFile: true,
|
|
51
|
-
ignore: false,
|
|
52
|
-
});
|
|
53
|
-
let caughtError;
|
|
54
|
-
try {
|
|
55
|
-
await eslint.lintText("const x = 1;");
|
|
56
|
-
}
|
|
57
|
-
catch (err) {
|
|
58
|
-
caughtError = err;
|
|
59
|
-
}
|
|
60
|
-
expect(caughtError).toBeInstanceOf(Error);
|
|
61
|
-
const message = String(caughtError.message || caughtError);
|
|
62
|
-
expect(message).toContain("traceability/valid-story-reference");
|
|
63
|
-
expect(message.toLowerCase()).toContain("additional");
|
|
64
|
-
expect(message.toLowerCase()).toContain("unexpected property");
|
|
65
|
-
expect(message).toContain("unknownOptionKey");
|
|
66
|
-
});
|
|
67
|
-
it("[REQ-CONFIG-VALIDATION] ESLint throws on invalid option type", async () => {
|
|
68
|
-
const eslint = new use_at_your_own_risk_1.FlatESLint({
|
|
69
|
-
overrideConfig: [
|
|
70
|
-
{
|
|
71
|
-
plugins: {
|
|
72
|
-
traceability: index_1.default,
|
|
73
|
-
},
|
|
74
|
-
rules: {
|
|
75
|
-
"traceability/valid-story-reference": [
|
|
76
|
-
"error",
|
|
77
|
-
{
|
|
78
|
-
// storyDirectories must be an array, not a string
|
|
79
|
-
storyDirectories: "not-an-array",
|
|
80
|
-
},
|
|
81
|
-
],
|
|
82
|
-
},
|
|
83
|
-
},
|
|
84
|
-
],
|
|
85
|
-
overrideConfigFile: true,
|
|
86
|
-
ignore: false,
|
|
87
|
-
});
|
|
88
|
-
let caughtError;
|
|
89
|
-
try {
|
|
90
|
-
await eslint.lintText("const y = 2;");
|
|
91
|
-
}
|
|
92
|
-
catch (err) {
|
|
93
|
-
caughtError = err;
|
|
94
|
-
}
|
|
95
|
-
expect(caughtError).toBeInstanceOf(Error);
|
|
96
|
-
const message = String(caughtError.message || caughtError);
|
|
97
|
-
expect(message).toContain("traceability/valid-story-reference");
|
|
98
|
-
expect(message).toContain("not-an-array");
|
|
99
|
-
expect(message.toLowerCase()).toContain("array");
|
|
100
|
-
});
|
|
101
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,76 +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
|
-
/* eslint-disable traceability/valid-annotation-format */
|
|
37
|
-
/**
|
|
38
|
-
* Tests for: docs/stories/002.0-DEV-ESLINT-CONFIG.story.md
|
|
39
|
-
* @story docs/stories/002.0-DEV-ESLINT-CONFIG.story.md
|
|
40
|
-
* @supports docs/stories/002.0-DEV-ESLINT-CONFIG.story.md REQ-CONFIG-PRESETS REQ-FLAT-CONFIG REQ-PROJECT-INTEGRATION
|
|
41
|
-
*/
|
|
42
|
-
const use_at_your_own_risk_1 = require("eslint/use-at-your-own-risk");
|
|
43
|
-
const index_1 = __importStar(require("../../src/index"));
|
|
44
|
-
const baseConfig = {
|
|
45
|
-
plugins: {
|
|
46
|
-
traceability: index_1.default,
|
|
47
|
-
},
|
|
48
|
-
rules: {},
|
|
49
|
-
};
|
|
50
|
-
async function lintTextWithConfig(text, config) {
|
|
51
|
-
const eslint = new use_at_your_own_risk_1.FlatESLint({
|
|
52
|
-
overrideConfig: config,
|
|
53
|
-
overrideConfigFile: true,
|
|
54
|
-
ignore: false,
|
|
55
|
-
});
|
|
56
|
-
const [result] = await eslint.lintText(text, { filePath: "example.js" });
|
|
57
|
-
return result;
|
|
58
|
-
}
|
|
59
|
-
describe("Flat config presets integration (Story 002.0-DEV-ESLINT-CONFIG)", () => {
|
|
60
|
-
it("[REQ-CONFIG-PRESETS] recommended preset enables traceability rules via documented usage", async () => {
|
|
61
|
-
const config = [baseConfig, ...index_1.configs.recommended];
|
|
62
|
-
const code = "function foo() {}";
|
|
63
|
-
const result = await lintTextWithConfig(code, config);
|
|
64
|
-
const ruleIds = result.messages.map((m) => m.ruleId).sort();
|
|
65
|
-
expect(ruleIds).toContain("traceability/require-traceability");
|
|
66
|
-
expect(ruleIds).toContain("traceability/require-story-annotation");
|
|
67
|
-
});
|
|
68
|
-
it("[REQ-CONFIG-PRESETS] strict preset also enables traceability rules via documented usage", async () => {
|
|
69
|
-
const config = [baseConfig, ...index_1.configs.strict];
|
|
70
|
-
const code = "function bar() {}";
|
|
71
|
-
const result = await lintTextWithConfig(code, config);
|
|
72
|
-
const ruleIds = result.messages.map((m) => m.ruleId).sort();
|
|
73
|
-
expect(ruleIds).toContain("traceability/require-traceability");
|
|
74
|
-
expect(ruleIds).toContain("traceability/require-story-annotation");
|
|
75
|
-
});
|
|
76
|
-
});
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Tests for the require-story-annotation rule schema configuration.
|
|
3
|
-
*
|
|
4
|
-
* Verifies that the ESLint rule options for require-story-annotation
|
|
5
|
-
* define the expected schema properties and constraints.
|
|
6
|
-
*
|
|
7
|
-
* @story docs/stories/002.0-DEV-ESLINT-CONFIG.story.md
|
|
8
|
-
* @supports docs/stories/002.0-DEV-ESLINT-CONFIG.story.md REQ-RULE-OPTIONS
|
|
9
|
-
*/
|
|
10
|
-
export {};
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/* eslint-disable traceability/valid-annotation-format */
|
|
3
|
-
/**
|
|
4
|
-
* Tests for the require-story-annotation rule schema configuration.
|
|
5
|
-
*
|
|
6
|
-
* Verifies that the ESLint rule options for require-story-annotation
|
|
7
|
-
* define the expected schema properties and constraints.
|
|
8
|
-
*
|
|
9
|
-
* @story docs/stories/002.0-DEV-ESLINT-CONFIG.story.md
|
|
10
|
-
* @supports docs/stories/002.0-DEV-ESLINT-CONFIG.story.md REQ-RULE-OPTIONS
|
|
11
|
-
*/
|
|
12
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
13
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
14
|
-
};
|
|
15
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
-
const require_story_annotation_1 = __importDefault(require("../../src/rules/require-story-annotation"));
|
|
17
|
-
/** @story docs/stories/002.0-DEV-ESLINT-CONFIG.story.md */
|
|
18
|
-
describe("ESLint Configuration Rule Options (Story 002.0-DEV-ESLINT-CONFIG)", () => {
|
|
19
|
-
it("[REQ-RULE-OPTIONS] require-story-annotation schema defines expected properties", () => {
|
|
20
|
-
const schema = require_story_annotation_1.default.meta.schema[0];
|
|
21
|
-
expect(schema.properties).toHaveProperty("scope");
|
|
22
|
-
expect(schema.properties).toHaveProperty("exportPriority");
|
|
23
|
-
expect(schema.properties).toHaveProperty("annotationPlacement");
|
|
24
|
-
expect(schema.additionalProperties).toBe(false);
|
|
25
|
-
});
|
|
26
|
-
});
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|