fix(folder-structure-cruiser): return exit code 1 when violations are found#268
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Updates folder-structure-cruiser so validations report violation counts to callers and the CLI exits with a non-zero status when violations (or runtime errors) are detected.
Changes:
- Change
validateCrossFeatureImportsandvalidateSharedComponentto return the number of detected violations. - Update CLI (
src/bin.ts) to setprocess.exitCode = 1when violations are found, and useparseAsync().catch(...)for runtime error handling. - Update tests and README to reflect the new return contract.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/folder-structure-cruiser/src/commands/validateSharedComponent.ts | Return violation count and keep console output behavior. |
| packages/folder-structure-cruiser/src/commands/validateCrossFeatureImports.ts | Return violation count and keep console output behavior. |
| packages/folder-structure-cruiser/src/bin.ts | Set exit code based on violations; catch async parse/runtime errors. |
| packages/folder-structure-cruiser/README.md | Document updated return type (Promise<number>). |
| packages/folder-structure-cruiser/tests/shared-components.spec.ts | Assert returned violation count in tests. |
| packages/folder-structure-cruiser/tests/cross-feature-imports.spec.ts | Assert returned violation count in tests (partially). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Contributor
Author
|
@cursor fix comments |
|
Zrobione — poprawiłem komentarze z review i wypchnąłem zmiany. Co naprawiłem
Weryfikacja
Git / PR
|
Komoszek
commented
Apr 30, 2026
Co-authored-by: Łukasz Komoszyński <Komoszek@users.noreply.github.com>
Co-authored-by: Łukasz Komoszyński <Komoszek@users.noreply.github.com>
Co-authored-by: Łukasz Komoszyński <Komoszek@users.noreply.github.com>
5a670ee to
2f144bd
Compare
katarzynagrasewicz
approved these changes
May 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Summary
validateCrossFeatureImports,validateSharedComponent) to return the number of detected violations instead of swallowing failuressrc/bin.ts) to setprocess.exitCode = 1when violations are detectedprogram.parseAsync().catch(...)so runtime errors also result in non-zero exit codeviolation(s)in both validators, as requested in PR commentslogger.errorcross-feature-importsallow-cases to assertviolationsCount === 0using fixtures that actually satisfy the ruleVerification
npx vitest run --config packages/folder-structure-cruiser/vite.config.mtsnpx nx build folder-structure-cruiser1on violations,0on clean run)node/npmbinaries are unavailable right now, so tests could not be re-run for this last wording-only changeSlack Thread