"No tsconfig.json file found, analysis will be stopped" while parsing TypeScript files

Hi all,
I’ve been using SonarLint for quite a while, but recently it started throwing an error every time a type a character in a .ts file. The error is the following:

[Info  - 19:02:41.768] Analyzing file 'file:///path/to/some_file.ts'...
[Error - 19:02:41.861] org.sonarsource.nodejs.NodeCommandException: No tsconfig.json file found, analysis will be stopped.
  at org.sonar.plugins.javascript.eslint.TypeScriptSensor.tsConfigs(TypeScriptSensor.java:167)
  at org.sonar.plugins.javascript.eslint.TypeScriptSensor.analyzeFiles(TypeScriptSensor.java:111)
  at org.sonar.plugins.javascript.eslint.AbstractEslintSensor.execute(AbstractEslintSensor.java:120)
  at org.sonar.plugins.javascript.eslint.TypeScriptSensor.execute(TypeScriptSensor.java:55)
  at org.sonarsource.sonarlint.core.analyzer.sensor.SensorsExecutor.executeSensor(SensorsExecutor.java:80)
  at org.sonarsource.sonarlint.core.analyzer.sensor.SensorsExecutor.execute(SensorsExecutor.java:71)
  at org.sonarsource.sonarlint.core.container.analysis.AnalysisContainer.doAfterStart(AnalysisContainer.java:132)
  at org.sonarsource.sonarlint.core.container.ComponentContainer.startComponents(ComponentContainer.java:126)
  at org.sonarsource.sonarlint.core.container.ComponentContainer.execute(ComponentContainer.java:111)
  at org.sonarsource.sonarlint.core.container.standalone.StandaloneGlobalContainer.analyze(StandaloneGlobalContainer.java:153)
  at org.sonarsource.sonarlint.core.StandaloneSonarLintEngineImpl.analyze(StandaloneSonarLintEngineImpl.java:90)
  at org.sonarsource.sonarlint.ls.AnalysisManager.lambda$analyzeStandalone$5(AnalysisManager.java:325)
  at org.sonarsource.sonarlint.ls.AnalysisManager.analyzeWithTiming(AnalysisManager.java:367)
  at org.sonarsource.sonarlint.ls.AnalysisManager.analyzeStandalone(AnalysisManager.java:325)
  at org.sonarsource.sonarlint.ls.AnalysisManager.analyze(AnalysisManager.java:250)
  at org.sonarsource.sonarlint.ls.AnalysisManager.lambda$analyzeAsync$0(AnalysisManager.java:209)
  at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
  at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
  at java.base/java.lang.Thread.run(Unknown Source)

The error doesn’t appear every time, nor for every file, nor always for the same file. However, once a file has been “errored”, it will keep triggering the error every time until I close it.

Interestingly, SonarLint seems able to report “problems” in the affected files. The main issue is the constant pop up saying that “JS/TS analysis failed” (example below).
image

I can’t even ignore that popup, because it moves the focus to the “output” tab, forcing me to click on the editor every time I type something. I wouldn’t mind the output log, but this “focus stealing” is the most annoying issue, as it prevents me from working. Is there a way to hide/suppress the popup?

Relevant environment information, if it helps:

  • Windows 10 Pro
  • VS Code 1.52.1
  • SonarLint 1.19 (I tried previous versions, just in case, but it didn’t make a difference)

Hello Diego, welcome to the community! And thank you for your question.

While it can happen that the TS analyzer used by SonarLint does not find the right tsconfig.json to use for a file, it is definitely not expected to happen on each analysis.

Could you please set both sonarlint.output.showAnalyzerLogs and sonarlint.output.showVerboseLogs to true in you user settings, and post the full analysis log when it happens?

We’re especially eager to see what happens between those lines:

[Debug - 10:23:12.698] Queuing analysis of file 'file:///path/to/some_file.ts'
/* ... ~ a few tens of lines ... */
[Info  - 10:23:29.850] Found XXX issue(s)

I also agree that the error notification is annoying in this use case of repeated errors. I’m not sure what can be done about it. We could introduce a SonarLint-specific setting (e.g sonarlint.ls.hideAnalyzerFailures) and I believe we should instead find a way to fix the root cause. There is also an open issue on VSCode to allow users to toggle extension notifications at the IDE level.