Adding custom rules

Hello Team,

I’m using sonarqube 8.9v, I have a requirement to add custom rules for CSS and Javascript.
For javascript I found this issue:How to create custom rules for Javascript - #5 by Quentin wherein it was mentioned to create rules using ESLint and then import these rules using sonar.eslint.reportPaths.

I’m a newbie, Could you please guide me in more detail.

I have installed ESlint in vscode and have .eslintrc.js file generated. Which has the following content:
module.exports = {

‘env’: {

'browser': true,

'es2021': true,

'node': true,

},

‘extends’: [

'plugin:vue/essential',

'google',

],

‘parserOptions’: {

'ecmaVersion': 13,

'sourceType': 'module',

},

‘plugins’: [

'vue',

],

‘rules’: {

},

};

Should I be adding rules under rules section, if yes then what should be my next step? Please advise.

Thanks in advance!!

Hi,

You should probably look for help at ESLint community. You should have independent from Sonar setup for ESLint, then you should execute ESLint with the rules you need (potentially custom) and import report as external in SonarQube.