How to effectively work with Typescript monorepos?

We have a monorepo Typescript project with multiple projects in it and we’re trying to set up SonarCloud. There are some things we haven’t found the answer for and we’d appreciate some help with them:

  • Can we create a Quality Profile in a file as part of our project (instead of using the web application)?
  • How to integrate SonarCloud with the SonarLint plugin? We’ve installed it in VisualStudio code but we’re not sure how they work together.
  • How to differentiate between source files and unit tests (*.spec.js)? We have *.spec.js and *.spec.ts files for each module as unit tests. How can we apply different rulesets to them (source vs unit test)?
  • Can we have a Quality Profile for each project in our monorepo?
  • Can we have a Quality Profile based on the type of code (source or test)?
  • Can issues be assigned to the person that opens the PR?

Hi Adam,

Welcome to the community!

  • Can we create a Quality Profile in a file as part of our project (instead of using the web application)?

Nope. UI only.

  • How to integrate SonarCloud with the SonarLint plugin? We’ve installed it in VisualStudio code but we’re not sure how they work together.

Check this out: Connected Mode · SonarSource/sonarlint-visualstudio Wiki · GitHub

  • How to differentiate between source files and unit tests (*.spec.js)? We have *.spec.js and *.spec.ts files for each module as unit tests. How can we apply different rulesets to them (source vs unit test)?

You can set analysis scope parameters. Have a look here: How do SonarCloud properties work in relation to each other?

  • Can we have a Quality Profile for each project in our monorepo?

Projects in monorepos are still separate SonarCloud projects so, yes: https://sonarcloud.io/documentation/standards/managing-quality-profiles/

  • Can we have a Quality Profile based on the type of code (source or test)?

No. I don’t think that is possible, but the scoping (above) may help.

  • Can issues be assigned to the person that opens the PR?

Issues are assigned to the last person to touch the issue line, since that might not be the person who opened the PR, I guess the answer is no, not always: https://sonarcloud.io/documentation/digging-deeper/issues/#automatic-issue-assignment

1 Like

Thanks, this is exactly what I’ve been looking for!

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