JavaScript Standard Style does not recognize Mocha
I prefer to edit my .eslintrc
and add mocha to env section:
...
"env": {
"commonjs": true,
"node": true,
"mocha": true
},
...
this way my package.json
file is kept clean, also vscode plugin for eslint understands it better
while eslint's comment configuration works great for a single file, I prefer to use standard's package.json
globals
configuration to do this for my projects. E.g.
{
"name": "my-package",
"version": "1.0.0",
"standard": {
"globals": [
"describe",
"context",
"before",
"beforeEach",
"after",
"afterEach",
"it",
"expect"
]
}
}
Actually, you don't need to list every single global variable in your package.json
You can specify environments instead like this:
"standard": {
"env": [ "mocha" ]
}
Source: Official ESLint configuration docs.