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

no-undef doesn't fire on self reference naming #7333

Closed
benjick opened this issue Oct 10, 2016 · 4 comments
Closed

no-undef doesn't fire on self reference naming #7333

benjick opened this issue Oct 10, 2016 · 4 comments
Labels
archived due to age This issue has been archived; please open a new issue for any further discussion question This issue asks a question about ESLint

Comments

@benjick
Copy link

benjick commented Oct 10, 2016

Tell us about your environment

  • ESLint Version: 3.7.1
  • Node Version: v6.3.0
  • npm Version: 3.10.3

What parser (default, Babel-ESLint, etc.) are you using?
Default

Please show your full configuration:

{
  "rules": {
    "no-undef": 1
  }
}

What did you do? Please include the actual source code causing the issue.

var bar = quz;
var foo = foo;

What did you expect to happen?

eslint-no-undef-self-ref/index.js
  1:11  warning  'quz' is not defined  no-undef
  2:11  warning  'foo' is not defined  no-undef

✖ 2 problems (0 errors, 2 warnings)

What actually happened? Please include the actual, raw output from ESLint.

eslint-no-undef-self-ref/index.js
  1:11  warning  'quz' is not defined  no-undef

✖ 1 problem (0 errors, 1 warning)

Repo with reproduction: https://github.com/benjick/eslint-no-undef-self-ref

@eslintbot eslintbot added the triage An ESLint team member will look at this issue soon label Oct 10, 2016
@not-an-aardvark
Copy link
Member

Hello, thanks for the report.

I think this is intended behavior; to prevent this, you should use no-use-before-define instead.

See also: #5437, #7111

@not-an-aardvark not-an-aardvark added question This issue asks a question about ESLint and removed triage An ESLint team member will look at this issue soon labels Oct 10, 2016
@benjick
Copy link
Author

benjick commented Oct 10, 2016

This also happens with const, which aren't hoisted, right?

Thanks for the reply

@not-an-aardvark
Copy link
Member

Yes, it does. I think the consensus on that issue was to still delegate that case to no-use-before-define rather than no-undef.

@vitorbal
Copy link
Member

Looks like there's nothing left to do here, as it seems the questions have been answered. Closing this, but feel free to continue the discussion if needed.

@eslint-deprecated eslint-deprecated bot locked and limited conversation to collaborators Feb 6, 2018
@eslint-deprecated eslint-deprecated bot added the archived due to age This issue has been archived; please open a new issue for any further discussion label Feb 6, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
archived due to age This issue has been archived; please open a new issue for any further discussion question This issue asks a question about ESLint
Projects
None yet
Development

No branches or pull requests

4 participants