However, ESLint will still complain that we are violating the no-undef rule. This is because when we invoke the mocha command, it will inject the describe and it functions as global variables. However, ESLint doesn't know this is happening and warns us against using variables that are not defined inside the module.
We can instruct ESLint to ignore these undefined globals by specifying an environment. An environment defines global variables that are predefined. Update our overrides array entry to the following:
{
"files": ["*.test.js"],
"env": {
"mocha": true
},
"rules": {
"func-names": "off",
"prefer-arrow-callback": "off"
}
}
Now, ESLint should not complain anymore!