Thanks for browsing my question.
I met some eslint errors after using decorator like this
@decorate({ title: 'head' })
class Test {
@decorate(item => ({ age: item.age }))
method(){
return ;
}
}
export default Test;
.eslintrc config :
{
"parser": "babel-eslint",
"rules": {
"no-unused-vars": 2
}
}
pacakges version
"babel-eslint": "6.0.3",
"eslint": "^2.8.0"
eslint error message
Cannot read property 'type' of undefined
TypeError: Cannot read property 'type' of undefined
at collectUnusedVariables (/Users/Documents/support_decorator/node_modules/eslint/lib/rules/no-unused-vars.js:184:44)
Looks like this line causes problem. And used ES5 common anonymous function, errors still exist.
@decorate(item => ({ age: item.age }))
What should i do? Upgrade eslint and babel-eslint to specific version or just close "no-unused-vars" rule?
This is fixed in eslint v6.0.4, just upgrade.