Make suppression explanation optional #2907
Replies: 4 comments 12 replies
-
I think it’s probably a good thing the message is required. I will admit there have been times where I couldn’t come up with a good message and I filled in something silly like “It is what it is”. But every time I fill in something and usually it is useful. The reason I like it being required is because it forces people to think. The exception is there for a reason, so there’s value in documenting it. Maybe the reason is obvious, silly, or pedantic at times, but I’d rather have those documented too than to miss out on a reason that should have been documented but wasn’t. So there’s my crux: I think if we make reasons optional, people will less often stop to think about the reason and simply omit it because they can’t be bothered. You mention currently 40% of usages have a useless reason (I didn’t count to verify), but I think if we make them optional that percentage could easily increase to say 50% or 60%. Unfortunately we can’t really A/B test this, so it’s based on a gut feeling, but if true I think we would loose more value in the useful messages that will be omitted, than we would save by allowing people to not have to think too much. All that said, we can probably improve the error message in the parser when a reason is missing. |
Beta Was this translation helpful? Give feedback.
-
Thank you Colin for raising the argument. There's no previous discussion because it's always been like this since the beginning, and now that adoption increases, I think it's totally normal to debate decision. Arend explained quite well the reasons behind the decision. An explanation can be useful for various reasons:
An explanation can become tedious for personal projects, where there's only one developer. However, an explanation can become very useful in codebases maintained by various developers: context, knowledge base and exceptions, aren't missed or forgotten. I know requiring an explanation can be very controversial, depending on where a developer come from, however I believe that this, on the long run, can enforce a higher quality in the projects. As a personal note, I have been pushing people and co-workers to add an explanation every time they turn off an eslint rule, use |
Beta Was this translation helpful? Give feedback.
-
Thanks Emanuele! I'll leave some final thoughts here. Whether or not providing an explanation is a good practice is almost beside the point (of course it is!). The more relevant questions are:
I think neither of these are really answerable, but there is evidence that both DX and code quality suffer in a very sizable fraction of codebases. I think you'll agree that lots of nonsense or filler explanations is a bad code hygiene. You guys have done a better job than me at listing scenarios where an explanation may not be useful to the developer: personal projects, self-evident explanations, etc. The "personal project" argument is particularly compelling. The vast majority of codebases are only ever touched by one person, so Biome should perhaps provide some affordance for that scenario, or even prioritize it.
I don't know how these decisions get made, but for anything controversial like this, would adding a flag be an appropriate solution? |
Beta Was this translation helpful? Give feedback.
-
I would be in favor of making this optional. I actually originally required comments for all suppression comments in Grit and relaxed it after feedback from customers (even though theoretically GritQL makes it easy to custom exclusions). Every lint rule has a cost in DX and people will only continue using rules that have a benefit which outweighs the cost. Requiring an exaplanation for every ignore (especially since many codebases end up with common ignore patterns for specific rules) increases that cost. The end result can easily be worse code since developers opt to remove the rule entirely instead of adding lots of filler ignore lines. |
Beta Was this translation helpful? Give feedback.
-
I couldn't find any existing discussion of this, but apologies if I missed something.
I'm in the process of switching Zod's codebase over Biome and absolutely loving it. The only thing that stuck in my craw is the fact that suppression messages are required when using
// biome-ignore
.For library authors specifically, there's always weird code we need to write for arcane reasons (the example below is used to implement
z.instanceof
). Even in application development more broadly there are a ton of cases where there isn't a good explanation to give.It feels a bit paternalistic to require it, and in practice I'm guessing many people will just leave a trailing semi-colon or a filler message. Check out this GitHub code search query for validation of that: https://github.com/search?type=code&auto_enroll=true&q=%22%2F%2F+biome-ignore%22 It's ~40% of
biome-ignore
usages don't contain an informative message. Ultimately it's a DX paper cut but it triggers my OCD a bit.Something to consider! Thanks for all the great work on Biome, it makes my life better every day.
Beta Was this translation helpful? Give feedback.
All reactions