Tsconfig.json lib option "es2023" not supported by sonar-scanner

Hi,

we’re using sonar-scanner to scan Typescript Node.js projects with a tsconfig.json that extends @tsconfig/node-lts/tsconfig.json for Node 18 .

Current version 18.12.5 of @tsconfig/node-lts/tsconfig.json specify :

// This file was autogenerated by a script
// Equivalent to a config of: node18
{
  "$schema": "https://json.schemastore.org/tsconfig",
  "display": "Node LTS",
  "_version": "18.1.0",
  "compilerOptions": {
    "lib": ["es2023"],
    "module": "node16",
    "target": "es2022",
    "strict": true,
    "esModuleInterop": true,
    "skipLibCheck": true,
    "forceConsistentCasingInFileNames": true,
    "moduleResolution": "node16"
  }
}

It seems that sonar-scanner doesn’t support lib: [“es2023”] . It report the following error :

INFO: Sensor TypeScript analysis [javascript]
INFO: Found 1 tsconfig.json file(s): [/tmp/xxx/tsconfig.json]
INFO: Creating TypeScript program
INFO: TypeScript configuration file /tmp/xxxx/tsconfig.json
INFO: 67 source files to be analyzed
ERROR: Error: Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'es2019', 'es2020', 'es2021', 'es2022', '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', 'es2019.intl', 'es2020.bigint', 'es2020.date', 'es2020.promise', 'es2020.sharedmemory', 'es2020.string', 'es2020.symbol.wellknown', 'es2020.intl', 'es2020.number', 'es2021.promise', 'es2021.string', 'es2021.weakref', 'es2021.intl', 'es2022.array', 'es2022.error', 'es2022.intl', 'es2022.object', 'es2022.sharedmemory', 'es2022.string', 'esnext.array', 'esnext.symbol', 'esnext.asynciterable', 'esnext.intl', 'esnext.bigint', 'esnext.string', 'esnext.promise', 'esnext.weakref'.  /tmp/xxxx/node_modules/@tsconfig/node-lts/tsconfig.json:220
ERROR:     at createProgramOptions (/tmp/xxxx/.scannerwork/.sonartmp/eslint-bridge-bundle/package/lib/services/program/program.js:106:15)
ERROR:     at createProgram (/tmp/xxxx/.scannerwork/.sonartmp/eslint-bridge-bundle/package/lib/services/program/program.js:132:28)
ERROR:     at default_1 (/tmp/xxxx/.scannerwork/.sonartmp/eslint-bridge-bundle/package/lib/routing/on-create-program.js:10:57)
ERROR:     at Layer.handle [as handle_request] (/tmp/xxxx/.scannerwork/.sonartmp/eslint-bridge-bundle/package/node_modules/express/lib/router/layer.js:95:5)
ERROR:     at next (/tmp/xxxx/.scannerwork/.sonartmp/eslint-bridge-bundle/package/node_modules/express/lib/router/route.js:144:13)
ERROR:     at Route.dispatch (/tmp/xxxx/.scannerwork/.sonartmp/eslint-bridge-bundle/package/node_modules/express/lib/router/route.js:114:3)
ERROR:     at Layer.handle [as handle_request] (/tmp/xxxx/.scannerwork/.sonartmp/eslint-bridge-bundle/package/node_modules/express/lib/router/layer.js:95:5)
ERROR:     at /tmp/xxxx/.scannerwork/.sonartmp/eslint-bridge-bundle/package/node_modules/express/lib/router/index.js:284:15
ERROR:     at Function.process_params (/tmp/xxxx/.scannerwork/.sonartmp/eslint-bridge-bundle/package/node_modules/express/lib/router/index.js:346:12)
ERROR:     at next (/tmp/xxxx/.scannerwork/.sonartmp/eslint-bridge-bundle/package/node_modules/express/lib/router/index.js:280:10)
ERROR: Failed to create program: Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'es2019', 'es2020', 'es2021', 'es2022', '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', 'es2019.intl', 'es2020.bigint', 'es2020.date', 'es2020.promise', 'es2020.sharedmemory', 'es2020.string', 'es2020.symbol.wellknown', 'es2020.intl', 'es2020.number', 'es2021.promise', 'es2021.string', 'es2021.weakref', 'es2021.intl', 'es2022.array', 'es2022.error', 'es2022.intl', 'es2022.object', 'es2022.sharedmemory', 'es2022.string', 'esnext.array', 'esnext.symbol', 'esnext.asynciterable', 'esnext.intl', 'esnext.bigint', 'esnext.string', 'esnext.promise', 'esnext.weakref'.  /tmp/xxxx/node_modules/@tsconfig/node-lts/tsconfig.json:220
INFO: Creating TypeScript program (done) | time=34ms
INFO: Skipped 67 file(s) because they were not part of any tsconfig.json (enable debug logs to see the full list)
INFO: 67/67 source files have been analyzed

May be the underlying eslint is missing an upgrade.

Regards

Hey there.

Which version of SonarQube are you using?

Sonarqube Server 9.9.4.87374
SonarScanner 5.0.1.3006

Thanks. You’ll need to upgrade to the latest version of SonarQube (v10.4) to analyze the latest versions of Typescript.