SonarJS - TypeScript 5 moduleResolution:bundler support

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
    9.9 LTS Enterprise Edition
  • what are you trying to achieve
    Run Sonar with TypeScript 5 App
  • what have you tried so far to achieve this
    I am running my application with the new moduleResolution setting: bundler then I get the following error:
Error: Argument for '--moduleResolution' option must be: 'node', 'classic', 'node16', 'nodenext'.
    at createProgramOptions (/home/jenkins/agent/workspace/branchName/build/sonar/.sonartmp/eslint-bridge-bundle/package/lib/services/program/program.js:106:15)
    at createProgram (/home/jenkins/agent/workspace/branchName/build/sonar/.sonartmp/eslint-bridge-bundle/package/lib/services/program/program.js:132:28)
    at default_1 (/home/jenkins/agent/workspace/branchName/build/sonar/.sonartmp/eslint-bridge-bundle/package/lib/routing/on-create-program.js:10:57)
    at Layer.handle [as handle_request] (/home/jenkins/agent/workspace/branchName/build/sonar/.sonartmp/eslint-bridge-bundle/package/node_modules/express/lib/router/layer.js:95:5)
    at next (/home/jenkins/agent/workspace/branchName/build/sonar/.sonartmp/eslint-bridge-bundle/package/node_modules/express/lib/router/route.js:144:13)
    at Route.dispatch (/home/jenkins/agent/workspace/branchName/build/sonar/.sonartmp/eslint-bridge-bundle/package/node_modules/express/lib/router/route.js:114:3)
    at Layer.handle [as handle_request] (/home/jenkins/agent/workspace/branchName/build/sonar/.sonartmp/eslint-bridge-bundle/package/node_modules/express/lib/router/layer.js:95:5)
    at /home/jenkins/agent/workspace/branchName/build/sonar/.sonartmp/eslint-bridge-bundle/package/node_modules/express/lib/router/index.js:284:15
    at Function.process_params (/home/jenkins/agent/workspace/branchName/build/sonar/.sonartmp/eslint-bridge-bundle/package/node_modules/express/lib/router/index.js:346:12)
    at next (/home/jenkins/agent/workspace/branchName/build/sonar/.sonartmp/eslint-bridge-bundle/package/node_modules/express/lib/router/index.js:280:10)

> Task :sonar
Failed to create program: Argument for '--moduleResolution' option must be: 'node', 'classic', 'node16', 'nodenext'.

Reverting the moduleResolution to “node” would make Sonar works as intended.
I have seen some commits to make SonarJS to work with TypeScript 5 but I cant tell if this particular config is supported or not. Hence this post was written to bring your attention on this particular setup that could cause issue

Thanks!

Do not share screenshots of logs – share the text itself (bonus points for being well-formatted)!

Hey there.

Support for TypeScript 5 will be supported with SonarQube v10.1, which will support new compiler settings such as this one.

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