jsdoc/tsdoc not parsed correctly
alumni opened this issue · comments
I am also experiencing this issue.
I am also seeing this issue.
I think it breaks because of this change in the typescript AST: microsoft/TypeScript#41877
Changing the implementation of getJsDocDeprecation
to something like:
function getJsDocDeprecation(tags: ts.JSDocTagInfo[]) {
for (const tag of tags) {
if (tag.name === 'deprecated') {
let reason = tag.text || ''
if (Array.isArray(tag.text) && tag.text.length > 0) {
reason = tag.text[0].text || ''
}
return { reason: reason }
}
}
return undefined
}
Should fix the issue.
For now, I made the following patch-package
diff --git a/node_modules/eslint-plugin-deprecation/dist/rules/deprecation.js b/node_modules/eslint-plugin-deprecation/dist/rules/deprecation.js
index 606774f..8a1e478 100644
--- a/node_modules/eslint-plugin-deprecation/dist/rules/deprecation.js
+++ b/node_modules/eslint-plugin-deprecation/dist/rules/deprecation.js
@@ -230,13 +230,17 @@ function isCallExpression(node, callee) {
return false;
}
function getJsDocDeprecation(tags) {
- for (var _i = 0, tags_1 = tags; _i < tags_1.length; _i++) {
- var tag = tags_1[_i];
- if (tag.name === 'deprecated') {
- return { reason: tag.text || '' };
+ for (var _i = 0, tags_1 = tags; _i < tags_1.length; _i++) {
+ var tag = tags_1[_i];
+ if (tag.name === 'deprecated') {
+ let reason = tag.text || '';
+ if(Array.isArray(tag.text) && tag.text.length > 0) {
+ reason = tag.text[0].text || ''
}
- }
- return undefined;
+ return { reason: reason };
+ }
+ }
+ return undefined;
}
function isFunction(symbol) {
var declarations = symbol.declarations;
The fix is being prepared in #35
Released in v1.3.1!