Check JSDoc @param tag names#18777
Conversation
sandersn
left a comment
There was a problem hiding this comment.
I don't think there should be an error in Typescript, or in cases where there is no typeExpression. Well, they should be warnings, if we had such things already.
Either way, I'd like to see tests for these cases.
| function checkJSDocParameterTag(node: JSDocParameterTag) { | ||
| checkSourceElement(node.typeExpression); | ||
| if (!getParameterSymbolFromJSDoc(node)) { | ||
| error(node.name, |
There was a problem hiding this comment.
This should be a lint-style warning if there is no typeExpression, or if the typeExpression is ignored, the way it is in Typescript.
Until we have a warning infrastructure, I would rather not issue the error in those two cases.
|
|
||
| function checkJSDocParameterTag(node: JSDocParameterTag) { | ||
| checkSourceElement(node.typeExpression); | ||
| if (!getParameterSymbolFromJSDoc(node)) { |
There was a problem hiding this comment.
getParameterSymbolFromJSDoc has a linear search of function.parameters, and we call this for every @param node. So it's quadratic where it could be linear if we wrote sufficiently clever code.
Might not be an issue, but I wanted to make sure you'd thought about it. (Most functions have few parameters and most @params are correct, so pathological cases should be rare.)
|
@sandersn Based on our discussion I think all of these points can be dealt with later? I could start working on performance tomorrow if this got in today.
|
Related: #15852, but that's a broader issue so this won't fix it completely.