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

Update: no-shadow-restricted-names lets unassigned vars shadow undefined #11341

Merged
merged 2 commits into from Feb 6, 2019

Commits on Feb 1, 2019

  1. Update: no-shadow-restricted-names lets unassigned vars shadow undefined

    This updates the `no-shadow-restricted-names` to allow a variable to shadow `undefined` if that variable is never assigned a value (i.e. if the variable always actually has a value of `undefined`. The declaration `var undefined;` is occasionally used in pre-ES5 environments where the `undefined` global is mutable, to ensure that the identifier `undefined` can reliably be used even if someone else tampered with the global. In general, a `var undefined;` declaration doesn't really violate the spirit of the rule, because it doesn't change the value of the identifier `undefined`.
    
    The goal of this change is to eliminate a false positive for codebases that support pre-ES5 environments, so that the rule can be added to `eslint:recommended` in the future.
    not-an-aardvark committed Feb 1, 2019
    Copy the full SHA
    f89aca0 View commit details
    Browse the repository at this point in the history
  2. Update lib/rules/no-shadow-restricted-names.js

    Co-Authored-By: not-an-aardvark <teddy.katz@gmail.com>
    platinumazure and not-an-aardvark committed Feb 1, 2019
    Copy the full SHA
    815ed5a View commit details
    Browse the repository at this point in the history