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

Using .bind on a named closure marks it as unused #510

Closed
yphoenix opened this Issue Jan 14, 2014 · 4 comments

Comments

Projects
None yet
3 participants
@yphoenix

yphoenix commented Jan 14, 2014

Using .bind() on a named closure reports that it is defined but not used. This didn't happen prior to 0.2.0 - below cut down example from real code.

function MyFunc(callBack)
{
    callBack();
}

function NextPanel()
{
    MyFunc(
        function HideShowPanel()
        {
            this.show = true;
        }.bind(this));
}
@nzakas

This comment has been minimized.

Show comment
Hide comment
@nzakas

nzakas Jan 14, 2014

Member

So it is saying that HideShowPanel is unused?

Member

nzakas commented Jan 14, 2014

So it is saying that HideShowPanel is unused?

@michaelficarra

This comment has been minimized.

Show comment
Hide comment
@michaelficarra

michaelficarra Jan 14, 2014

Member

Yes. Here's a failing test case:

(function a(){})()

no-unused-vars will tell you that the function is unused, even though it clearly is.

Member

michaelficarra commented Jan 14, 2014

Yes. Here's a failing test case:

(function a(){})()

no-unused-vars will tell you that the function is unused, even though it clearly is.

@yphoenix

This comment has been minimized.

Show comment
Hide comment
@yphoenix

yphoenix Jan 14, 2014

Yes, sorry I wasn't clear, it marks HideShowPanel as unused.... without the .bind() it doesn't.

yphoenix commented Jan 14, 2014

Yes, sorry I wasn't clear, it marks HideShowPanel as unused.... without the .bind() it doesn't.

@nzakas

This comment has been minimized.

Show comment
Hide comment
@nzakas

nzakas Jan 15, 2014

Member

@michaelficarra We already have a test case for that pattern in no-unused-vars and it's passing.

Working on this now.

Member

nzakas commented Jan 15, 2014

@michaelficarra We already have a test case for that pattern in no-unused-vars and it's passing.

Working on this now.

@nzakas nzakas closed this in 62be675 Jan 17, 2014

@eslint eslint bot locked and limited conversation to collaborators Feb 7, 2018

@eslint eslint bot added the archived due to age label Feb 7, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.