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

consistent-function-scoping: regression: ignored in function argument #770

Closed
kevinoid opened this issue Jun 14, 2020 · 2 comments · Fixed by #772
Closed

consistent-function-scoping: regression: ignored in function argument #770

kevinoid opened this issue Jun 14, 2020 · 2 comments · Fixed by #772
Assignees

Comments

@kevinoid
Copy link

The consistent-function-scoping rule no longer warns about functions defined inside a function being passed as an argument. For example:

process.nextTick(() => {
  function returnsZero() {
    return true;
  }
  process.exitCode = returnsZero();
});

In eslint-plugin-unicorn@19.0.1 this would cause:

example.js:2:3: Move function `returnsZero` to the outer scope. [Error/unicorn/consistent-function-scoping]

In eslint-plugin-unicorn@20.0.0 and later (up to 7781c3f, current master) it does not cause an error.

I bisected the regression to 1f4413d from #707. Perhaps the IIFE identification is a bit too aggressive? (I wouldn't consider any of the functions in the above example to be immediately-invoked, but perhaps I'm missing something?)

Thanks again,
Kevin

@fisker
Copy link
Collaborator

fisker commented Jun 17, 2020

Sorry about this, It's mistake in #707, should be fixed by #772

@kevinoid
Copy link
Author

No worries. I should have caught it earlier. I just tested #772 and it fixes this issue for me and I didn't find any other regressions. Thanks @fisker!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants