A list of confusing globals that should be restricted to be used as globals
Last updated 2 years ago by sidoshi .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install eslint-restricted-globals 
SYNC missed versions from official npm registry.

eslint-restricted-globals npm npm

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


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

function foo(nama) {
    if (nama) {

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.


Add this in your eslint config in rules property:

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

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



Current Tags

  • 0.2.0                                ...           latest (2 years ago)

3 Versions

  • 0.2.0                                ...           2 years ago
  • 0.1.1                                ...           4 years ago
  • 0.1.0                                ...           4 years ago
Maintainers (2)
Today 772
This Week 772
This Month 26,322
Last Day 170
Last Week 6,343
Last Month 22,501
Dependencies (0)
Dev Dependencies (1)
Dependents (153)

Copyright 2014 - 2017 © |