Sonar scanner with SonarJS fails to parse typescript

610 views Asked by At

I am using SonarQube Scanner 3.3.0.1492, with the SonarJS 5.2.1.7778 (javascript) plugin. I did a yarn install to install typescript v3.5.3. When I run the sonar scanner, I receive a couple of different parse errors for things that normally parse properly during our builds. Here are a couple of examples

 const genericGatewayRequest = <T extends {} | void>(request: AxiosRequestConfig): AxiosPromise<T> => {
                                          ^
 const mockedAxios = Axios as jest.Mocked<typeof Axios>;
                           ^
 declare module 'react-number-format' {
    export interface NumberFormatProps extends Partial<FormOutlinedTextFieldProps> {
    ^

Most of these appear to be newer features of typescript. So I'm wondering which part of my setup is out of date? I don't understand how sonar-scanner gets its configuration for typescript.

For extra context here is my sonar-project.properties

sonar.exclusions=node_modules/**
sonar.projectKey=membexxxxxxxxxx
sonar.sources=. 
sonar.host.url=https://stl-wxxxxxxx

And here is my tsconfig.json

  "compilerOptions": {
    "target": "es5",
    "lib": [
      "dom",
      "dom.iterable",
      "esnext"
    ],
    "allowJs": true,
    "baseUrl": "src",
    "paths": {
      "@test-utils": [
        "../test/utils"
      ]
    },
    "skipLibCheck": true,
    "esModuleInterop": true,
    "allowSyntheticDefaultImports": true,
    "strict": true,
    "forceConsistentCasingInFileNames": true,
    "module": "esnext",
    "moduleResolution": "node",
    "resolveJsonModule": true,
    "isolatedModules": true,
    "noEmit": true,
    "jsx": "react",
    "sourceMap": true
  },
  "include": [
    "./src/**/*"
  ]
}
0

There are 0 answers