# eslint-restricted-globals

> A list of confusing globals that should be restricted to be used as globals

Latest version **0.2.0** (published 2018-11-02) · MIT license · 0 weekly downloads

## Install

```sh
npm install eslint-restricted-globals
pnpm add eslint-restricted-globals
yarn add eslint-restricted-globals
bun add eslint-restricted-globals
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.0 |
| Published | 2018-11-02 |
| First published | 2017-05-20 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 3.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 16 |
| Author | Siddharth Doshi |
| Maintainers | gaearon, sidoshi |
| Keywords | eslint, globals |

## Links

- npm: https://www.npmjs.com/package/eslint-restricted-globals
- Repository: https://github.com/doshisid/eslint-restricted-globals
- Homepage: https://github.com/doshisid/eslint-restricted-globals#readme
- Issues: https://github.com/doshisid/eslint-restricted-globals/issues
- npm.io page: https://npm.io/package/eslint-restricted-globals

## Alternatives

- [eslint-plugin-sonarjs](https://npm.io/package/eslint-plugin-sonarjs.md) — 2.9M weekly downloads
- [eslint-config-expo](https://npm.io/package/eslint-config-expo.md) — 1.5M weekly downloads
- [@matter/protocol](https://npm.io/package/@matter/protocol.md) — 63.5K weekly downloads
- [@eventcatalog/linter](https://npm.io/package/@eventcatalog/linter.md) — 24.8K weekly downloads
- [@inrupt/eslint-config-base](https://npm.io/package/@inrupt/eslint-config-base.md) — 4.5K weekly downloads

## Recent versions

- 0.2.0 (latest) — 2018-11-02
- 0.1.1 — 2017-05-20
- 0.1.0 — 2017-05-20

## README

# eslint-restricted-globals [![npm](https://img.shields.io/npm/v/eslint-restricted-globals.svg?style=plastic)](https://www.npmjs.com/package/eslint-restricted-globals) [![npm](https://img.shields.io/npm/l/eslint-restricted-globals.svg?style=plastic)](https://www.npmjs.com/package/eslint-restricted-globals)

> A list of confusing globals that should be restricted to be used as globals

## Install

```
$ npm install --save eslint-restricted-globals
```

Some global variables in browser are likely to be used by people without the intent of using them as globals, such as `status`, `name` etc. 
And because eslint thinks of them as valid global variables, it does not warn in case of bugs.

For eg:
```js
function foo(nama) {
    if (nama) {
        console.log(name)
    }
}
```

Here we try to log variable `nama` if it is truthy, but by mistake we are logging `name` and as `name` is a valid global, no eslint warning is shown.

To avoid this, we blacklist such confusing globals which are exported from this package. It contains the list of variables that we think should not be used without `window.` qualifier. But as this is just a javascript array you can add, remove variables or even make your own list of variables.

## Usage

Add this in your eslint config in rules property:

```js
var restrictedGlobals = require('eslint-restricted-globals')

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


## License

MIT

---
_Source: https://npm.io/package/eslint-restricted-globals · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
