eslint-plugin-traceability 1.23.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 +9 -3
- package/package.json +8 -8
- 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}/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,9 +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
|
-
*
|
|
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))
|
|
7
13
|
|
|
8
14
|
# Changelog
|
|
9
15
|
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-traceability",
|
|
3
|
-
"version": "1.23.
|
|
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,7 +46,7 @@
|
|
|
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",
|
|
@@ -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 {};
|
|
@@ -1,133 +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
|
-
* Prettier integration tests for annotationPlacement: "inside" across multiple branch types.
|
|
9
|
-
* @story docs/stories/028.0-DEV-ANNOTATION-PLACEMENT-STANDARDIZATION.story.md
|
|
10
|
-
* @supports docs/stories/028.0-DEV-ANNOTATION-PLACEMENT-STANDARDIZATION.story.md REQ-PRETTIER-STABLE REQ-INSIDE-BRACE-PLACEMENT REQ-PLACEMENT-CONFIG
|
|
11
|
-
*/
|
|
12
|
-
const path_1 = __importDefault(require("path"));
|
|
13
|
-
const child_process_1 = require("child_process");
|
|
14
|
-
const prettier_test_helpers_1 = require("./prettier-test-helpers");
|
|
15
|
-
describe("annotationPlacement: 'inside' with Prettier (Story 028.0-DEV-ANNOTATION-PLACEMENT-STANDARDIZATION)", () => {
|
|
16
|
-
const eslintPkgDir = path_1.default.dirname(require.resolve("eslint/package.json"));
|
|
17
|
-
const eslintCliPath = path_1.default.join(eslintPkgDir, "bin", "eslint.js");
|
|
18
|
-
const configPath = path_1.default.resolve(__dirname, "../../eslint.config.js");
|
|
19
|
-
function buildInsidePlacementArgs(stdinFilename) {
|
|
20
|
-
return [
|
|
21
|
-
"--no-config-lookup",
|
|
22
|
-
"--config",
|
|
23
|
-
configPath,
|
|
24
|
-
"--stdin",
|
|
25
|
-
"--stdin-filename",
|
|
26
|
-
stdinFilename,
|
|
27
|
-
"--rule",
|
|
28
|
-
"no-unused-vars:off",
|
|
29
|
-
"--rule",
|
|
30
|
-
"no-magic-numbers:off",
|
|
31
|
-
"--rule",
|
|
32
|
-
"no-undef:off",
|
|
33
|
-
"--rule",
|
|
34
|
-
"no-console:off",
|
|
35
|
-
"--rule",
|
|
36
|
-
'traceability/require-branch-annotation:["error",{"annotationPlacement":"inside"}]',
|
|
37
|
-
];
|
|
38
|
-
}
|
|
39
|
-
function runEslintWithInsidePlacement(code, _filename) {
|
|
40
|
-
// Pin stdin filename to a tsconfig-included path to satisfy @typescript-eslint/parser's project lookup in these integration tests.
|
|
41
|
-
const args = buildInsidePlacementArgs("src/annotation-placement-inside.ts");
|
|
42
|
-
return (0, child_process_1.spawnSync)(process.execPath, [eslintCliPath, ...args], {
|
|
43
|
-
encoding: "utf-8",
|
|
44
|
-
input: code,
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
function formatWithPrettier(source) {
|
|
48
|
-
return (0, prettier_test_helpers_1.formatWithPrettier)(source, { parser: "typescript" });
|
|
49
|
-
}
|
|
50
|
-
it("[REQ-PRETTIER-STABLE][REQ-INSIDE-BRACE-PLACEMENT] accepts formatted code with inside-brace annotations for if/else and loops", () => {
|
|
51
|
-
const original = `
|
|
52
|
-
function demo(value: number) {
|
|
53
|
-
if (value > 0) {
|
|
54
|
-
// @story docs/stories/028.0-DEV-ANNOTATION-PLACEMENT-STANDARDIZATION.story.md
|
|
55
|
-
// @req REQ-IF-INSIDE
|
|
56
|
-
console.log('positive');
|
|
57
|
-
} else if (value < 0) {
|
|
58
|
-
// @story docs/stories/028.0-DEV-ANNOTATION-PLACEMENT-STANDARDIZATION.story.md
|
|
59
|
-
// @req REQ-ELSE-IF-INSIDE
|
|
60
|
-
console.log('negative');
|
|
61
|
-
} else {
|
|
62
|
-
// @story docs/stories/028.0-DEV-ANNOTATION-PLACEMENT-STANDARDIZATION.story.md
|
|
63
|
-
// @req REQ-ELSE-INSIDE
|
|
64
|
-
console.log('zero');
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
for (const item of [1, 2, 3]) {
|
|
68
|
-
// @story docs/stories/028.0-DEV-ANNOTATION-PLACEMENT-STANDARDIZATION.story.md
|
|
69
|
-
// @req REQ-LOOP-INSIDE
|
|
70
|
-
console.log(item);
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
`;
|
|
74
|
-
const formatted = formatWithPrettier(original);
|
|
75
|
-
const result = runEslintWithInsidePlacement(formatted, "annotation-placement-inside-if-loop.ts");
|
|
76
|
-
expect(result.stdout).not.toContain("traceability/require-branch-annotation");
|
|
77
|
-
expect([0, 1]).toContain(result.status);
|
|
78
|
-
});
|
|
79
|
-
it("[REQ-PRETTIER-STABLE][REQ-INSIDE-BRACE-PLACEMENT] accepts formatted code with inside-brace annotations for try/finally and catch", () => {
|
|
80
|
-
const original = `
|
|
81
|
-
function demoTry(flag: boolean) {
|
|
82
|
-
try {
|
|
83
|
-
// @story docs/stories/028.0-DEV-ANNOTATION-PLACEMENT-STANDARDIZATION.story.md
|
|
84
|
-
// @req REQ-TRY-INSIDE
|
|
85
|
-
if (flag) {
|
|
86
|
-
throw new Error('boom');
|
|
87
|
-
}
|
|
88
|
-
} catch (error) {
|
|
89
|
-
// @story docs/stories/028.0-DEV-ANNOTATION-PLACEMENT-STANDARDIZATION.story.md
|
|
90
|
-
// @req REQ-CATCH-INSIDE
|
|
91
|
-
console.error(error);
|
|
92
|
-
} finally {
|
|
93
|
-
// @story docs/stories/028.0-DEV-ANNOTATION-PLACEMENT-STANDARDIZATION.story.md
|
|
94
|
-
// @req REQ-FINALLY-INSIDE
|
|
95
|
-
console.log('cleanup');
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
`;
|
|
99
|
-
const formatted = formatWithPrettier(original);
|
|
100
|
-
const result = runEslintWithInsidePlacement(formatted, "annotation-placement-inside-try.ts");
|
|
101
|
-
expect(result.stdout).not.toContain("traceability/require-branch-annotation");
|
|
102
|
-
expect([0, 1]).toContain(result.status);
|
|
103
|
-
});
|
|
104
|
-
it("[REQ-PRETTIER-STABLE][REQ-INSIDE-BRACE-PLACEMENT] accepts formatted code with inside-brace annotations for switch cases", () => {
|
|
105
|
-
const original = `
|
|
106
|
-
function demoSwitch(status: 'pending' | 'done' | 'other') {
|
|
107
|
-
switch (status) {
|
|
108
|
-
case 'pending': {
|
|
109
|
-
// @story docs/stories/028.0-DEV-ANNOTATION-PLACEMENT-STANDARDIZATION.story.md
|
|
110
|
-
// @req REQ-SWITCH-PENDING-INSIDE
|
|
111
|
-
console.log('pending');
|
|
112
|
-
break;
|
|
113
|
-
}
|
|
114
|
-
case 'done': {
|
|
115
|
-
// @story docs/stories/028.0-DEV-ANNOTATION-PLACEMENT-STANDARDIZATION.story.md
|
|
116
|
-
// @req REQ-SWITCH-DONE-INSIDE
|
|
117
|
-
console.log('done');
|
|
118
|
-
break;
|
|
119
|
-
}
|
|
120
|
-
default: {
|
|
121
|
-
// @story docs/stories/028.0-DEV-ANNOTATION-PLACEMENT-STANDARDIZATION.story.md
|
|
122
|
-
// @req REQ-SWITCH-DEFAULT-INSIDE
|
|
123
|
-
console.log('other');
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
`;
|
|
128
|
-
const formatted = formatWithPrettier(original);
|
|
129
|
-
const result = runEslintWithInsidePlacement(formatted, "annotation-placement-inside-switch.ts");
|
|
130
|
-
expect(result.stdout).not.toContain("traceability/require-branch-annotation");
|
|
131
|
-
expect([0, 1]).toContain(result.status);
|
|
132
|
-
});
|
|
133
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,121 +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
|
-
* Prettier integration tests for CatchClause annotation positions.
|
|
9
|
-
* @story docs/stories/025.0-DEV-CATCH-ANNOTATION-POSITION.story.md
|
|
10
|
-
* @supports docs/stories/025.0-DEV-CATCH-ANNOTATION-POSITION.story.md REQ-PRETTIER-COMPATIBILITY
|
|
11
|
-
*/
|
|
12
|
-
const path_1 = __importDefault(require("path"));
|
|
13
|
-
const child_process_1 = require("child_process");
|
|
14
|
-
const prettier_test_helpers_1 = require("./prettier-test-helpers");
|
|
15
|
-
describe("CatchClause annotations with Prettier (Story 025.0-DEV-CATCH-ANNOTATION-POSITION)", () => {
|
|
16
|
-
const eslintPkgDir = path_1.default.dirname(require.resolve("eslint/package.json"));
|
|
17
|
-
const eslintCliPath = path_1.default.join(eslintPkgDir, "bin", "eslint.js");
|
|
18
|
-
const configPath = path_1.default.resolve(__dirname, "../../eslint.config.js");
|
|
19
|
-
function runEslintWithRequireBranchAnnotation(code) {
|
|
20
|
-
const args = [
|
|
21
|
-
"--no-config-lookup",
|
|
22
|
-
"--config",
|
|
23
|
-
configPath,
|
|
24
|
-
"--stdin",
|
|
25
|
-
"--stdin-filename",
|
|
26
|
-
"catch.js",
|
|
27
|
-
"--rule",
|
|
28
|
-
"no-unused-vars:off",
|
|
29
|
-
"--rule",
|
|
30
|
-
"no-magic-numbers:off",
|
|
31
|
-
"--rule",
|
|
32
|
-
"no-undef:off",
|
|
33
|
-
"--rule",
|
|
34
|
-
"no-console:off",
|
|
35
|
-
"--rule",
|
|
36
|
-
"traceability/require-branch-annotation:error",
|
|
37
|
-
];
|
|
38
|
-
return (0, child_process_1.spawnSync)(process.execPath, [eslintCliPath, ...args], {
|
|
39
|
-
encoding: "utf-8",
|
|
40
|
-
input: code,
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
it("[REQ-PRETTIER-COMPATIBILITY-BEFORE] accepts code where annotations start before catch but are moved inside by Prettier", () => {
|
|
44
|
-
const original = `
|
|
45
|
-
function doSomething() {
|
|
46
|
-
return 42;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
function handleError(error) {
|
|
50
|
-
console.error(error);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
// @story docs/stories/004.0-DEV-BRANCH-ANNOTATIONS.story.md
|
|
54
|
-
// @req REQ-BRANCH-TRY
|
|
55
|
-
try {
|
|
56
|
-
doSomething();
|
|
57
|
-
}
|
|
58
|
-
// @story docs/stories/025.0-DEV-CATCH-ANNOTATION-POSITION.story.md
|
|
59
|
-
// @req REQ-CATCH-PATH
|
|
60
|
-
catch (error) {
|
|
61
|
-
handleError(error);
|
|
62
|
-
}
|
|
63
|
-
`;
|
|
64
|
-
const formatted = (0, prettier_test_helpers_1.formatWithPrettier)(original);
|
|
65
|
-
// Sanity check: Prettier should move the branch annotations inside the catch body.
|
|
66
|
-
expect(formatted).toContain("catch (error) {");
|
|
67
|
-
const catchIndex = formatted.indexOf("catch (error) {");
|
|
68
|
-
const storyIndex = formatted.indexOf("@story docs/stories/025.0-DEV-CATCH-ANNOTATION-POSITION.story.md");
|
|
69
|
-
expect(storyIndex).toBeGreaterThan(catchIndex);
|
|
70
|
-
const result = runEslintWithRequireBranchAnnotation(formatted);
|
|
71
|
-
expect(result.status).toBe(0);
|
|
72
|
-
});
|
|
73
|
-
it("[REQ-PRETTIER-COMPATIBILITY-INSIDE] accepts code where annotations start inside the catch body and are preserved by Prettier", () => {
|
|
74
|
-
const original = `
|
|
75
|
-
function doSomething() {
|
|
76
|
-
return 42;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
function handleError(error) {
|
|
80
|
-
console.error(error);
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
// @story docs/stories/004.0-DEV-BRANCH-ANNOTATIONS.story.md
|
|
84
|
-
// @req REQ-BRANCH-TRY
|
|
85
|
-
try {
|
|
86
|
-
doSomething();
|
|
87
|
-
} catch (error) {
|
|
88
|
-
// @story docs/stories/025.0-DEV-CATCH-ANNOTATION-POSITION.story.md
|
|
89
|
-
// @req REQ-CATCH-INSIDE
|
|
90
|
-
handleError(error);
|
|
91
|
-
}
|
|
92
|
-
`;
|
|
93
|
-
const formatted = (0, prettier_test_helpers_1.formatWithPrettier)(original);
|
|
94
|
-
// Sanity: annotations should still be associated with the catch body after formatting.
|
|
95
|
-
expect(formatted).toContain("catch (error) {");
|
|
96
|
-
const catchIndex = formatted.indexOf("catch (error) {");
|
|
97
|
-
const storyIndex = formatted.indexOf("@story docs/stories/025.0-DEV-CATCH-ANNOTATION-POSITION.story.md");
|
|
98
|
-
expect(storyIndex).toBeGreaterThan(catchIndex);
|
|
99
|
-
const result = runEslintWithRequireBranchAnnotation(formatted);
|
|
100
|
-
expect(result.status).toBe(0);
|
|
101
|
-
});
|
|
102
|
-
it("[REQ-PRETTIER-COMPATIBILITY-EMPTY] accepts empty catch blocks with inside-catch annotations after Prettier formatting", () => {
|
|
103
|
-
const original = `
|
|
104
|
-
function doSomething() {
|
|
105
|
-
return 42;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
// @story docs/stories/004.0-DEV-BRANCH-ANNOTATIONS.story.md
|
|
109
|
-
// @req REQ-BRANCH-TRY
|
|
110
|
-
try {
|
|
111
|
-
doSomething();
|
|
112
|
-
} catch (error) {
|
|
113
|
-
// @story docs/stories/025.0-DEV-CATCH-ANNOTATION-POSITION.story.md
|
|
114
|
-
// @req REQ-CATCH-EMPTY
|
|
115
|
-
}
|
|
116
|
-
`;
|
|
117
|
-
const formatted = (0, prettier_test_helpers_1.formatWithPrettier)(original);
|
|
118
|
-
const result = runEslintWithRequireBranchAnnotation(formatted);
|
|
119
|
-
expect(result.status).toBe(0);
|
|
120
|
-
});
|
|
121
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|