Sha256: 0de66d69b891ade52e0f50a0fd397ae388035dbca3f4450aeacc23adbbce5c6f

Contents?: true

Size: 1.15 KB

Versions: 41

Compression:

Stored size: 1.15 KB

Contents

# 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:

```js
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

```sh
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:

```js
const restrictedGlobals = require('confusing-browser-globals');

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

## License

MIT

Version data entries

41 entries across 41 versions & 2 rubygems

Version Path
immosquare-cleaner-0.1.51 node_modules/confusing-browser-globals/README.md
immosquare-cleaner-0.1.50 node_modules/confusing-browser-globals/README.md
immosquare-cleaner-0.1.49 node_modules/confusing-browser-globals/README.md
immosquare-cleaner-0.1.48 node_modules/confusing-browser-globals/README.md
immosquare-cleaner-0.1.47 node_modules/confusing-browser-globals/README.md
immosquare-cleaner-0.1.46 node_modules/confusing-browser-globals/README.md
immosquare-cleaner-0.1.45 node_modules/confusing-browser-globals/README.md
immosquare-cleaner-0.1.44 node_modules/confusing-browser-globals/README.md
immosquare-cleaner-0.1.43 node_modules/confusing-browser-globals/README.md
immosquare-cleaner-0.1.42 node_modules/confusing-browser-globals/README.md
immosquare-cleaner-0.1.41 node_modules/confusing-browser-globals/README.md
immosquare-cleaner-0.1.40 node_modules/confusing-browser-globals/README.md
immosquare-cleaner-0.1.39 node_modules/confusing-browser-globals/README.md
immosquare-cleaner-0.1.38 node_modules/confusing-browser-globals/README.md
immosquare-cleaner-0.1.32 node_modules/confusing-browser-globals/README.md
immosquare-cleaner-0.1.31 node_modules/confusing-browser-globals/README.md
immosquare-cleaner-0.1.30 node_modules/confusing-browser-globals/README.md
immosquare-cleaner-0.1.29 node_modules/confusing-browser-globals/README.md
immosquare-cleaner-0.1.28 node_modules/confusing-browser-globals/README.md
immosquare-cleaner-0.1.27 node_modules/confusing-browser-globals/README.md