-
-
Notifications
You must be signed in to change notification settings - Fork 16
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
Improve two-fer: recognise re-assignment #52
Comments
Hi @SleeplessByte, Does this include re-assignments like: export function twoFer(name) {
name = name ? name : "you"
return `One for me, and one for ${name}.`
} It's re-assigning the param value. I'm asking because I caught a solution like this today. Ignore me if you meant that as well haha |
This comment has been minimized.
This comment has been minimized.
The id is: 73b697a598c74e3b860500d78cd45312 |
Thank you for providing that (it allows me to do two things: find the current message, and run this example through an offline analyzer). Personally I'm on the fence of giving that as generic advice, but I have no problem with that advice in the context of this exercise. There is an eslint rule called
I do agree with this. I think often it's by mistake. However, in this case, it'd purposeful and unambigious. Questions for you (and anyone reading along):
|
I think it'll be interesting adding some wording like "it can cause unexpected side-effects" to make sure it's clear and maybe pointing them to The arguments object or even the eslint rule page about it. |
Is your feature request related to a problem? Please describe.
When a solution is provided with a re-assignment, the analyzer bails out of a lot of code paths.
When a solution is provided with a re-assignment of the named argument, the analyzer doesn't recognise the shadowing:
Which exercise
two-fer
Describe the solution you'd like
Simple re-assignments like the one above should be recognised and disapproved. They don't add any value to the solution.
Re-assignments of the named arguments should be recognised and disapproved. #52 (comment)
The text was updated successfully, but these errors were encountered: