I would like to shorten the object literal in ES6 as follows:
const loc = this.props.local;
The reason is loc.foo();much easier to enter thanthis.props.local.foo();
But now ESLint complains:
Use object destructuring: prefer-destructuring
I read the error description on eslint.org , but I do not understand this. They have an example that is very similar to my code, but it seems like they look normal?
var foo = object.bar;
How to fix an error without forcing it to be ignored in the file .eslintrc?
source
share