False-Positive for typescript:S1128 when using "import type" and JSDoc

Product: SonarQube Data Center Edition (Version 9.9)
Language: Typescript
Rule: typescript:S1128 (Unnecessary imports should be removed)

The following code snippet is a code smell, according to typescript:S1128.

import type { Server } from "./Server";

/** Used to connect to the {@link Server} */
export class Client {}

This is a false-positive in my opinion because the imported type is not unused. It is referenced in the JSDoc comment.

Thanks in advance for your help! :slight_smile:

Hello NicoHaefele,

Thank you for notifying us about this issue.

We’ve opened an issue to track this case: Fix FPs S1128 (`unused-import`): Support usage in JSDoc comments · Issue #3882 · SonarSource/SonarJS · GitHub

Best Regards,
Ilia

2 Likes

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