Big update!Introducing GitHub Bot Commands. Learn more
Socket
Log inBook a demo

confusing-browser-globals

Package Overview
Dependencies
0
Maintainers
5
Versions
45
Issues
File Explorer

Advanced tools

confusing-browser-globals

A list of browser globals that are often used by mistake instead of local variables

    1.0.11latest

Version published
Maintainers
5
Weekly downloads
8,600,747
decreased by-13.12%

Weekly downloads

Readme

Source

confusing-browser-globals

A curated list of browser globals that commonly cause confusion and are not recommended to use without an explicit window. qualifier.

Motivation

Some global variables in browser are likely to be used by people without the intent of using them as globals, such as status, name, event, etc.

For example:

handleClick() { // missing `event` argument this.setState({ text: event.target.value // uses the `event` global: oops! }); }

This package exports a list of globals that are often used by mistake. You can feed this list to a static analysis tool like ESLint to prevent their usage without an explicit window. qualifier.

Installation

npm install --save confusing-browser-globals

Usage

If you use Create React App, you don't need to configure anything, as this rule is already included in the default eslint-config-react-app preset.

If you maintain your own ESLint configuration, you can do this:

const restrictedGlobals = require('confusing-browser-globals'); module.exports = { rules: { 'no-restricted-globals': ['error'].concat(restrictedGlobals), }, };

License

MIT

Keywords

FAQs

What is confusing-browser-globals?

A list of browser globals that are often used by mistake instead of local variables

Is confusing-browser-globals popular?

The npm package confusing-browser-globals receives a total of 6,920,010 weekly downloads. As such, confusing-browser-globals popularity was classified as popular.

Is confusing-browser-globals well maintained?

We found that confusing-browser-globals demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago.It has 5 open source maintainers collaborating on the project.

Last updated on 14 Dec 2021

Did you know?

Socket installs a Github app to automatically flag issues on every pull request and report the health of your dependencies. Find out what is inside your node modules and prevent malicious activity before you update the dependencies.

Install Socket
Socket

Product

Subscribe to our newsletter

Get open source security insights delivered straight into your inbox. Be the first to learn about new features and product updates.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc