solid-software / solid_lints

🟧 Lints for Dart and Flutter based on software industry standards and best practices.
Other
36 stars 17 forks source link

Improve `no_empty_blocks` #172

Open arthurbcd opened 1 month ago

arthurbcd commented 1 month ago

Some empty blocks such as setState should and can be empty in some cases: https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo#comment-empty-closures-to-setstate

I suggest adding an option to resolve the lint when adding any comments, other than just TODO.

no_empty_blocks:
  allow_todos: true
  allow_comments: true

It would be also interesting to improve the linter message, instead of just "Block is empty...".

Depending on the configuration, we could say something like: LINTER: "Empty blocks are often indicators of missing code. Either implement it or add a TODO/comment."

I can see this as a really strong lint to find all empty blocks when needed, by just changing those values of the linter.

Thanks for this linter. Has been really useful for me and my team. :)