How to add our own new rule for Typescript?

Hi,
I am new to SonarQube and currently i am using sonarqube 8.5 community edition. I want to add our own typescript convention rules in sonarqube but I didnt find any proper guideline to follow. Need help, it my urgent task.

Hello @Sang1234

As of today, the recommended way to achieve what you are looking for is to use ESLint to write your own custom rule and import the report thanks to the External Issues feature.

Hope it helps,
Quentin

Hello @Quentin
I am new to this whole thing. Can you tell me how i should go about with this?

Thank you.
Sangay

The first step is to go through ESLint documentation and learn to create custom rules. At first glance, you will have to create a new plugin, then create your own rule. I’m sure you will find plenty of information online.

Then, you have to run this Eslint plugin and make it generate a report, the same way you would do it for Eslint. Finally, you can configure SonarQube to import this report thanks to sonar.eslint.reportPaths property.

If you are new to both SonarQube and Typescript, I expect this task to not be trivial at all. Maybe as an alternative, you can share with us the idea that you have? If the rule makes sense for everyone, maybe we should include it directly in the Typescript analyzer directly?

Thank you @Quentin
I am new to both and it’s just that we want to make our own customize rule. I am looking deeper into Eslint.

Thanks alot.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.