Sonarlint VSCode extension not working with Typescript

Hi everyone,

I installed the Sonarlint extension for VSCode to enable live code review as I write my code. Unfortunately, after installation it does not report any issue at all. The log indicates that sonar performed an analysis and everything seems to be fine, but still no error reported:

Analysis triggered on file:///home/myname/myproject/src/Service/TargetService.ts with configuration:
[
baseDir: /home/myname/myproject
workDir: /home/myname/myproject/.sonarlint
extraProperties: {}
excludedRules:
includedRules:
inputFiles: [
/home/myname/myproject/src/Service/TargetService.ts (UTF-8) [ts]
]
]

Available languages:

  • PHP => “php”
  • Python => “py”
  • TypeScript => “ts”
  • JavaScript => “js”
    Start analysis
    Declared extensions of language PHP were converted to php: /*.php,/.php3,**/.php4,/*.php5,/.phtml,**/.inc
    Declared extensions of language Python were converted to py: /.py
    Declared extensions of language TypeScript were converted to ts: **/
    .ts,
    /.tsx
    Declared extensions of language JavaScript were converted to js: **/
    .js,/*.jsx,/*.vue
    [Info - 2:13:07 PM] Index files
    Language of file ‘file:///home/myname/myproject/src/Service/TargetService.ts’ is set to ‘ts’
    Setting filesystem encoding: UTF-8
    [Info - 2:13:07 PM] 1 files indexed
    ‘PHP sensor’ skipped because there is no related file in current project
    ‘Analyzer for “php.ini” files’ skipped because there is no related file in current project
    ‘Python Squid Sensor’ skipped because there is no related file in current project
    ‘Import of TSLint issues’ skipped because one of the required properties is missing
    ‘Import of ESLint issues’ skipped because one of the required properties is missing
    Execute Sensor: Contextual SonarTS
    [Info - 2:13:07 PM] Started SonarTS Analysis
    [Info - 2:13:07 PM] Finished SonarTS Analysis
    ‘SonarJS’ skipped because there is no related file in current project

BUT: as soon as I create a dummy file with .js extensions, sonarlint works perfectly fine. What could be the problem and why is it only with typescript extensions?

Thanks in advance!!

As per your log, it seems to be working. Perhaps it simply doesn’t find issues. Try this snippet, you should get an issue reported on it:

if (x && x) {
    // ...
}