Crashes when having multiple dynamic keys
shirotech opened this issue · 8 comments
e.g.
const {[foo]: bar, [one]: two} = props;The expected behaviour is to ignore these, the parser fails when we use dynamic keys.
@shirotech Thanks for reporting this!
Do you know which parser you have configured?
Gotcha. I only have test coverage for the default ESLint parser (Espree). When I have time I'll try to add coverage for babel-eslint, and hopefully get this plugin working on both.
Awesome stuff, thanks for looking into this.
@shirotech Which version of babel-eslint are you using? I tried with the most recent version, and wasn't able to reproduce.
@mthadley
Hi. I have the same kind of error, when i use computed properties:
const {
[global.MODULE_1]: module1,
[global.MODULE_2]: module2,
} = modules;Error:
TypeError: Cannot read property 'name' of undefined
Occurred while linting .../TaskUpdate/components/TaskDetails/index.js:45
at getNodeName (.../node_modules/eslint-plugin-sort-destructure-keys/lib/rules/sort-destructure-keys.js:21:28)
at .../node_modules/eslint-plugin-sort-destructure-keys/lib/rules/sort-destructure-keys.js:106:36
at ObjectPattern (.../node_modules/eslint-plugin-sort-destructure-keys/lib/rules/sort-destructure-keys.js:187:27)
but it works if i use template strings
const {
[`${global.MODULE_1}`]: module1,
[`${global.MODULE_2}`]: module2,
} = modules;parser: babel-eslint: 10.0.3
eslint: 6.8.0
@ilich-x @shirotech Released a fix for this in eslint-plugin-sort-destructure-keys@1.3.4. Do you still see the error?