How to suppress javascript:S3504 in a JavaScript file

I’m using SonarQube Developer EditionVersion 9.6.1 (build 59531) in a Docker container
and am scanning a JavaScript file.
In this file, I have a variable declaration as follows:

var showBrowserButtonNavigationWarning = true;

and it is being used in some functions:

function allowBrowserButtonNavigation(event) {
    showBrowserButtonNavigationWarning = false;
}

function blockBrowserButtonNavigation() {
    showBrowserButtonNavigationWarning = true;
}

SQ reports a violation of rule javascript:S3504
But in this location it should be a var.
I tried to suppress this rule by adding the lines:
@ SuppressWarnings(“javascript:S3504”)
// 3504: Unexpected var, use let or const instead.

and the line:
//noinspection SonarLint/javascript:S3504

but both are not working.
How can I tell SQ to not report this ‘violation’?

Kind regards,

Rob

Hi Rob,

Welcome to the community!

Your version is past EOL. You should upgrade to either the latest version or the current LTS at your earliest convenience. Your upgrade path is:

9.6.1 → 9.9.1 → 10.1 (last step optional)

You may find these resources helpful:

If you have questions about upgrading, feel free to open a new thread for that here.

If your error persists after upgrade, please come back to us.

 
Thx,
Ann

Ann,

Thanks for the info. Will check how we can upgrade SQ in our docker environment.
Do you know if upgrading to 10.1 will fix our issue?

Kind regards,

Rob

Hi Rob,

I don’t know. What I do know is that you’re on an unsupported version.

 
:sweat_smile:
Ann