Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 19 additions & 3 deletions src/linter/ui5Types/SourceFileLinter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -246,9 +246,9 @@ export default class SourceFileLinter {
return deprecatedTag.text?.reduce((acc, text) => acc + text.text, "").split("\n\n")[0] ?? "";
}

getDeprecationInfo(symbol: ts.Symbol | undefined): DeprecationInfo | null {
getDeprecationInfo(symbol: ts.Symbol | undefined, signature?: ts.Signature): DeprecationInfo | null {
if (symbol && this.isSymbolOfUi5Type(symbol)) {
const jsdocTags = symbol.getJsDocTags(this.#checker);
const jsdocTags = (signature ?? symbol).getJsDocTags(this.#checker);
const deprecatedTag = jsdocTags.find((tag) => tag.name === "deprecated");
if (deprecatedTag) {
const deprecationInfo: DeprecationInfo = {
Expand Down Expand Up @@ -313,7 +313,9 @@ export default class SourceFileLinter {
}
}

const deprecationInfo = this.getDeprecationInfo(exprType.symbol);
const signature = this.#checker.getResolvedSignature(node);
const deprecationInfo = this.getDeprecationInfo(exprType.symbol, signature);

if (!deprecationInfo) {
return;
}
Expand Down Expand Up @@ -612,6 +614,20 @@ export default class SourceFileLinter {
return; // Already analyzed in context of call expression
}

const nodeType = this.#checker.getTypeAtLocation(node);
const signatures = nodeType.getCallSignatures();
if (signatures) {
const allSignaturesDeprecated = signatures.every((signature) => {
signature.getJsDocTags().some((tag) => {
return tag.name === "deprecated";
});
});

if (!allSignaturesDeprecated) {
return;
}
}

const deprecationInfo = this.getDeprecationInfoForAccess(node);
if (deprecationInfo) {
if (this.isSymbolOfJquerySapType(deprecationInfo.symbol)) {
Expand Down