Sonar Scanner doesn't respect override values via tsconfig extends

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension): 8.9.8
  • how is SonarQube deployed: zip, Docker, Helm: Docker
  • what are you trying to achieve: Successful scan of a dedicated tsconfig file for Sonar Scanner
  • what have you tried so far to achieve this: See below

Hi there,

I’m currently running into an issue where Sonar Scanner doesn’t seem to evaluate overrides. Our service contains a base tsconfig.json file that has "target": "es2021". This doesn’t seem to be a respected value via Sonar Scanner 4:

ERROR: Argument for '--target' option must be: 'es3', 'es5', 'es6', 'es2015', 'es2016', 'es2017', 'es2018', 'es2019', 'es2020', 'esnext'.Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'es2019', 'es2020', 'esnext', 'dom', 'dom.iterable', 'webworker', 'webworker.importscripts', 'webworker.iterable', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.asyncgenerator', 'es2018.asynciterable', 'es2018.intl', 'es2018.promise', 'es2018.regexp', 'es2019.array', 'es2019.object', 'es2019.string', 'es2019.symbol', 'es2020.bigint', 'es2020.promise', 'es2020.sharedmemory', 'es2020.string', 'es2020.symbol.wellknown', 'es2020.intl', 'esnext.array', 'esnext.symbol', 'esnext.asynciterable', 'esnext.intl', 'esnext.bigint', 'esnext.string', 'esnext.promise', 'esnext.weakref'.

I also saw that because of this error, it ends up impacting the main projects view downstream in that it shows that the main branch analysis is empty:

Steps I’ve taken

So I ended up porting over to a tsconfig.sonar.json file that extends our base but that didn’t seem to work when I set the target to a valid choice, in this case esnext

    "extends": "./tsconfig.json",
    "compilerOptions": {
        "target": "esnext",
        "lib": [

Although I’ve confirmed that the extends works at a tsc level, it seems to choke at the Sonar Scanner level when I set sonar.typescript.tsconfigPath=tsconfig.sonar.json and continues to think that target is es2021 (which is inherited from the base tsconfig.json file.

Please advise as the only workaround I’ve found is to copy-paste the entire tsconfig.json file and just replace target.



Your version is past EOL. You should upgrade to either the latest version or the current LTS at your earliest convenience. Your upgrade path is:

8.9.8 → 9.9 → 10.0 (last step optional)

You may find these resources helpful:

If you have questions about upgrading, feel free to open a new thread for that here.

If your error persists after upgrade, please come back to us!

Hey Colin –

OK - Thank you much. We have plans to upgrade to 9.9 soon— and to be clear, this issue will be fixed once we’ve upgraded?

Also - I’m still curious as to why the override doesn’t work when I use extends? That seems like a separate issue. Seems that at the Sonar Scanner level, the extends option doesn’t seem to be supported.

The sonar-scanner does very little except wrap the binaries coming from the SonarQube server that orchestrates the scan.

Whether your exact issue will be fixed, I’m not sure. And, we’ll be happy to troubleshoot it if you can reproduce it on a supported version.