From the Effective Dart, you have these severity types:
- DO guidelines describe practices that should always be followed. There will almost never be a valid reason to stray from them.
- DON’T guidelines are the converse: things that are almost never a good idea. Hopefully, we don’t have as many of these as other languages do because we have less historical baggage.
- PREFER guidelines are practices that you should follow. However, there may be circumstances where it makes sense to do otherwise. Just make sure you understand the full implications of ignoring the guideline when you do.
- AVOID guidelines are the dual to “prefer”: stuff you shouldn’t do but where there may be good reasons to on rare occasions.
- CONSIDER guidelines are practices that you might or might not want to follow, depending on circumstances, precedents, and your own preference.
And as I understand, you can use four types of severity for analyzer:
error
warning
info
ignore
And more info about how it can be done here: https://dart.dev/guides/language/analysis-options#the-analysis-options-file
I would like to (and this is not opinionated, it would be nice to have in general to determine these types from the guide in the editor) reflect the type of usage from guidelines in Effective Dart, so do
and don't
rules are treated as they have to be done this way and prefer
and avoid
as only optional? With that, without enabling thins like --fatal-infos
and --fatal-warnings
, it would be good if analyzer would fail for do
s and don't
s and don't fail for prefer
s and avoid
s.
- Does this have a sense, is it worth it?
For example, in pedantic package, there is written "By default we disallow checking in code with any errors, warnings, or hints." and that might work if all the lints are given the same severity, but Effective Dart doesn't have this benefit. 🤷♂️
- Can I use
error
for do
s and don't
s, or it's too hard? Should I use warning
for that?
- If
error
will be used for do
s and don't
s, then warning
for prefer
s and avoid
s and info
for consider
s?
- if
consider
s would have info
, and therefore be shown as a "something" from Dart Analyser, wouldn't that force people to use it, whereas this section isn't always what you want to do? So maybe omit consider
s?
I would like some comments, mostly to be as aligned as possible with the guide intention.
Maybe cc @pq @kwalrath ...
enhancement feedback wanted