bryanrsmith / eslint-plugin-sort-class-members

An ESLint rule for enforcing consistent ES6 class member order
119 stars 21 forks source link

eslint breaks with dynamic keys #58

Closed ndvo closed 2 years ago

ndvo commented 4 years ago

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: `

` Error occurs at:

node_modules/eslint-plugin-sort-class-members/dist/rules/sort-class-members.js:258:21

crysadrak commented 4 years ago

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

bryanrsmith commented 2 years ago

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.