You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As of today, biome does not provide a direct mechanism to select (for linting, formatting or checking) only the files that are staged for a commit.
We have a "similar" flag, --changed, but its main purpose is to be used in CI, and allows us to check only the files that changed between 2 points in history (which can be explicit or implicit).
Many people think at first that --changed will also help them to select only the files that are staged, not being the case.
More advanced users have found workarounds to this issue ( #1198 (comment) ), but these involve having to write longer, more complex and slower scripts. Not everyone can come up with these solutions, even if they seem simple after we see them.
Others rely on tools such as lint-staged, but this involves adding more dependencies to the project (which in this case are much slower than biome), and opens up the possibility for more bugs caused by unexpected interactions between lint-staged and biome.
Proposal
After a discussion held in Discord ( https://discord.com/channels/1132231889290285117/1222450681919832134 ), we agreed that it would be a good idea to introduce a new --staged flag for the lint, format and check commands that will make biome take into account only the files that are staged.
Addendum
While --staged doesn't give us much when we are running "potentially destructive" commands such as format or check --apply (because we still need to independently obtain a list of staged files so we can re-add them to the "stage" before they are committed), it gives a clear advantage for readonly-mode commands such as lint without --apply.
The text was updated successfully, but these errors were encountered:
Description
Problem Statement
As of today,
biome
does not provide a direct mechanism to select (for linting, formatting or checking) only the files that are staged for a commit.We have a "similar" flag,
--changed
, but its main purpose is to be used in CI, and allows us to check only the files that changed between 2 points in history (which can be explicit or implicit).Many people think at first that
--changed
will also help them to select only the files that are staged, not being the case.More advanced users have found workarounds to this issue ( #1198 (comment) ), but these involve having to write longer, more complex and slower scripts. Not everyone can come up with these solutions, even if they seem simple after we see them.
Others rely on tools such as
lint-staged
, but this involves adding more dependencies to the project (which in this case are much slower thanbiome
), and opens up the possibility for more bugs caused by unexpected interactions betweenlint-staged
andbiome
.Proposal
After a discussion held in Discord ( https://discord.com/channels/1132231889290285117/1222450681919832134 ), we agreed that it would be a good idea to introduce a new
--staged
flag for thelint
,format
andcheck
commands that will make biome take into account only the files that are staged.Addendum
While
--staged
doesn't give us much when we are running "potentially destructive" commands such asformat
orcheck --apply
(because we still need to independently obtain a list of staged files so we can re-add them to the "stage" before they are committed), it gives a clear advantage for readonly-mode commands such aslint
without--apply
.The text was updated successfully, but these errors were encountered: