The problem
We have the following tsconfig.json for some of our packages
{
"extends": "@tsconfig/ember/tsconfig.json",
"compilerOptions": {
"baseUrl": ".",
"paths": {
"dummy/tests/*": ["tests/*"],
"dummy/*": ["tests/dummy/app/*", "app/*"],
foo": ["addon"],
"foo/*": ["addon/*"],
"foo/test-support": ["addon-test-support"],
"foo/test-support/*": ["addon-test-support/*"],
"*": ["types/*"]
}
},
"include": [
"addon",
"addon-test-support",
"tests",
"types"
]
}
But when sonar scan is running we recieve the following error
27-Feb-2024 09:25:19 INFO: Creating TypeScript program
27-Feb-2024 09:25:19 INFO: TypeScript configuration file /usr/src/packages/foo/tsconfig.json
27-Feb-2024 09:25:19 WARN: Could not find tsconfig.json: /node_modules/@tsconfig/ember/tsconfig.json; falling back to an empty configuration.
27-Feb-2024 09:25:20 WARN: At least one tsconfig.json was not found in the project. Please run 'npm install' for a more complete analysis. Check analysis logs for more details.
27-Feb-2024 09:25:20 INFO: Creating TypeScript program (done) | time=224ms
27-Feb-2024 09:25:20 INFO: Starting analysis with current program
27-Feb-2024 09:25:20 INFO: Analyzed 0 file(s) with current program
Analysis
As far as I understand SonarJS runs in a separate node runtime somewhere in Sonarqube and it only has access to dependencies listed under bundledDependencies, therefore it can’t resolve @tsconfig
package as it’s not listed there.
However this is in contradiction with some tests that are already present like for example tsconfig_found, obviously tests pass because the dep is available in the monorepo when jest tests are running but in actual runtime that is not the case.
Can we add packages the most popular bases GitHub - tsconfig/bases: Hosts TSConfigs to extend in a TypeScript app, tuned to a particular runtime environment to the bundled deps at least? I can create a pull request to add these, these are by far the most popular bases and most widely used.
Or is there some other way to make this available during sonarJS runtime that I am missing?