eslint-plugin-sort-class-members icon indicating copy to clipboard operation
eslint-plugin-sort-class-members copied to clipboard

eslint breaks with dynamic keys

Open ndvo opened this issue 4 years ago • 1 comments

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

ndvo avatar Sep 11 '20 22:09 ndvo

Hi, i had similar problem and so i wrote few lines in sort script and made a PR

crysadrak avatar Oct 06 '20 18:10 crysadrak

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.

bryanrsmith avatar Sep 06 '22 15:09 bryanrsmith