-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Closed as not planned
Closed as not planned
Copy link
Labels
bugSomething isn't workingSomething isn't workingduplicateThis issue or pull request already existsThis 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.Please 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-pluginIssues related to @typescript-eslint/eslint-plugin
Description
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 have searched for related issues and found none that matched my issue.
- I have read the FAQ and my problem is not listed.
Repro Code
Hi there!
I have the following code:
/**
* Bla bla {@link MyClass}
*/
export interface MyInterface {
}
I want my jsdoc to include a reference to the class in question, which means I have to import it:
import type { MyClass } from './MyClass';
/**
* Bla bla {@link MyClass}
*/
export interface MyInterface {
}
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 expect no-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
Labels
bugSomething isn't workingSomething isn't workingduplicateThis issue or pull request already existsThis 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.Please 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-pluginIssues related to @typescript-eslint/eslint-plugin