source: frontend/node_modules/confusing-browser-globals/README.md

Last change on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 12 days ago

Fix frontend appearance

  • Property mode set to 100644
File size: 1.2 KB
RevLine 
[9af201e]1# confusing-browser-globals
2
3A curated list of browser globals that commonly cause confusion and are not recommended to use without an explicit `window.` qualifier.
4
5## Motivation
6
7Some 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.
8
9For example:
10
11```js
12handleClick() { // missing `event` argument
13 this.setState({
14 text: event.target.value // uses the `event` global: oops!
15 });
16}
17```
18
19This 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.
20
21## Installation
22
23```sh
24npm install --save confusing-browser-globals
25```
26
27## Usage
28
29If 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.
30
31If you maintain your own ESLint configuration, you can do this:
32
33```js
34const restrictedGlobals = require('confusing-browser-globals');
35
36module.exports = {
37 rules: {
38 'no-restricted-globals': ['error'].concat(restrictedGlobals),
39 },
40};
41```
42
43## License
44
45MIT
Note: See TracBrowser for help on using the repository browser.