ESLint – “window” is not defined. How to allow global variables in package.json

There is a builtin environment: browser that includes window.

Example .eslintrc.json:

"env": {
    "browser": true,
    "node": true,
    "jasmine": true
  },

More information: https://eslint.org/docs/user-guide/configuring/language-options#specifying-environments

Also see the package.json answer by chevin99 below.

Leave a Comment