Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lint: use shorter name for local variable #152

Open
danylo-safonov-solid opened this issue Mar 27, 2024 · 0 comments
Open

Lint: use shorter name for local variable #152

danylo-safonov-solid opened this issue Mar 27, 2024 · 0 comments

Comments

@danylo-safonov-solid
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant