mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-17 11:24:29 -05:00
prefix-unused-parameter-with-_ codefix now works in jsdoc @param (#36152)
* Fix prepending unused TypeScript variables with underscore doesn't rename JSDoc @param. Fix test for quick fix "Prefix all unused declarations with '_' where possible". Fixes #33021. * Replace FindAllReferences.Core.eachSymbolReferenceInFile function call to more ligher call of getJSDocParameterTags when searching for a parameter in jsdoc. * Remove redundant constant declaration. * Add test for prefix single unused parameter in jsdoc.
This commit is contained in:
@@ -154,6 +154,13 @@ namespace ts.codefix {
|
||||
}
|
||||
if (isIdentifier(token) && canPrefix(token)) {
|
||||
changes.replaceNode(sourceFile, token, createIdentifier(`_${token.text}`));
|
||||
if (isParameter(token.parent)) {
|
||||
getJSDocParameterTags(token.parent).forEach((tag) => {
|
||||
if (isIdentifier(tag.name)) {
|
||||
changes.replaceNode(sourceFile, tag.name, createIdentifier(`_${tag.name.text}`));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user