fix(export): exit 0 on a successful export regardless of source lint findings#126
Open
rmyndharis wants to merge 1 commit into
Open
fix(export): exit 0 on a successful export regardless of source lint findings#126rmyndharis wants to merge 1 commit into
rmyndharis wants to merge 1 commit into
Conversation
…findings The export command derived its exit code from the source's lint summary, so exporting a file that had any lint *error* exited 1 even though the export produced correct output. That conflates "the source has lint findings" (which `lint` already reports by exiting 1) with "the export failed." Decouple them: a successful export exits 0; only an invalid --format or an emitter failure exits 1 (and an unreadable input exits 2, via readInput). Document the export exit codes in the README.
rajpratham1
approved these changes
Jun 25, 2026
rajpratham1
left a comment
There was a problem hiding this comment.
This is a sensible fix that clearly separates the responsibilities of the export and lint commands. If an export successfully produces output, it should exit with 0 regardless of lint findings, while lint remains the command responsible for enforcing validation failures. The added regression tests cover both behaviors, and the README has been updated to document the exit code semantics.
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
exportset its exit code from the source's lint summary:So exporting a DESIGN.md that has a lint error (e.g. one invalid color) exited
1even though the export ran and produced correct output for every valid token. That conflates two different things — "the source has lint findings" and "the export failed" — in one exit code, and it's undocumented.Change (behavior change)
Decouple the export exit code from source lint findings:
lintto gate on those)--formator an emitter failurereadInput)Documented in the README's
exportsection. This is a deliberate behavior change on the success path (export of a lint-error file:1→0); flagging it explicitly in case the coupling was intended as a validation gate —lintalready serves that purpose.Testing
commands/export-exit-code.test.ts(spawns the CLI): export of a lint-error file → exit0with output;lintof the same file → exit1.bun test: 284 pass, 1 skip, 0 fail.bun run lint: clean.