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

Unused variable in arrow functions #557

Open
dcousens opened this issue Jun 30, 2016 · 8 comments

Comments

@dcousens
Copy link
Member

commented Jun 30, 2016

Example

let xs = [1, 2, 3]
let ys = xs.map((x) => xs + 1)

Expected unused variable "x", instead got nothing. Intentional?

@dcousens dcousens added the bug label Jun 30, 2016

@yoshuawuyts

This comment has been minimized.

Copy link
Contributor

commented Jun 30, 2016

This doesn't happen for normal functions either - hasn't for a while now iirc

@LinusU

This comment has been minimized.

Copy link
Member

commented Jun 30, 2016

I think it's because express forces you to have four arguments to be able to be an error handler, thus we cannot enforce unused variables when they are function parameters.

Relevant: expressjs/express#2896

This is a duplicate of: #419

@yoshuawuyts

This comment has been minimized.

Copy link
Contributor

commented Jun 30, 2016

I think it's because express forces you to have four arguments to be able to be an error handler

Oh wow, that's not a good pattern hey - had no idea they did that 😰

edit: looks like maintainers agree and they want to change it; that would unblock reintroducing this behavior for us I reckon

@dcousens

This comment has been minimized.

Copy link
Member Author

commented Jun 30, 2016

Ah true... closing as duplicate of #419

@dcousens dcousens closed this Jun 30, 2016

@feross

This comment has been minimized.

Copy link
Member

commented Jul 15, 2016

Yeah, happy to see about reintroducing this rule once there's a solution for all the express users out there (including myself!).

@LinusU

This comment has been minimized.

Copy link
Member

commented Jul 6, 2017

Since we are now allowing _ as an unused variable, I think that we should add this rule now since you can do the following:

app.use(function (err, _, __, ___) {

})

@LinusU LinusU reopened this Jul 6, 2017

@dcousens

This comment has been minimized.

Copy link
Member Author

commented Aug 21, 2017

@feross thoughts?

@LinusU

This comment has been minimized.

Copy link
Member

commented Jan 16, 2018

ping @feross 😀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
4 participants
You can’t perform that action at this time.