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

Blacklist event as a global we don't support implicitly #1530

Closed
gaearon opened this issue Feb 11, 2017 · 0 comments
Closed

Blacklist event as a global we don't support implicitly #1530

gaearon opened this issue Feb 11, 2017 · 0 comments
Milestone

Comments

@gaearon
Copy link
Contributor

gaearon commented Feb 11, 2017

Just saw @kittens bump into this in the office the other day:

  handleClick() {
    console.log(event);
  }

Guess what event is. A browser global (thanks IE).

In a tight code it is much less obvious, and easy to miss. This is especially problematic in React apps where event would actually correspond to something completely different than the synthetic event React is sending.

The problem is our ESLint configuration currently doesn't report event as an undefined variable because it's friendly to legacy code that may rely on it. We should figure out how to force it to treat undefined event as an undefined variable, and fail the build like we do for any other undefined variables. People who rely on it can always use window.event to be explicit.

@gaearon gaearon added this to the 0.10.0 milestone Feb 11, 2017
vfil pushed a commit to vfil/create-react-app that referenced this issue Feb 12, 2017
gaearon pushed a commit that referenced this issue Feb 24, 2017
#1532)

* Disallow event global variable with no-restricted-globals rule (#1530)

* changed event global variable usage liniting from warn to error
@lock lock bot locked and limited conversation to collaborators Jan 22, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant