solid-software / solid_lints

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

Lint: use shorter name for local variable #152

Open danylo-safonov-solid opened 3 months ago

danylo-safonov-solid commented 3 months ago

If variable is used within x lines (e.g. make it 10, or make it configurable) prefer a shorter name, because it can probably deduced from context

final selectedNames = users.map((u) => u.name).where((n) => n.isSelected).toList();
final selectedNames = users.map((user) => user.name).where((name) => name.isSelected).toList();

first example is easier to read