-
Notifications
You must be signed in to change notification settings - Fork 65
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
feature suggestion: must use value #54
Comments
Well, since Lodash v4, _(a)
.map('a')
.forEach((a) => {}) Which would make this redundant. If you use the Also, this would assume that everyone uses each function for its intended use. |
Yes, im aware we could use implicit chaining but i was outvoted, other developers preferred consistency/simplicity over elegance. |
And it would be easy to tell if lodash was used only for side effects (basically determine if the parent is a statement), just difficult to tell if it was used for value and side effects (but again possibleb |
Possibly related, I've been thinking that there should be a rule about requiring that the output of This would help prevent people using |
Yes, that would be good. |
You make a good point - the whole point of giving options to rules like |
Good rule, it found 4 cases of confusing code. I am wondering if for my other concern, which is purely stylistic, another rule "disallow-chain-methods"(with option for methods to not allow chaining with) might make sense so I could disallow forEach within a chain ? |
so we require explicit chains, but I don't like the look of..
I think the code would be clearer and more likely correct if any chains ending in value() are assigned to something, so the above code would have to be
and it would prevent chains not being assigned (e.g. useless code)
wdyt?
btw sorry I know I haven't submitted a pr for my last feature but still slowly switching on your rules on our large codebase...
The text was updated successfully, but these errors were encountered: