Skip to content
This repository has been archived by the owner on Mar 25, 2021. It is now read-only.

Warn about usage of dangerous "name" (and potentially others) globals #4149

Closed
mboughaba opened this issue Sep 3, 2018 · 2 comments
Closed

Comments

@mboughaba
Copy link

Rule Suggestion

Is your rule for a general problem or is it specific to your development style?

Consider the code

  public echo(name: string): void {
    return name;
  }
  // We won't define name (by mistake)
  // echo is still called with `window.name`
  // In perhaps more than 90% of the cases this is wrong
  this.echo(name);

Notice that name argument is not defined. Typescript will use the global defined in lib.dom. This is detailed in microsoft/TypeScript#18433.

What does your suggested rule do?
Warns users about potentially dangerous access to a dom global or undefined variable name.

List several examples where your rule could be used

Additional context

@johnwiseheart
Copy link
Contributor

Is this a dupe of #922?

@mboughaba
Copy link
Author

Most likely it is. #922 is more generic than this one I would say. Closing this a dupe.

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

2 participants