No undef check error in eslint

With multi-dimensional model as the core, let the factory digital transformation and upgrading “within reach”>>>

Error report when checking with eslint after writing code

error  'window' is not defined        no-undef

This is configured in eslint to check whether global variables are available. For specific use and description, please refer to

But I still have to use the window object in my code. What should I do

You can add a global configuration in eslint to mark which global objects can be used

  "document": true,
  "localStorage": true,
  "window": true

Update it. In addition, you can configure it according to this document -environments

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

Similar Posts: