Tsconfig.json extends package in monorepo cannot find root config by package name

Hi,
In a monorepo that is registered as one project in SonarCloud I have one tsconfig.json that extends another tsconfig in a different package within the monorepo, like this:

{
	"extends": "shared-tsconfigs/js-library.json",
	"include": ["."],
	"exclude": ["dist", "build", "node_modules"]
}

My problem is that SonarCloud does not like this, and gives me the following error:

INFO: TypeScript configuration file /opt/atlassian/pipelines/agent/build/apps/package-name/tsconfig.json
ERROR: Error: File 'shared-tsconfigs/node.json' not found.

So I need to tell SonarCloud that shared-tsconfig is a package at “this” location.

Is that possible? Maybe some other approach is necessary?

Thanks
Carsten

Hi @cahodk,

That’s weird, we use the same TS you are using to build your project. shared-tsconfigs/js-library.json is it relative to .../package-name/tsconfig.json? Or how does the resolution work in your case?

Thanks for the feedback.

We use turborepo, so it is resolved as a package.

I think we need to create tsonfigs specifically for sonar cloud, that uses paths instead of package resolving.

Are npm dependencies available during analysis?

Well, we run it as a bitbucket pipeline, and I have bitbucket-pipelines.yml in the root directory, and it that I have these steps:
So I assume npm i in the root dir would be enough, as that is how I would install node_modules in all workspaces.

steps:
    - step: &build-test-sonarcloud
        name: Build, test and analyze on SonarCloud
        caches:
          - node # See https://confluence.atlassian.com/bitbucket/caching-dependencies-895552876.html
          - sonar
        script:
          - npm i # Build your project and run
          - pipe: sonarsource/sonarcloud-scan:1.4.0

Could you post full logs?
Is your project private?