Skip to content

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

Closed
@gaearon

Description

@gaearon

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions