-
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
feat: prefer-immutable-method #154
Comments
Hey, |
sorry for the delay. examples based on searching for "mutate" on https://lodash.com/docs
there are also methods without an alternative method, but obviously with functional alternatives. I personally would still like a warning/error on them, but maybe these should go under a different rule
PS: a 👶 was born, so no time for PR |
Added in |
Good work there but why would it be set as error in recommended rules ? It's not just a "good/bad" stylistic rule, its also about speed/memory consumption as well, am i wrong ? There's no telling from the original issue or the doc why it isn't a good thing to use mutable. Perhaps its a bad stylistic rule, but its more efficient. I haven't done the test myself but removing one element from 100000 goes faster (and with lot less memory consumption) with mutable than with immutable obviously. IMHO, it shouldn't be an "error" in recommended rules but a "warning" or not in it, at all. Anyway lots of our project which are based on ^2.5.0 doesn't pass CI anymore... Just saying. |
Would a rule prefer-immutable-method make sense for you? It would barf if there is a non-mutating lodash alternative to the current function e.g. prefer filter over remove.
I could send out a PR if you're in but you want external help.
The text was updated successfully, but these errors were encountered: