Eslint-plugin-sonarjs rule sonar-no-fallthrough crashes in ESLint 9

S128 rule (sonar-no-fallthrough) uses CodePath#currentSegments, which has been removed in ESLint 9:

This results in a crash in any switch-case:

TypeError: Cannot read properties of undefined (reading 'some')
Rule: "sonarjs/sonar-no-fallthrough"
    at SwitchCase:exit (/.../node_modules/eslint-plugin-sonarjs/lib/S128/rule.js:88:69)
2 Likes

Having the same issue, had to disable

'sonarjs/sonar-no-fallthrough': 'off',

Hello @alecmev and @mmospanenko,

thanks for reporting this. I created a ticket to handle this as soon as possible.

Cheers,
Victor

1 Like

this is the same problem with the sonarjs/prefer-enum-initializers rule :wink:

Hello @someoneinthe,

I guess you refer to this post.

I was precisely checking that right now and it’s not exactly the same problem, this rule is completely implemented by us, while sonarjs/prefer-enum-initializers is extending the original implementation of typescript-eslint.

ok, my bad, you’re right.
I was just implementing the v2 of this plugin, and those 2 rules were broken, with the same error.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.