Skip to content
This repository was archived by the owner on Jan 19, 2019. It is now read-only.

False positive for no-restricted-globals rule #350

Closed
OliverJAsh opened this issue Aug 14, 2017 · 3 comments
Closed

False positive for no-restricted-globals rule #350

OliverJAsh opened this issue Aug 14, 2017 · 3 comments
Labels

Comments

@OliverJAsh
Copy link

OliverJAsh commented Aug 14, 2017

What version of TypeScript are you using?
2.4.1

What version of typescript-eslint-parser are you using?
4.0.0

What code were you trying to parse?

type foo = {
  location: any;
};

and in my ESLint config:

{
  rules: {
    'no-restricted-globals': [2, 'location'],
  },
}

What did you expect to happen?
No error

What happened?
Unexpected error [eslint] Unexpected use of 'location'. (no-restricted-globals).


My understanding of this ESLint rule is it should only complain if the global identifier is used as an expression. http://eslint.org/docs/rules/no-restricted-globals

@JamesHenry JamesHenry added bug and removed triage labels Dec 11, 2017
@JamesHenry
Copy link
Member

This must be down to the way we currently process type aliases as if they were special vars (in order to get semi rule to, for example). We should definitely fix this.

@JamesHenry
Copy link
Member

Closing in favour of a single issue here: #414

@j-f1
Copy link
Contributor

j-f1 commented Dec 15, 2017

This would probably be fixed with a custom scope class — no-restricted-globals uses the scope to find variables to report.

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

No branches or pull requests

4 participants