Bug: eslint-plugin-sonarjs's rules-of-hooks is minamed at runtime

If your question is about SonarLint in the IntelliJ Platform, VS Code, Visual Studio, or Eclipse, please post it in that sub-category.

Otherwise, please provide:

  • Operating system: N/A
  • IDE name and flavor/env: N/A

And a thorough description of the problem / question:

The rule sonarjs/rules-of-hooks actually appears as sonarjs/pluginRules-of-hooks when used.


This isn’t specific to VSCode, "sonarjs/sonar-jsx-no-leaked-render": "off" correctly disables this rule.

Hi @Avasam,

I cannot reproduce that. Is it possible that is due to some caching done in the IDE? We changed that rule name in 2.0.3

>npx eslint -c eslint.config.cjs file.js
Loaded 328 rules

C:\www\projects\SonarJS\its\eslint8-plugin-sonarjs\file.js
  65:5   error  React Hook "useEffect" is called conditionally. React Hooks must be called in the exact same order in every component render  sonarjs/rules-of-hooks
1 Like

I can confirm this is already fixed in 2.0.3. I just had to make sure to update to it.

For the record, here’s how it showed in the CLI in 2.0.2 (just to prove it wasn’t an editor caching issue, but as I said, already fixed anyway, thanks)

32:18 error React Hook “useState” is called in function “getName” that is neither a React function component nor a custom React Hook function. React component names must start with an uppercase letter. React Hook names must start with the word “use” sonarjs/pluginRules-of-hooks

1 Like

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