Skip to content

Commit ecde6ec

Browse files
committed
fix(rules/renderer): Detect missing apiVersion for method declarations
Similar to the already supported property assigment with an arrow function, 'renderer' might also be declared as a method declarations or function declaration (which is transpiled to a method declaration). If the 'renderer' property is set to a function/method, this implies apiVersion 1 and should therefore be reported as deprecated API usage. Follow up of #439 JIRA: CPOUI5FOUNDATION-878
1 parent 585fb33 commit ecde6ec

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/linter/ui5Types/SourceFileLinter.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,10 @@ export default class SourceFileLinter {
340340
// i.e. { renderer: {apiVersion: 2, render: () => {}} }
341341
this.analyzeControlRendererInternals(rendererMember.initializer);
342342
}
343+
} else if (ts.isMethodDeclaration(rendererMember)) {
344+
// Analyze renderer property when it's a function (which gets transpiled to a method declaration)
345+
// i.e. { renderer: function() => {} }
346+
this.analyzeControlRendererInternals(rendererMember);
343347
}
344348
}
345349

0 commit comments

Comments
 (0)