SonarLint skipping TypeScript files

SonarLint 4.10.0.19739
IntelliJ Idea 2020.1.3
Node.js v12.18.3 (LTS)

I have created a completely fresh AngularJs application with a component for the demonstration:
ng new angular-project
ng g component dummy-component

I’m using the default SonarLint TypeScript rules with no binding to SonarQube (but the same issue happens even when bound to SonarQube project)
Running a SonarLint analysis on the dummy-component.compontent.ts with purposefully introduced Sonar issue ( var a = NaN; if (a === NaN) {… ) leads to the file being skipped - SonarLint log:

Execute Sensor: TypeScript analysis
eslint-bridge server is up, no need to start.
Found 2 tsconfig.json file(s): [C:\Dev\Projects\training\angular\angular-project\e2e\tsconfig.json, C:\Dev\Projects\training\angular\angular-project\tsconfig.json]
C:/Dev/Projects/training/angular/angular-project/src/app/dummy-component/dummy-component.component.ts matched NO_CONFIG
1 source files to be analyzed
Skipping 1 files with no tsconfig.json
Skipped files: [uri=file:///C:/Dev/Projects/training/angular/angular-project/src/app/dummy-component/dummy-component.component.ts]
1/1 source files have been analyzed

Same happens when I delete the tsconfig.json in the e2e folder, the only difference is on the “Found X tsconfig.json file(s)” line

Full log in case it helps
Trigger: ACTION
[Action] 1 file(s) submitted
Configuring analysis with org.sonarlint.intellij.analysis.JavaAnalysisConfigurator
Analysing 'dummy-component.component.ts'...
Starting analysis with configuration:
[
  baseDir: C:\Dev\Projects\training\angular\angular-project
  extraProperties: {sonar.java.target=6, sonar.java.source=6, sonar.java.libraries=C:\Dev\Programs\JDK\jdk11\jdk11.0.6_10\lib\jrt-fs.jar, sonar.java.test.libraries=C:\Dev\Programs\JDK\jdk11\jdk11.0.6_10\lib\jrt-fs.jar}
  excludedRules: []
  includedRules: [squid:S00103]
  ruleParameters: {}
  inputFiles: [
    file:///C:/Dev/Projects/training/angular/angular-project/src/app/dummy-component/dummy-component.component.ts (UTF-8)
  ]
]

Rule 'java:S103' was included using its deprecated key 'squid:S00103'. Please fix your configuration.
Available languages:
  * Python => "py"
  * Java => "java"
  * HTML => "web"
  * JSP => "jsp"
  * Kotlin => "kotlin"
  * PHP => "php"
  * JavaScript => "js"
  * TypeScript => "ts"
  * Ruby => "ruby"
Start analysis
Declared extensions of language Python were converted to py: **/*.py
Declared extensions of language Java were converted to java: **/*.java,**/*.jav
Declared extensions of language HTML were converted to web: **/*.html,**/*.xhtml,**/*.cshtml,**/*.vbhtml,**/*.aspx,**/*.ascx,**/*.rhtml,**/*.erb,**/*.shtm,**/*.shtml
Declared extensions of language JSP were converted to jsp: **/*.jsp,**/*.jspf,**/*.jspx
Declared extensions of language Kotlin were converted to kotlin: **/*.kt
Declared extensions of language PHP were converted to php: **/*.php,**/*.php3,**/*.php4,**/*.php5,**/*.phtml,**/*.inc
Declared extensions of language JavaScript were converted to js: **/*.js,**/*.jsx,**/*.vue
Declared extensions of language TypeScript were converted to ts: **/*.ts,**/*.tsx
Declared extensions of language Ruby were converted to ruby: **/*.rb
Index files
Language of file 'file:///C:/Dev/Projects/training/angular/angular-project/src/app/dummy-component/dummy-component.component.ts' is detected to be 'ts'
1 file indexed
'JavaSquidSensor' skipped because there is no related file in current project
'Python Sensor' skipped because there is no related file in current project
Execute Sensor: JavaXmlSensor
Execute Sensor: HTML
'Kotlin Sensor' skipped because there is no related file in current project
'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
'JavaScript analysis' skipped because there is no related file in current project
Execute Sensor: TypeScript analysis
eslint-bridge server is up, no need to start.
Found 2 tsconfig.json file(s): [C:\Dev\Projects\training\angular\angular-project\e2e\tsconfig.json, C:\Dev\Projects\training\angular\angular-project\tsconfig.json]
C:/Dev/Projects/training/angular/angular-project/src/app/dummy-component/dummy-component.component.ts matched NO_CONFIG
1 source files to be analyzed
Skipping 1 files with no tsconfig.json
Skipped files: [uri=file:///C:/Dev/Projects/training/angular/angular-project/src/app/dummy-component/dummy-component.component.ts]
1/1 source files have been analyzed
'Ruby Sensor' skipped because there is no related file in current project
Done in 1489ms

Processed 0 issues in 0 ms
Found 0 issues

Are you certain the generated dummy component lives within a directory specified as within scope of the angular-project\tsconfig.json file? What does that file look like?

1 Like

Thank you, that seems to have been the issue. I didn’t question the defaults that the angular-cli generated, which is apparently a mistake.

Fixed by modifying the tsconfig.json by deleting the “files” name/value pair and replacing it with:

"include": ["src/**/*"],
"exclude": ["node_modules", "**/*.spec.ts"],

I still find it rather odd that the angular-cli generates it wrongly (even though I have created the component through the angular-cli, it didn’t add it to the “files” list), but that’s an Angular issue.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.