๐ `--write` everywhere
Description
See #2240 for more context.
- [ ] Add
--writeand--unsafeoption to lint/check CLI commands ---writeindicates if (safe) code fixes should be applied ---unsafeindicates that safe and unsafe code fixes should be applied if--writeis passed - [ ] Make
biome <lint|check> --applyan alias ofbiome <lint|check> --write - [ ] Make
biome <lint|check> --apply-unsafean alias ofbiome <lint|check> --write --unsafe
Since this isn't clear unless someone reads the original discussion, --apply and --apply-unsafe have to be deprecated.
On second thought, I think we should use --fix instead of --write because it is a more common option name among linters. This will generate more deprecations, but I think it is time or never?
But Biome isn't just a linter ๐
But Biome isn't just a linter ๐
Yes. However, biome format --fix makes sense?
I feel that almost everything (write, fix, apply) is natural, but I'm not sure how people perceive lint --write.
I'm in favor of unifying --fix but considering --fix-unsafe, users might think the option only fixes unsafe code even though it does fix to the code with applying unsafe fix.
By the way, do we need to separate --fix (or others) and --unsafe?
I feel it makes things a bit more complex.
I don't understand what you mean, it seems to me that the following two paragraphs are contradictory.
I'm in favor of unifying --fix but considering --fix-unsafe, users might think the option only fixes unsafe code even though it does fix to the code with applying unsafe fix.
By the way, do we need to separate --fix (or others) and --unsafe? I feel it makes things a bit more complex.
I agree that --apply-unsafe is confusing: users could think that it only applies unsafe fixes, while it applies both safe and unsafe fixes.
It is why I proposed --unsafe.
Combined with --fix it applies safe and unsafe fixes.
This is what Ruff is doing, although the option is named --unsafe--fixes.
I looked back and sure enough, there was a contradiction๐ Ah right, the second paragraph, 'complex' was for handling command line arguments. But I got what this task means.
Alternatively, we could accept both --write and --fix because we have users migrating from Prettier (that uses --write) and ESLint (that uses --fix).
Alternatively, we could accept both
--writeand--fixbecause we have users migrating from Prettier (that uses--write) and ESLint (that uses--fix).
So one would be the alias of the other? I like the idea!
I also like it.
So one would be the alias of the other?
Yes. I am not fond of aliases, however, in our case, this looks like a good UX.
What should we do when biome <lint|check> --unsafe is given? (without --write and --fix)
It looks like a command to show lint errors subject to unsafe fixes. But here we should show an error incompatible arguments?
It looks like a command to show lint errors subject to unsafe fixes. But here we should show an error incompatible arguments?
For now, I could just throw a diagnostic saying that the flag is only usable with --fix.
We could re-evaluate this in the future if we find a use case.