eslint-plugin-sort-class-members
eslint-plugin-sort-class-members copied to clipboard
eslint breaks with dynamic keys
With ESLint: 7.8.1 and eslint-plugin-sort-class-members": 1.8.0, I'm getting a TypeError when my class has a dynamic key.
If I add dynamic keys to a Typescript class and run eslint on the file, eslink breaks with a TypeError: Cannot read property 'name' of undefined
Here is the line to add to a class to get the error:
[k: string]: any;
Error occurs at:
node_modules/eslint-plugin-sort-class-members/dist/rules/sort-class-members.js:258:21
Hi, i had similar problem and so i wrote few lines in sort script and made a PR
Well it took 2 years for some reason, but this is fixed in 1.15.2 :-)
I've fixed the crash by filtering out the declaration before matching; you can't current match it with a rule.