Standard: Webstorm doesn't respect 'globals' in package.json

Created on 7 Jul 2016  路  3Comments  路  Source: standard/standard

If you mentioned some variables in package.json like

{
  "standard": {
    "globals": [ "myVar1", "myVar2" ]
  }
}

Webstorm will still consider their usage as error. Test of file from the command line will find no errors (as it should be), so it's some lack of configuration. Unfortunately I don't know what should be configured.

Did any one solved this problem?

question

Most helpful comment

Ya, but not in case when you have "hundreds of files" :(

All 3 comments

Temporary solution is to add names of global variables you would like to use both to package.json and in Webstorm options Languages & Frameworks > JavaScript > Code Quality Tools > ESLint > Extra eslint options: line --global myVar1,myVar2

But it's a crutch and normal solution still wanted

This is because WebStorm doesn't really support Standard聽natively -- it just supports ESLint. ESLint does not look for options in package.json using the "standard" property.

I suggest that you use /* global myVar */ comments at the top of each file, as that's better documentation anyway and ESLint will pick those up.

You can also vote for native standard support in WebStorm via an issue that another user already opened: https://youtrack.jetbrains.com/oauth?state=%2Fissue%2FWEB-17331

Ya, but not in case when you have "hundreds of files" :(

Was this page helpful?
0 / 5 - 0 ratings