what1s1ove
(Vladyslav Zubko)
October 30, 2025, 1:33pm
1
I need some help. How does the NOSONAR comment work in .js / .ts files?
I have a piece of code where I don’t want to disable the entire rule in the ESLint config. I found some information about NOSONAR, but it’s unclear how exactly the comment should be written to make it ignore this specific usage.
/eleventy.config.js
81:10 error Make sure disabling auto-escaping feature is safe here sonarjs/disabled-auto-escaping
This is also strange, because when I enable the no-sonar-comments rule, it starts complaining about this very comment.
Maybe there’s already a topic about this somewhere, but I couldn’t find it.
Sorry in advance if I missed it, I’m new here
Colin
(Colin)
October 31, 2025, 8:49am
2
Hey there.
NOSONAR must go on the exact line an issue is raised. It looks like you’re putting it on the line above!
That said, since you’re using the ESLint plugin, you may need to use // eslint-disable-line instead (I haven’t tested this)
what1s1ove
(Vladyslav Zubko)
November 1, 2025, 12:22pm
3
Hey Colin! Something like this?
Unfortunately, I’m still getting the error…
In general, I can disable rules using eslint-disable, but I found it interesting to try using NOSONAR instead.
Also, if rules can’t be disabled with NOSONAR comments, then I’m curious – why does this no-sonar-comments rule even exist in the ESLint plugin?
https://www.npmjs.com/package/eslint-plugin-sonarjs?activeTab=readme#:~:text=%E2%9C%85-,no%2Dsonar%2Dcomments,-Track%20uses%20of
Colin
(Colin)
November 3, 2025, 3:51pm
4
It should be at the end of the line.
let md = markdownIt({ //NOSONAR
html:true
})
what1s1ove
(Vladyslav Zubko)
November 3, 2025, 5:01pm
5
Unfortunately, it still doesn’t work
Hello @what1s1ove ,
// NOSONAR comments are only silencing issues in Sonarqube. They are not applicable in Eslint context.
The rule about no-sonar-comments is to be used if an admin would like to forbid the usage of such comments in their codebase.
In Eslint context, we recommend using the eslint directives.
Cheers!
what1s1ove
(Vladyslav Zubko)
November 4, 2025, 3:26pm
8
Hey Victor! Got it! Thank you for the answer!
1 Like
system
(system)
Closed
November 14, 2025, 10:48am
10
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.