Typescript scanner error while scanning serveral tsconfig.json files)

Hi, as requested in a separate case (Scanner error after migrating azure devops task to v2 - #4 by Colin) I’m splitting two issues that I originally attributed to the new azure devops tasks.

The scanner return several error like this, associated to the same type of files. Please notice this is a typescript/reactjs repository based on lerna (quite large).

13:21:22.862 INFO  TypeScript configuration file /home/vsts/work/1/s/packages/rtl-card-request-state/tsconfig.json
##[error]13:21:22.866 ERROR Error: Option 'watch' can only be specified on command line.
13:21:22.867 ERROR     at createProgramOptions (/home/vsts/work/1/s/.scannerwork/.sonartmp/bridge-bundle/package/lib/jsts/src/program/program.js:96:15)
13:21:22.867 ERROR     at createProgram (/home/vsts/work/1/s/.scannerwork/.sonartmp/bridge-bundle/package/lib/jsts/src/program/program.js:126:28)
13:21:22.867 ERROR     at createAndSaveProgram (/home/vsts/work/1/s/.scannerwork/.sonartmp/bridge-bundle/package/lib/jsts/src/program/program.js:187:21)
13:21:22.867 ERROR     at MessagePort.<anonymous> (/home/vsts/work/1/s/.scannerwork/.sonartmp/bridge-bundle/package/lib/bridge/src/worker.js:101:86)
13:21:22.867 ERROR     at [nodejs.internal.kHybridDispatch] (node:internal/event_target:807:20)
13:21:22.867 ERROR     at exports.emitMessage (node:internal/per_context/messageport:23:28)
13:21:22.867 ERROR Failed to create program: Option 'watch' can only be specified on command line.
13:21:22.866 ERROR Error: Option 'watch' can only be specified on command line.
13:21:22.867 ERROR     at createProgramOptions (/home/vsts/work/1/s/.scannerwork/.sonartmp/bridge-bundle/package/lib/jsts/src/program/program.js:96:15)
13:21:22.867 ERROR     at createProgram (/home/vsts/work/1/s/.scannerwork/.sonartmp/bridge-bundle/package/lib/jsts/src/program/program.js:126:28)
13:21:22.867 ERROR     at createAndSaveProgram (/home/vsts/work/1/s/.scannerwork/.sonartmp/bridge-bundle/package/lib/jsts/src/program/program.js:187:21)
13:21:22.867 ERROR     at MessagePort.<anonymous> (/home/vsts/work/1/s/.scannerwork/.sonartmp/bridge-bundle/package/lib/bridge/src/worker.js:101:86)
13:21:22.867 ERROR     at [nodejs.internal.kHybridDispatch] (node:internal/event_target:807:20)
13:21:22.867 ERROR     at exports.emitMessage (node:internal/per_context/messageport:23:28)
13:21:22.867 ERROR Failed to create program: Option 'watch' can only be specified on command line.
13:21:22.867 INFO  Creating TypeScript program

And here a sample content of one of those tsconfig.json

{
  "compilerOptions": {
    "target": "es6",
    "allowJs": true,
    "skipLibCheck": true,
    "esModuleInterop": true,
    "allowSyntheticDefaultImports": true,
    "strict": true,
    "forceConsistentCasingInFileNames": true,
    "module": "es6",
    "noImplicitAny": false,
    "moduleResolution": "node",
    "resolveJsonModule": true,
    "isolatedModules": false,
    "jsx": "react",
    "declaration": true,
    "declarationMap": true,
    "outDir": "./build", //output directory where will be placed the transpiled JavaScript
    "allowUnusedLabels": false,
    "diagnostics": false,
    "sourceMap": true,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "strictNullChecks": true,
    "traceResolution": false, //report module resolution log messages
    "watch": false
  },
  "include": ["./src"],
  "exclude": ["node_modules", "build", "dist"]
}

Thanks in advance,
Andrea

Hey Andrea!

This message:

Is being emitted by the Typescript compiler.

Do you know where this is coming from / why this is set? Was it autogenerated by something, or fall in there by mistake?

I think if you remove it, the Typescript compiler will stop complaining.

1 Like