eslint-plugin-sonarjs icon indicating copy to clipboard operation
eslint-plugin-sonarjs copied to clipboard

Turn off a rule from SonarJS

Open ws7one opened this issue 2 years ago • 4 comments

I want to know how to turn off a certain rule in Sonar.

So there are more than a few rules I want disabled in my source code. I have sonarqube integration done. I have sonarlint installed in my vscode. I have this plugin installed so eslint can tell me when I break a rule. But there are some rules which i do not want to be warned about

Can someone help me as to how to do this?

eslint-plugin-sonarjs version: 0.12.0 eslint version: 8.10.0 Node.js version: 16.13.2

Rule key: javascript:S1301 (I think this is the Id)

ws7one avatar Mar 05 '22 11:03 ws7one

Why do you want to disable the rule? Could you provide a code example when this rule is not working for you?

Do you want to disable rule in SonarLint (do you use connected mode)? or in Sonar as well?

vilchik-elena avatar Jun 24 '22 08:06 vilchik-elena

In my project, I run into a lot of cases where we have JSX where we are forced to use cascaded ternary operators. Of course, those are getting flagged with warnings and in those cases, I would like to disable that rule only for that block of lines. The particular rule at hand is typescript:S3358.

jlczuk avatar May 31 '23 17:05 jlczuk

Wondering myself too if it's possible to use SonarJS ESLint to disable SonarCloud/SonarQube rules that are also reported via SonarLint... But I do understand if that is more of a question for SonarCloud/SonarQube & SonarLint.

jerone avatar Jun 01 '23 14:06 jerone

You can try to overrides the rules you want to turn off like this overrides: [ { files: ['*.test.{ts,tsx}', '*.js'], rules: { 'sonarjs/no-duplicate-string': 'off', }, }, ],

mripqi avatar Sep 08 '23 10:09 mripqi

This issue has been migrated to Jira. ESLINTJS-21

Wohops avatar Apr 29 '24 08:04 Wohops