Replies: 1 comment 7 replies
-
We could just emit a warning without changing the exit status. The exit status should certainly be set by the formatter/linter (pass or don't pass). |
Beta Was this translation helpful? Give feedback.
7 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
This "request" stems from a discussion thread on a recent PR ( #2300 )
Problem statement
A
,B
, andC
.C
has new changes after it has been staged.biome format/check/lint
reads the fileC
Although this should be "obvious" for anyone with sufficient experience with Git, it can be disconcerting for many users, and still annoying for the ones who understand what's going on.
Solution Proposal
When there is a discrepancy between "staged" and "local filesystem", Biome could issue a warning message and return with an exit status different than0
to signal a problem.When there is a discrepancy between "staged" and "local filesystem", Biome could issue a warning message and, in case we also have flags such as
--apply
or--write
(when we tell Biome to modify files), also return with an exit status different than0
to signal a problem.0
would be to include an extra condition: Biome must have fixed (or tried to fix) some of the files that have changes in the "local filesystem" after being staged. Summarizing, the conditions would be:--staged
flagF
that was changed after being staged--apply
,--write
or other mechanisms)F
file (at this point, we know that there is risk for "git conflicts", so returning an error would be justified).This involves an extra
git
command execution when the--staged
flag is passed, but it shouldn't impact execution time by much (in any case, given the use cases for--staged
, I think the small time penalty is worth it).Final notes
Beta Was this translation helpful? Give feedback.
All reactions