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

前端 未结 6 509
天命终不由人
天命终不由人 2020-12-02 07:45

I am assigning a property to the global window object, but when I run eslint, I get this:

\"window\" is not defined

I see t

6条回答
  •  时光取名叫无心
    2020-12-02 08:27

    There is a builtin environment: browser that includes window.

    Example .eslintrc.json:

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

    More information: http://eslint.org/docs/user-guide/configuring.html#specifying-environments

    Also see the package.json answer by chevin99 below.

提交回复
热议问题