I'm using Reflect in my code. Problem is Eslint thinks its an undeclared variable. I'm getting this error:
eslint --config ./.eslintrc.json src
30:25 error 'Reflect' is not defined no-undef
32:9 error 'Reflect' is not defined no-undef
39:21 error 'Reflect' is not defined no-undef
40:5 error 'Reflect' is not defined no-undef
I have my .eslintrc
file set to ECMAScript 2015:
"parserOptions": {
"ecmaVersion": 2015,
"sourceType": "module",
"ecmaFeatures": {
"globalReturn": true
}
}
Not sure why it's applying the no-undef
rule to Reflect. All my code is typically ECMAScript 2015, nothing unusual.
In addition to setting the ecmaVersion
, you need to tell it to include "es6" globals:
{
"env": {
"es6": true
}
}
(You'll probably want others in there too, such as browser
.)
More in Specifying Environments in the docs.