Please provide
- Operating system: Windows 11 64bits
- SonarLint plugin version: “eslint-plugin-sonarjs”: “^2.0.1”,
- Programming language you’re coding in: Typescript
- Is connected mode used: no
- Connected to SonarCloud or SonarQube (and which version):
- ESlint 9.9.1
And a thorough description of the problem / question:
After upgrading from 1.0.4 to 2.0.1 eslint-plugin-sonarjs gives errors (below the first one). Never had problems with the previous version.
Seems like this rule has not been written for Eslint 9 flat config.
The command is eslint -f codeframe src/**
and in eslint.config.js I load sonarjsPlugin.configs.recommended rules.
Oops! Something went wrong! :(
ESLint: 9.9.1
TypeError: context.getSource is not a function
Occurred while linting D:\Projects\STMexperimental\new\components\ControlsContainer.vue
Rule: "sonarjs/pluginRules-of-hooks"
at onCodePathEnd (D:\Projects\STMexperimental\node_modules\eslint-plugin-react-hooks\cjs\eslint-plugin-react-hooks.development.js:605:61)
at D:\Projects\STMexperimental\node_modules\eslint-plugin-sonarjs\lib\helpers\decorators\merger.js:30:17
at ruleErrorHandler (D:\Projects\STMexperimental\node_modules\eslint\lib\linter\linter.js:1088:48)
at D:\Projects\STMexperimental\node_modules\eslint\lib\linter\safe-emitter.js:45:58
at Array.forEach (<anonymous>)
at Object.emit (D:\Projects\STMexperimental\node_modules\eslint\lib\linter\safe-emitter.js:45:38)
at runRules (D:\Projects\STMexperimental\node_modules\eslint\lib\linter\linter.js:1144:25)
at Linter._verifyWithFlatConfigArrayAndWithoutProcessors (D:\Projects\STMexperimental\node_modules\eslint\lib\linter\linter.js:1914:31)
at Linter._verifyWithFlatConfigArray (D:\Projects\STMexperimental\node_modules\eslint\lib\linter\linter.js:2053:21)
at Linter.verify (D:\Projects\STMexperimental\node_modules\eslint\lib\linter\linter.js:1514:61)
Thanks for looking!