Typescript file matched NO_CONFIG

SonarLint doesn’t report any errors within my typescript files, because it doesn’t recognize that any of them match my provided tsconfig file, even though all of them do (if i run npm tsc, all of them compile properly).
This is how the logs look like:

Using c:\workspaces\repos\project\subproject\tsconfig.json from sonar.typescript.tsconfigPath property
C:/workspaces/repos/project/subproject/source/somefile.ts matched NO_CONFIG

It’s a very simple scenario, so I wondered what the issue could be. Looking more into details in the logs, I found that the basePath might be the issue:

Starting analysis with configuration:
  projectKey: mysonarproject
  baseDir: C:\workspaces\repos\project
  extraProperties: {sonar.java.target=6, sonar.java.source=6, sonar.typescript.tsconfigPath=c:\workspaces\repos\project\subproject\tsconfig.json, sonar.projectBaseDir=c:\workspaces\repos\project\subproject}
  moduleKey: Module: 'subproject'
  inputFiles: [
    file:///C:/workspaces/repos/project/subproject/source/somefile.ts (UTF-8)

I tried to change it using sonar.projectBaseDir, but it didn’t help. There seems to be some kind of issue resolving paths - maybe only on Windows? I didn’t test it on any other OS.

This does work fine on SonarQube, as well as with the VS Code plugin, it’s only an issue in the IntelliJ plugin.

Why do none of my TypeScript files match my tsconfig.json in SonarLint, even though the compiler works perfectly fine with them?

Hello, welcome to the community! And thank you for reporting this issue.

Would it be possible for you to share the contents of your tsconfig.json, or maybe a minimal reproducing project? In which IDE are you noticing this issue, with which version of SonarLint?

Also, how is your project layout configured in your IDE? We are aware of potential issues when an empty “project” uses modules defined outside of the project’s base directory (though this does not seem to be the case for your project).

Finally, would it be possible for you to share the full analysis log, with both “Verbose output” and “Analyzer logs” enabled in the SonarLint Log tab? E.g with the following scenario:

  • Close all editors in your IDE
  • “File” > “Invalidate caches…” > “Just restart”
  • Open on the “SonarLint” tool window, “Log” tab
  • Open one of the offending files and wait for message Found x issues

This would be very useful in trying to understand what is going on.

As far as I can tell, you can drop the sonar.projectBaseDir property - it is not used at all by SonarLint, only by the SonarQube scanner.

I’m using IntelliJ IDEA Ultimate 2021.1.3 with SonarLint I just tried to create a reproducer using multiple different mechanisms:

  • create a project via npm init, then use “Create project from existing source…” in IntelliJ
  • create a new node project from within IntelliJ
  • create an empty project and importing the ts project as a module

I was only able to reproduce the issue with the last configuration, so I guess this also applies to the projects I have issues with (I don’t remember how I created that workspace, so it probably was the “Empty project”-workflow). Anyways - with the last approach, SonarLint doesn’t even detect the tsconfig file and if I provide it via property, it doesn’t recognize that the ts files match this tsconfig file (even if they do).

I guess this is the issue you’re talking about. Is this being worked on? We have quite a few monorepos that require this kind of setup. This is how I reproduced it:

  • create a typescript project via npm init at c:\workspaces\temp\sonarlint-test
  • create a tsconfig file with this content:
    "include": [
  • create a dir and file in the project dir: source/test.ts
  • add the following code that should produce a sonar issue:
if (5 === NaN) {
  • create an empty project at C:\workspaces\temp\sonarlint-test-project
  • add the typescript project at c:\workspaces\temp\sonarlint-test as a module

If you now open the ts file, you won’t get any sonar issues as SonarLint won’t detect that it matches the underlying tsconfig file (if I don’t add the tsconfig path via environment variable, it won’t even detect that one and skip analysis completely).

Here’s the log for a run without the tsconfig property manually provided:

Server started on 64120
Couldn't get a connected engine to check for update: Project is not bound to a SonarQube project
Trigger: ACTION
[Action] 1 file(s) submitted
1 entries removed from the store
Configuring analysis with org.sonarlint.intellij.java.JavaAnalysisConfigurator
Found plugin: sonar-cfamily-plugin-
Found plugin: sonar-html-plugin-
Found plugin: sonar-java-plugin-
Found plugin: sonar-javascript-plugin-
Found plugin: sonar-kotlin-plugin-
Found plugin: sonar-php-plugin-
Found plugin: sonar-python-plugin-
Found plugin: sonar-ruby-plugin-
Found plugin: sonar-secrets-plugin-
Found plugin: sonarlint-omnisharp-plugin-
Create : C:\Users\windows.user\AppData\Roaming\JetBrains\IntelliJIdea2021.1\sonarlint\plugins
Plugin cache: C:\Users\windows.user\AppData\Roaming\JetBrains\IntelliJIdea2021.1\sonarlint\plugins
Create : C:\Users\windows.user\AppData\Roaming\JetBrains\IntelliJIdea2021.1\sonarlint\plugins\_tmp
Load plugins
Plugin 'CFamily Code Quality and Security' is excluded because none of languages 'C,C++,Objective-C' are enabled. Skip loading it.
Plugin 'C# Code Quality and Security (Omnisharp)' is excluded because language 'C#' is not enabled. Skip loading it.
Load plugins (done) | time=26ms
  * Python Code Quality and Security (python)
  * Java Code Quality and Security (java)
  * HTML Code Quality and Security (web)
  * Kotlin Code Quality and Security (kotlin)
  * PHP Code Quality and Security (php)
  * Sonar Secrets Plugin for SonarQube (secrets)
  * JavaScript/TypeScript Code Quality and Security (javascript)
  * Ruby Code Quality and Security (ruby)
Creating container for module with key=Module: 'sonarlint-test-2'
Analysing 'test.ts'...
Starting analysis with configuration:
  baseDir: C:\workspaces\temp\sonarlint-test-project
  extraProperties: {sonar.java.target=1.6, sonar.java.source=6}
  moduleKey: Module: 'sonarlint-test-2'
  excludedRules: [squid:S1607]
  includedRules: []
  ruleParameters: {}
  inputFiles: [
    file:///C:/workspaces/temp/sonarlint-test-2/source/test.ts (UTF-8)

Rule 'java:S1607' was excluded using its deprecated key 'squid:S1607'. Please fix your configuration.
Start analysis
Index files
Language of file 'file:///C:/workspaces/temp/sonarlint-test-2/source/test.ts' is detected to be 'TypeScript'
1 file indexed
'JavaSensor' 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
Execute Sensor: Sonar Secrets Detection Sensor
'JavaScript analysis' skipped because there is no related file in current project
Execute Sensor: TypeScript analysis
Deploying bundle
Deploying eslint-bridge into C:\Users\windows.user\AppData\Local\JetBrains\IntelliJIdea2021.1\tmp\sonarlint\.sonartmp_1927314098293774722\eslint-bridge-bundle
Deploying bundle (done) | time=12911ms
Starting server
No workDir in SonarLint
Running in SonarLint context, metrics will not be computed.
Using Node.js executable C:\workspaces\devtools\nodejs\node.exe from property sonar.nodejs.executable.
Checking Node.js version
Launching command C:\workspaces\devtools\nodejs\node.exe -v
Using Node.js v14.16.1.
Starting Node.js process to start eslint-bridge server at port 63162
Launching command C:\workspaces\devtools\nodejs\node.exe C:\Users\windows.user\AppData\Local\JetBrains\IntelliJIdea2021.1\tmp\sonarlint\.sonartmp_1927314098293774722\eslint-bridge-bundle\package\bin\server 63162 C:\workspaces\temp\sonarlint-test-project true true 
starting eslint-bridge server at port 63162
eslint-bridge server is running at port 63162
Starting server (done) | time=2381ms
initializing linter with no-commented-code,sonar-no-fallthrough,new-operator-misuse,non-existent-operator,no-inverted-boolean-check,no-small-switch,file-uploads,prefer-for-of,xml-parser-xxe,default-param-last,no-global-this,no-array-delete,no-alphabetical-sort,arguments-order,no-unsafe-finally,prefer-while,no-sequences,void-use,no-octal,comma-or-logical-or-case,label-position,conditional-indentation,no-use-of-empty-return-value,session-regeneration,super-invocation,no-associative-arrays,no-weak-keys,no-try-promise,weak-ssl,no-useless-increment,no-throw-literal,no-same-line-conditional,no-redundant-optional,no-identical-functions,no-element-overwrite,no-equals-in-for-termination,no-sparse-arrays,post-message,constructor-for-side-effects,no-redundant-jump,no-redeclare,no-duplicate-imports,no-unthrown-error,no-globals-shadowing,unverified-hostname,no-collection-size-mischeck,prefer-namespace-keyword,unverified-certificate,no-empty-collection,for-loop-increment-sign,no-accessor-field-mismatch,no-unused-collection,no-invariant-returns,no-case-label-in-switch,no-return-await,no-nested-conditional,no-unnecessary-type-assertion,insecure-jwt-token,no-dead-store,prefer-type-guard,use-type-alias,no-misleading-array-reverse,no-redundant-assignments,no-in-misuse,no-parameter-reassignment,no-all-duplicated-branches,no-identical-conditions,no-weak-cipher,no-delete-var,encryption-secure-mode,updated-loop-counter,no-useless-intersection,no-empty-function,no-unsafe-negation,max-switch-cases,no-extra-semi,deprecation,misplaced-loop-counter,no-one-iteration-loop,no-multi-str,no-undefined-argument,function-inside-loop,no-labels,cognitive-complexity,use-isnan,no-shadow,no-nested-template-literals,no-duplicate-in-composite,generator-without-yield,no-caller,no-ignored-return,no-duplicated-branches,no-redundant-parentheses,call-argument-line,no-unenclosed-multiline-block,bitwise-operators,class-name,no-identical-expressions,no-redundant-boolean,no-unreachable,prefer-immediate-return,no-useless-catch,prefer-promise-shorthand,unused-import,no-nested-assignment,index-of-compare-to-positive-number,file-name-differ-from-class,no-primitive-wrappers,todo-tag,prefer-default-last,no-empty-pattern,no-gratuitous-expressions,no-self-assign,no-misused-new,no-invalid-await,fixme-tag,no-empty,max-params,no-unused-expressions
Found 0 tsconfig.json file(s): []
Generating temporary tsconfig is not supported in SonarLint context.
No tsconfig.json file found, analysis will be skipped.
'Ruby Sensor' skipped because there is no related file in current project
Done in 18201ms

Processed 0 issues
Found 0 issues

Another interesting part is, even if you use one of the two working scenarios - if you add a module later on that is based on a different path (in this case, e.g. c:\workspaces\temp\other-module), none of the ts files in the other module will be analyzed, and the tsconfig file there won’t be detected either. Analysis in the initial module still works fine though.

Hello @gernot.raudner,

Sorry for taking so long to come back to you.

There is indeed an issue with this mechanism, and the tsconfig detection should be reworked soon with this ticket.

Thanks for your patience

any updates on this? i can’t see an assignee or any activity on that ticket