`eslint-plugin-sonarjs` performance issues on large codebase

Hi

First, apologies if this isn’t the correct place to start a thread like this, but none of the other categories seemed to match either (and this gets the most traffic it seems).

I’m currently in the process of migrating our rather large (~1600 files, 285k LOC according to tokei) codebase to ESLint v9. We’re currently running v7 which includes an older version of eslint-plugin-sonarjs.

We’ve been using both the library and the plugin without issue, performance hasn’t been great but it’s been manageable - especially with caching.

However, as I’ve gone through the process of updating the libraries and plugins to their latest versions, I’ve seen a noticeable drop in performance and, from what I can tell, most of it stems from eslint-plugin-sonarjs.

Without including the plugin in the config, I can run a cold-start (no cache) eslint src on our codebase in about 25s - with the main cause of slowness (according to TIMING=1) being prettier/prettier - which is fine for us.

However, adding sonarJSPlugin.configs.recommended to our config bumps the linting time up to nearly 100s. This is basically a 4x increase from adding the plugin alone. At this point, it’s worth noting that this is already with the sonarjs/no-commented-code rule disabled as I’ve found that to be extremely slow (to the point where ESLint looked like it was never going to complete!).

I’m not sure how much support the plugin is getting at this point, but it would be really cool to have a config that is a subset of the rules that don’t have massive performance penalties. I’ve found at least two are just wrappers on top of TS which feels like wasted work.

If anyone has a similar experience or was around this, it would be great to hear about this. I don’t really want to have to remove the plugin completely, but if the performance penalty keeps going up we might have to!

Cheers

Hello @scallaway,

thanks for the feedback. Can you please share the whole output of the ESLint rule performance (using TIMING=1). We are already aware of no-commented-code, and you did the correct quick win disabling it. We are not aware of the other rules being huge offenders in terms of performance, so I would like to see that list if possible.

I understand you are using the latest eslint-plugin-sonarjs version, is that right?

Cheers,
Victor