S4328 false-positive on NuxtJS projects with path aliases

We are using SonarQube Server - Developer Edition 2025.1 LTA in combination with SonarScanner CLI 7.0.1.4817 in our GitLab CI.

Since we upgraded from 9.9 LTA we got lots of S4328 false-positives in our NuxtJS + Vue project for import statements starting with tilde e.g. import ~/foo/bar.

Our project has a simple tsconfig.json:

{
  "extends": "./.nuxt/tsconfig.json",
  "exclude": ["node_modules", "**/*.spec.ts", "megalinter-reports", "scripts"],
  "compilerOptions": {
    "types": ["vidstack/vue"]
  }
}

Nuxt generates a separate tsconfig.json when building inside the .nuxt/ folder which actually contains the necessary path aliases for tilde and other path aliases. At first we were actually missing the artifact with the .nuxt/tsconfig.json so the SonarScanner CLI failed to find the in the root tsconfig.json referenced .nuxt/tsconfig.json and threw an error.
After we made the .nuxt/tsconfig.json available for the scanner it successfully detected it according to the log:

Found 3 tsconfig.json file(s): [/builds/our/nuxtjs/project/tsconfig.json, /builds/our/nuxtjs/project/.nuxt/tsconfig.json, /builds/our/nuxtjs/project/scripts/translation/tsconfig.json]
08:44:31.848 INFO  Creating TypeScript program
08:44:31.848 INFO  TypeScript configuration file /builds/our/nuxtjs/project/tsconfig.json
08:44:31.848 INFO  348 source files to be analyzed
08:44:33.131 INFO  Starting analysis with current program
08:44:37.478 INFO  Analyzed 327 file(s) with current program
08:44:37.484 INFO  Creating TypeScript program
08:44:37.484 INFO  TypeScript configuration file /builds/our/nuxtjs/project/.nuxt/tsconfig.json
08:44:38.242 INFO  Starting analysis with current program
08:44:38.765 INFO  Analyzed 21 file(s) with current program
08:44:38.772 INFO  Creating TypeScript program
08:44:38.773 INFO  TypeScript configuration file /builds/our/nuxtjs/project/scripts/translation/tsconfig.json
08:44:38.842 INFO  Starting analysis with current program
08:44:38.843 INFO  Analyzed 0 file(s) with current program
08:44:38.856 INFO  348/348 source files have been analyzed
08:44:38.858 INFO  Hit the cache for 323 out of 348
08:44:38.859 INFO  Miss the cache for 25 out of 348: FILE_CHANGED [25/348]
08:44:38.859 INFO  Sensor JavaScript/TypeScript analysis [javascript] (done) | time=15007ms

I verified that the .nuxt/tsconfig.json contains the necessary path aliases but SonarQube still reports the same S4328 errors so Typescript S4328 does not support aliases · Issue #1851 · SonarSource/SonarJS · GitHub is definitely not fixed yet.

Hello @Timo_Hendricks,

Last improvement we did on that rule tries precisely to check whether Typescript can resolve or not the dependency. As it looks, it’s not covering the case for NuxtJS. We would highly appreciate if you can send us a very minimal reproducer so that we can improve the rule.

Cheers,
Victor