Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

@typescript-eslint/no-unused-vars Complains when import is only used in jsdoc #9435

Closed as not planned
Labels
bugSomething isn't workingduplicateThis issue or pull request already existslocked due to agePlease open a new issue if you'd like to say more. See https://typescript-eslint.io/contributing.package: eslint-pluginIssues related to @typescript-eslint/eslint-plugin
@ej612

Description

@ej612

Before You File a Bug Report Please Confirm You Have Done The Following...

  • I have tried restarting my IDE and the issue persists.
  • I have updated to the latest version of the packages.
  • I havesearched for related issues and found none that matched my issue.
  • I haveread the FAQ and my problem is not listed.

Repro Code

Hi there!

I have the following code:

/** * Bla bla {@link MyClass} */exportinterfaceMyInterface{}

I want my jsdoc to include a reference to the class in question, which means I have to import it:

importtype{MyClass}from'./MyClass';/** * Bla bla {@link MyClass} */exportinterfaceMyInterface{}

This works, meaning the link is now properly resolved. Also, tsc understands that I'm using the import and doesn't complain. If I remove the link but keep the import, I get the following error (as expected):

'MyClass' is declared but its value is never read. ts(6133)

So everything's fine on the tsc front. However,no-unused-vars doesn't realize I'm using the import in a jsdoc comment, and complains:

'MyClass' is defined but never used. eslint(@typescript-eslint/no-unused-vars)

ESLint Config

module.exports={parser:"@typescript-eslint/parser",rules:{'no-unused-vars':'off','@typescript-eslint/no-unused-vars':['error',{args:'after-used',argsIgnorePattern:'^_',destructuredArrayIgnorePattern:'^_'}],},};

Expected Result

I would expectno-unused-vars to realize that I'm using the import - albeit only in a jsdoc comment - like tsc does.

Actual Result

no-unused-vars sees that I'm not using the import in the code and complains.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingduplicateThis issue or pull request already existslocked due to agePlease open a new issue if you'd like to say more. See https://typescript-eslint.io/contributing.package: eslint-pluginIssues related to @typescript-eslint/eslint-plugin

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp