Open DetachHead opened 1 year ago
@DetachHead have you tried https://dartcodemetrics.dev/docs/rules/common/avoid-redundant-async? 🙂
@incendial thanks! looks like that rule was added since i last looked at dart_code_metrics
@DetachHead hm, maybe you have suggestions how we can help discover new rules?
personally i like to set linters to be as strict as possible. that way, i can see the errors in my codebase and decide for myself easily which new rules i want to disable. maybe if there was an option to enable all rules by default and have a list of rules to explicitly disable
You can, DCM now supports presets https://dartcodemetrics.dev/docs/getting-started/configuration#extending-an-existing-configuration-preset and https://github.com/dart-code-checker/dart-code-metrics/tree/master/lib/presets, this should cover you use-case
and to disable a rule, just simply write "rule-name": false in the rules list
awesome, thanks!
useless_async
Description
warns when using the
async
keyword when the function doesn't need toDetails
using the
async
keyword where it's not needed can lead to confusion and misunderstandings of howFutures
andasync
/await
works.eslint has a rule for this called
require-await
Kind
from the eslint rule docs:
Good Examples
Bad Examples
i often see code like this in real life. and when pointing it out it's usually due to a lack of understanding of what exactly
async
does.Discussion checklist