From 7b24c53b8e5df6db2efcfc0512f62a0dfc739f78 Mon Sep 17 00:00:00 2001 From: Yavor Ivanov Date: Thu, 14 Mar 2024 16:38:06 +0200 Subject: [PATCH 01/36] feat: Analyze sap.ui.core.Lib.init() call --- src/detectors/typeChecker/FileLinter.ts | 30 +++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/src/detectors/typeChecker/FileLinter.ts b/src/detectors/typeChecker/FileLinter.ts index ae99e406..3e4b1f04 100644 --- a/src/detectors/typeChecker/FileLinter.ts +++ b/src/detectors/typeChecker/FileLinter.ts @@ -55,6 +55,7 @@ export default class FileLinter { // const nodeType = this.#checker.getTypeAtLocation(node); this.analyzePropertyAccessExpression(node as ts.CallExpression); // Check for global this.analyzeCallExpression(node as ts.CallExpression); // Check for deprecation + this.analyzeLibInitCall(node as ts.CallExpression); // Check for sap.ui.coreLib.init usages } else if (node.kind === ts.SyntaxKind.PropertyAccessExpression || node.kind === ts.SyntaxKind.ElementAccessExpression) { this.analyzePropertyAccessExpression( @@ -210,6 +211,35 @@ export default class FileLinter { messageDetails: deprecationInfo.messageDetails, }); } + + analyzeLibInitCall(node: ts.CallExpression) { + const nodeExp = node.expression as ts.PropertyAccessExpression; + if (nodeExp?.name?.text !== "init" || + !ts.isPropertyAccessExpression(nodeExp) || + !ts.isIdentifier(nodeExp.expression) || + nodeExp?.expression?.text !== "Library") { // TODO: Check more reliably the import var of sap.ui.core.Lib + // Library.init() -> init() is already identified as CallExpression, so + // Library needs to be a propertyAccessExpression + return; + } + + const libVersion = (node.arguments[0] as ts.ObjectLiteralExpression) + .properties.find((prop: ts.ObjectLiteralElementLike) => { + return ts.isPropertyAssignment(prop) && + ts.isIdentifier(prop.name) && prop.name.text === "version" && + ts.isLiteralExpression(prop.initializer) && prop.initializer.text !== "2"; + }) as ts.PropertyAssignment | undefined; + + if (libVersion) { + this.#reporter.addMessage({ + node: libVersion, + severity: LintMessageSeverity.Error, + ruleId: "ui5-linter-no-partially-deprecated-api", + message: + `Call to ${nodeExp.expression.text}.init() must be declared with property {version: 2}` + }); + } + } getDeprecationInfoForAccess(node: ts.AccessExpression): DeprecationInfo | null { let symbol; From 32a3c65524d9c590d4ae795a57e01dddc5717c6d Mon Sep 17 00:00:00 2001 From: Yavor Ivanov Date: Thu, 14 Mar 2024 16:47:21 +0200 Subject: [PATCH 02/36] fix: Eslint findings --- src/detectors/typeChecker/FileLinter.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/detectors/typeChecker/FileLinter.ts b/src/detectors/typeChecker/FileLinter.ts index 3e4b1f04..741b7bea 100644 --- a/src/detectors/typeChecker/FileLinter.ts +++ b/src/detectors/typeChecker/FileLinter.ts @@ -211,32 +211,32 @@ export default class FileLinter { messageDetails: deprecationInfo.messageDetails, }); } - + analyzeLibInitCall(node: ts.CallExpression) { const nodeExp = node.expression as ts.PropertyAccessExpression; if (nodeExp?.name?.text !== "init" || - !ts.isPropertyAccessExpression(nodeExp) || + !ts.isPropertyAccessExpression(nodeExp) || !ts.isIdentifier(nodeExp.expression) || nodeExp?.expression?.text !== "Library") { // TODO: Check more reliably the import var of sap.ui.core.Lib // Library.init() -> init() is already identified as CallExpression, so // Library needs to be a propertyAccessExpression return; } - + const libVersion = (node.arguments[0] as ts.ObjectLiteralExpression) .properties.find((prop: ts.ObjectLiteralElementLike) => { return ts.isPropertyAssignment(prop) && - ts.isIdentifier(prop.name) && prop.name.text === "version" && + ts.isIdentifier(prop.name) && prop.name.text === "version" && ts.isLiteralExpression(prop.initializer) && prop.initializer.text !== "2"; }) as ts.PropertyAssignment | undefined; - + if (libVersion) { this.#reporter.addMessage({ node: libVersion, severity: LintMessageSeverity.Error, ruleId: "ui5-linter-no-partially-deprecated-api", message: - `Call to ${nodeExp.expression.text}.init() must be declared with property {version: 2}` + `Call to ${nodeExp.expression.text}.init() must be declared with property {version: 2}`, }); } } From d4c150c31118b3e84d12fab904471b312e20823e Mon Sep 17 00:00:00 2001 From: Yavor Ivanov Date: Fri, 15 Mar 2024 16:28:08 +0200 Subject: [PATCH 03/36] feat: Resolve lib dependency --- src/detectors/typeChecker/FileLinter.ts | 68 ++++++++++++++++++++----- 1 file changed, 55 insertions(+), 13 deletions(-) diff --git a/src/detectors/typeChecker/FileLinter.ts b/src/detectors/typeChecker/FileLinter.ts index 741b7bea..2e3ab484 100644 --- a/src/detectors/typeChecker/FileLinter.ts +++ b/src/detectors/typeChecker/FileLinter.ts @@ -55,7 +55,7 @@ export default class FileLinter { // const nodeType = this.#checker.getTypeAtLocation(node); this.analyzePropertyAccessExpression(node as ts.CallExpression); // Check for global this.analyzeCallExpression(node as ts.CallExpression); // Check for deprecation - this.analyzeLibInitCall(node as ts.CallExpression); // Check for sap.ui.coreLib.init usages + this.checkLibInitCall(node as ts.CallExpression); // Check for sap.ui.coreLib.init usages } else if (node.kind === ts.SyntaxKind.PropertyAccessExpression || node.kind === ts.SyntaxKind.ElementAccessExpression) { this.analyzePropertyAccessExpression( @@ -212,23 +212,65 @@ export default class FileLinter { }); } - analyzeLibInitCall(node: ts.CallExpression) { + getFnArgument(node: ts.CallExpression, settings: { + callExpressionName: string; + callExpressionPropName: string; + fnArgument: string | number; // Get N-th argument or argument by its name + }) { const nodeExp = node.expression as ts.PropertyAccessExpression; - if (nodeExp?.name?.text !== "init" || + if (nodeExp?.name?.text !== settings.callExpressionName || !ts.isPropertyAccessExpression(nodeExp) || !ts.isIdentifier(nodeExp.expression) || - nodeExp?.expression?.text !== "Library") { // TODO: Check more reliably the import var of sap.ui.core.Lib - // Library.init() -> init() is already identified as CallExpression, so - // Library needs to be a propertyAccessExpression + nodeExp?.expression?.text !== settings.callExpressionPropName) { + // Didn't match Instance.call(), so we're not interested anymore of analyzing it. return; } - const libVersion = (node.arguments[0] as ts.ObjectLiteralExpression) - .properties.find((prop: ts.ObjectLiteralElementLike) => { - return ts.isPropertyAssignment(prop) && - ts.isIdentifier(prop.name) && prop.name.text === "version" && - ts.isLiteralExpression(prop.initializer) && prop.initializer.text !== "2"; - }) as ts.PropertyAssignment | undefined; + let fnArgumentNode; + + if (typeof settings.fnArgument === "number") { // Get N-th arg + fnArgumentNode = node.arguments[settings.fnArgument]; + } else { + // Arg by name + fnArgumentNode = node.arguments.find((arg: ts.Expression) => + arg.kind === ts.SyntaxKind.Identifier && arg.getText() === settings.fnArgument); + } + return fnArgumentNode; + } + + checkLibInitCall(node: ts.CallExpression) { + const nodeExp = node.expression as ts.PropertyAccessExpression; + const {symbol} = this.#checker.getTypeAtLocation(nodeExp); + + if (symbol?.parent?.parent?.getEscapedName() !== "\"sap/ui/core/Lib\"") { + return; + } + + const importedVarName = nodeExp.name.parent.expression.getText()!; + const fnArg = this.getFnArgument(node, { + callExpressionName: "init", // Method's name + callExpressionPropName: importedVarName, + fnArgument: 0, // Lib.init() we're interested only in the first arg + }); + + let libVersion; + + if (!fnArg) { + libVersion = node; + } else { + const apiKeyProp = (fnArg as ts.ObjectLiteralExpression) + .properties?.find((prop: ts.ObjectLiteralElementLike) => { + return ts.isPropertyAssignment(prop) && + ts.isIdentifier(prop.name) && prop.name.text === "apiVersion"; + }) as ts.PropertyAssignment | undefined; + + if (!apiKeyProp) { // no apiVersion key at all + libVersion = node; + } else if (ts.isLiteralExpression(apiKeyProp.initializer) && apiKeyProp.initializer.text !== "2") { + // Checks the value itself + libVersion = apiKeyProp; + } + } if (libVersion) { this.#reporter.addMessage({ @@ -236,7 +278,7 @@ export default class FileLinter { severity: LintMessageSeverity.Error, ruleId: "ui5-linter-no-partially-deprecated-api", message: - `Call to ${nodeExp.expression.text}.init() must be declared with property {version: 2}`, + `Call to ${importedVarName}.init() must be declared with property {apiVersion: 2}`, }); } } From cc10209cd91dd97d81dec99dc1aa14bebcc0b64a Mon Sep 17 00:00:00 2001 From: Yavor Ivanov Date: Fri, 15 Mar 2024 16:28:19 +0200 Subject: [PATCH 04/36] feat: Add tests --- .../src/main/js/library.js | 22 +++++++- test/lib/linter/snapshots/linter.ts.md | 52 ++++++++++++++++++- 2 files changed, 70 insertions(+), 4 deletions(-) diff --git a/test/fixtures/linter/projects/library.with.custom.paths/src/main/js/library.js b/test/fixtures/linter/projects/library.with.custom.paths/src/main/js/library.js index d31c50a3..5bc19ad9 100644 --- a/test/fixtures/linter/projects/library.with.custom.paths/src/main/js/library.js +++ b/test/fixtures/linter/projects/library.with.custom.paths/src/main/js/library.js @@ -6,10 +6,28 @@ * Initialization Code and shared classes of library library.with.custom.paths. */ sap.ui.define([ - "sap/ui/core/library" -], function () { + "sap/ui/core/library", + "sap/ui/core/Lib", +], function (coreLib, Library) { "use strict"; + Library.init(); + Library.init("a"); + Library.init({}); + Library.init({ + test: 12 + }); + Library.init({ + apiVersion: "23" + }); + Library.init({ + apiVersion: 11 + }); + Library.init({ + apiVersion: 2 + }); + + // delegate further initialization of this library to the Core // Hint: sap.ui.getCore() must still be used to support preload with sync bootstrap! sap.ui.getCore().initLibrary({ diff --git a/test/lib/linter/snapshots/linter.ts.md b/test/lib/linter/snapshots/linter.ts.md index 64d85ed8..b3ebc3ea 100644 --- a/test/lib/linter/snapshots/linter.ts.md +++ b/test/lib/linter/snapshots/linter.ts.md @@ -900,14 +900,62 @@ Generated by [AVA](https://avajs.dev). }, { coverageInfo: [], - errorCount: 2, + errorCount: 8, fatalErrorCount: 0, filePath: 'src/main/js/library.js', messages: [ + { + column: 2, + fatal: undefined, + line: 14, + message: 'Call to Library.init() must be declared with property {apiVersion: 2}', + ruleId: 'ui5-linter-no-partially-deprecated-api', + severity: 2, + }, { column: 2, fatal: undefined, line: 15, + message: 'Call to Library.init() must be declared with property {apiVersion: 2}', + ruleId: 'ui5-linter-no-partially-deprecated-api', + severity: 2, + }, + { + column: 2, + fatal: undefined, + line: 16, + message: 'Call to Library.init() must be declared with property {apiVersion: 2}', + ruleId: 'ui5-linter-no-partially-deprecated-api', + severity: 2, + }, + { + column: 2, + fatal: undefined, + line: 17, + message: 'Call to Library.init() must be declared with property {apiVersion: 2}', + ruleId: 'ui5-linter-no-partially-deprecated-api', + severity: 2, + }, + { + column: 3, + fatal: undefined, + line: 21, + message: 'Call to Library.init() must be declared with property {apiVersion: 2}', + ruleId: 'ui5-linter-no-partially-deprecated-api', + severity: 2, + }, + { + column: 3, + fatal: undefined, + line: 24, + message: 'Call to Library.init() must be declared with property {apiVersion: 2}', + ruleId: 'ui5-linter-no-partially-deprecated-api', + severity: 2, + }, + { + column: 2, + fatal: undefined, + line: 33, message: 'Call to deprecated function \'initLibrary\' of class \'Core\'', messageDetails: 'Deprecated test message', ruleId: 'ui5-linter-no-deprecated-api', @@ -916,7 +964,7 @@ Generated by [AVA](https://avajs.dev). { column: 2, fatal: undefined, - line: 15, + line: 33, message: 'Call to deprecated function \'getCore\' (sap.ui.getCore)', messageDetails: 'Deprecated test message', ruleId: 'ui5-linter-no-deprecated-api', From 4fa1096e40d3792cc5de710f64d7ac6706a2fa4f Mon Sep 17 00:00:00 2001 From: Yavor Ivanov Date: Mon, 18 Mar 2024 10:17:16 +0200 Subject: [PATCH 05/36] fix: Provide better ts types --- src/detectors/typeChecker/FileLinter.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/detectors/typeChecker/FileLinter.ts b/src/detectors/typeChecker/FileLinter.ts index 2e3ab484..9dc1d050 100644 --- a/src/detectors/typeChecker/FileLinter.ts +++ b/src/detectors/typeChecker/FileLinter.ts @@ -241,12 +241,14 @@ export default class FileLinter { checkLibInitCall(node: ts.CallExpression) { const nodeExp = node.expression as ts.PropertyAccessExpression; const {symbol} = this.#checker.getTypeAtLocation(nodeExp); + const importDeclaration = + ((((symbol as unknown) as ts.Node)?.parent?.parent as unknown) as ts.Symbol)?.getEscapedName() as string; - if (symbol?.parent?.parent?.getEscapedName() !== "\"sap/ui/core/Lib\"") { + if (importDeclaration !== "\"sap/ui/core/Lib\"") { return; } - const importedVarName = nodeExp.name.parent.expression.getText()!; + const importedVarName = ((nodeExp.name.parent as unknown) as ts.CallExpression).expression.getText(); const fnArg = this.getFnArgument(node, { callExpressionName: "init", // Method's name callExpressionPropName: importedVarName, From c310c64534bba4da9601a4dbc74e75a37ebbe036 Mon Sep 17 00:00:00 2001 From: Yavor Ivanov Date: Mon, 18 Mar 2024 10:38:21 +0200 Subject: [PATCH 06/36] fix: Add docs and enhance tests --- src/detectors/typeChecker/FileLinter.ts | 16 +++++++++++++++- .../src/main/js/library.js | 5 +++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/src/detectors/typeChecker/FileLinter.ts b/src/detectors/typeChecker/FileLinter.ts index 9dc1d050..3fce583f 100644 --- a/src/detectors/typeChecker/FileLinter.ts +++ b/src/detectors/typeChecker/FileLinter.ts @@ -212,6 +212,20 @@ export default class FileLinter { }); } + /** + * Gets arguments from a CallExpression. + * + * It could be the N-th argument from the call or it could + * find a named argument within argument's list. + * The callable function should have the following + * + * @param {ts.CallExpression} node + * @param {object} settings + * @param {string} settings.callExpressionName Method's name + * @param {string} settings.callExpressionPropName Object's instance name + * @param {string|number} settings.fnArgument The N-th argument or argument's name + * @returns + */ getFnArgument(node: ts.CallExpression, settings: { callExpressionName: string; callExpressionPropName: string; @@ -223,7 +237,7 @@ export default class FileLinter { !ts.isIdentifier(nodeExp.expression) || nodeExp?.expression?.text !== settings.callExpressionPropName) { // Didn't match Instance.call(), so we're not interested anymore of analyzing it. - return; + return "zzzz"; } let fnArgumentNode; diff --git a/test/fixtures/linter/projects/library.with.custom.paths/src/main/js/library.js b/test/fixtures/linter/projects/library.with.custom.paths/src/main/js/library.js index 5bc19ad9..8beea433 100644 --- a/test/fixtures/linter/projects/library.with.custom.paths/src/main/js/library.js +++ b/test/fixtures/linter/projects/library.with.custom.paths/src/main/js/library.js @@ -27,6 +27,11 @@ sap.ui.define([ apiVersion: 2 }); + // Should ignore + Library.anotherLibMethod({ + apiVersion: 23 + }) + // delegate further initialization of this library to the Core // Hint: sap.ui.getCore() must still be used to support preload with sync bootstrap! From 03bb267264475ef8681cf174f630717211d8d194 Mon Sep 17 00:00:00 2001 From: Yavor Ivanov Date: Mon, 18 Mar 2024 10:49:08 +0200 Subject: [PATCH 07/36] fix: Include only Lib's init() method into the analysis --- src/detectors/typeChecker/FileLinter.ts | 8 ++++---- .../library.with.custom.paths/src/main/js/library.js | 4 ++-- test/lib/linter/snapshots/linter.ts.md | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/detectors/typeChecker/FileLinter.ts b/src/detectors/typeChecker/FileLinter.ts index 3fce583f..7a7b2bcc 100644 --- a/src/detectors/typeChecker/FileLinter.ts +++ b/src/detectors/typeChecker/FileLinter.ts @@ -237,7 +237,7 @@ export default class FileLinter { !ts.isIdentifier(nodeExp.expression) || nodeExp?.expression?.text !== settings.callExpressionPropName) { // Didn't match Instance.call(), so we're not interested anymore of analyzing it. - return "zzzz"; + return; } let fnArgumentNode; @@ -249,7 +249,7 @@ export default class FileLinter { fnArgumentNode = node.arguments.find((arg: ts.Expression) => arg.kind === ts.SyntaxKind.Identifier && arg.getText() === settings.fnArgument); } - return fnArgumentNode; + return fnArgumentNode || null; } checkLibInitCall(node: ts.CallExpression) { @@ -271,9 +271,9 @@ export default class FileLinter { let libVersion; - if (!fnArg) { + if (fnArg === null) { // The method is init, but nor argument has been found libVersion = node; - } else { + } else if (fnArg) { const apiKeyProp = (fnArg as ts.ObjectLiteralExpression) .properties?.find((prop: ts.ObjectLiteralElementLike) => { return ts.isPropertyAssignment(prop) && diff --git a/test/fixtures/linter/projects/library.with.custom.paths/src/main/js/library.js b/test/fixtures/linter/projects/library.with.custom.paths/src/main/js/library.js index 8beea433..558d332e 100644 --- a/test/fixtures/linter/projects/library.with.custom.paths/src/main/js/library.js +++ b/test/fixtures/linter/projects/library.with.custom.paths/src/main/js/library.js @@ -27,8 +27,8 @@ sap.ui.define([ apiVersion: 2 }); - // Should ignore - Library.anotherLibMethod({ + // Should be ignored + Library.load({ apiVersion: 23 }) diff --git a/test/lib/linter/snapshots/linter.ts.md b/test/lib/linter/snapshots/linter.ts.md index b3ebc3ea..75d04cb9 100644 --- a/test/lib/linter/snapshots/linter.ts.md +++ b/test/lib/linter/snapshots/linter.ts.md @@ -955,7 +955,7 @@ Generated by [AVA](https://avajs.dev). { column: 2, fatal: undefined, - line: 33, + line: 38, message: 'Call to deprecated function \'initLibrary\' of class \'Core\'', messageDetails: 'Deprecated test message', ruleId: 'ui5-linter-no-deprecated-api', @@ -964,7 +964,7 @@ Generated by [AVA](https://avajs.dev). { column: 2, fatal: undefined, - line: 33, + line: 38, message: 'Call to deprecated function \'getCore\' (sap.ui.getCore)', messageDetails: 'Deprecated test message', ruleId: 'ui5-linter-no-deprecated-api', From bd50889b86d08cdc54b8c6a0f167fe99b472d97f Mon Sep 17 00:00:00 2001 From: Yavor Ivanov Date: Mon, 18 Mar 2024 11:23:01 +0200 Subject: [PATCH 08/36] fix: Update doc --- src/detectors/typeChecker/FileLinter.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/detectors/typeChecker/FileLinter.ts b/src/detectors/typeChecker/FileLinter.ts index 7a7b2bcc..b80b6992 100644 --- a/src/detectors/typeChecker/FileLinter.ts +++ b/src/detectors/typeChecker/FileLinter.ts @@ -217,7 +217,8 @@ export default class FileLinter { * * It could be the N-th argument from the call or it could * find a named argument within argument's list. - * The callable function should have the following + * The callable function should be a method of an instance i.e. + * Instance.fnInvoke(); * * @param {ts.CallExpression} node * @param {object} settings From 7dbab5a871e48504f2fcf401ccf3ee173580d1cb Mon Sep 17 00:00:00 2001 From: Yavor Ivanov Date: Mon, 18 Mar 2024 11:29:08 +0200 Subject: [PATCH 09/36] fix: Eslint issues --- src/detectors/typeChecker/FileLinter.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/detectors/typeChecker/FileLinter.ts b/src/detectors/typeChecker/FileLinter.ts index b80b6992..266da4a6 100644 --- a/src/detectors/typeChecker/FileLinter.ts +++ b/src/detectors/typeChecker/FileLinter.ts @@ -250,12 +250,15 @@ export default class FileLinter { fnArgumentNode = node.arguments.find((arg: ts.Expression) => arg.kind === ts.SyntaxKind.Identifier && arg.getText() === settings.fnArgument); } - return fnArgumentNode || null; + return fnArgumentNode ?? null; } checkLibInitCall(node: ts.CallExpression) { const nodeExp = node.expression as ts.PropertyAccessExpression; const {symbol} = this.#checker.getTypeAtLocation(nodeExp); + // TS parser uses some intermediate types that are not available as definitions. + // In this case SymbolObject which is a ts.Symbol + ts.Node and that's + // why we need these ugly type castings const importDeclaration = ((((symbol as unknown) as ts.Node)?.parent?.parent as unknown) as ts.Symbol)?.getEscapedName() as string; From c9d25a7538c7cef82a8333981a0b32e5ede11dd6 Mon Sep 17 00:00:00 2001 From: Yavor Ivanov Date: Mon, 18 Mar 2024 11:32:32 +0200 Subject: [PATCH 10/36] fix: Eslint --- src/detectors/typeChecker/FileLinter.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/detectors/typeChecker/FileLinter.ts b/src/detectors/typeChecker/FileLinter.ts index 266da4a6..64d6e666 100644 --- a/src/detectors/typeChecker/FileLinter.ts +++ b/src/detectors/typeChecker/FileLinter.ts @@ -257,7 +257,7 @@ export default class FileLinter { const nodeExp = node.expression as ts.PropertyAccessExpression; const {symbol} = this.#checker.getTypeAtLocation(nodeExp); // TS parser uses some intermediate types that are not available as definitions. - // In this case SymbolObject which is a ts.Symbol + ts.Node and that's + // In this case SymbolObject which is a ts.Symbol + ts.Node and that's // why we need these ugly type castings const importDeclaration = ((((symbol as unknown) as ts.Node)?.parent?.parent as unknown) as ts.Symbol)?.getEscapedName() as string; From eb087e0402932f3d7096b1ddaacfb7c0f47b54d8 Mon Sep 17 00:00:00 2001 From: Yavor Ivanov Date: Tue, 19 Mar 2024 14:29:22 +0200 Subject: [PATCH 11/36] fix: Typos MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Matthias Oßwald --- src/detectors/typeChecker/FileLinter.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/detectors/typeChecker/FileLinter.ts b/src/detectors/typeChecker/FileLinter.ts index 64d6e666..840897c8 100644 --- a/src/detectors/typeChecker/FileLinter.ts +++ b/src/detectors/typeChecker/FileLinter.ts @@ -55,7 +55,7 @@ export default class FileLinter { // const nodeType = this.#checker.getTypeAtLocation(node); this.analyzePropertyAccessExpression(node as ts.CallExpression); // Check for global this.analyzeCallExpression(node as ts.CallExpression); // Check for deprecation - this.checkLibInitCall(node as ts.CallExpression); // Check for sap.ui.coreLib.init usages + this.checkLibInitCall(node as ts.CallExpression); // Check for sap/ui/core/Lib.init usages } else if (node.kind === ts.SyntaxKind.PropertyAccessExpression || node.kind === ts.SyntaxKind.ElementAccessExpression) { this.analyzePropertyAccessExpression( From 6444db0f16fc00b200ade289412eb7393698e904 Mon Sep 17 00:00:00 2001 From: Yavor Ivanov Date: Tue, 19 Mar 2024 14:29:29 +0200 Subject: [PATCH 12/36] fix: Typos MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Matthias Oßwald --- src/detectors/typeChecker/FileLinter.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/detectors/typeChecker/FileLinter.ts b/src/detectors/typeChecker/FileLinter.ts index 840897c8..c9140338 100644 --- a/src/detectors/typeChecker/FileLinter.ts +++ b/src/detectors/typeChecker/FileLinter.ts @@ -275,7 +275,7 @@ export default class FileLinter { let libVersion; - if (fnArg === null) { // The method is init, but nor argument has been found + if (fnArg === null) { // The method is init, but no argument has been found libVersion = node; } else if (fnArg) { const apiKeyProp = (fnArg as ts.ObjectLiteralExpression) From 6dd8540154f6753059ef40fb0a51f7a26eb3e88d Mon Sep 17 00:00:00 2001 From: Yavor Ivanov Date: Tue, 19 Mar 2024 14:37:58 +0200 Subject: [PATCH 13/36] fix: Rename var --- src/detectors/typeChecker/FileLinter.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/detectors/typeChecker/FileLinter.ts b/src/detectors/typeChecker/FileLinter.ts index c9140338..63e7b43a 100644 --- a/src/detectors/typeChecker/FileLinter.ts +++ b/src/detectors/typeChecker/FileLinter.ts @@ -273,10 +273,10 @@ export default class FileLinter { fnArgument: 0, // Lib.init() we're interested only in the first arg }); - let libVersion; + let nodeToHighlight; if (fnArg === null) { // The method is init, but no argument has been found - libVersion = node; + nodeToHighlight = node; } else if (fnArg) { const apiKeyProp = (fnArg as ts.ObjectLiteralExpression) .properties?.find((prop: ts.ObjectLiteralElementLike) => { @@ -285,16 +285,16 @@ export default class FileLinter { }) as ts.PropertyAssignment | undefined; if (!apiKeyProp) { // no apiVersion key at all - libVersion = node; + nodeToHighlight = node; } else if (ts.isLiteralExpression(apiKeyProp.initializer) && apiKeyProp.initializer.text !== "2") { // Checks the value itself - libVersion = apiKeyProp; + nodeToHighlight = apiKeyProp; } } - if (libVersion) { + if (nodeToHighlight) { this.#reporter.addMessage({ - node: libVersion, + node: nodeToHighlight, severity: LintMessageSeverity.Error, ruleId: "ui5-linter-no-partially-deprecated-api", message: From 7fcad3d7b9a9a451df516f2df65c3c965ba80bc8 Mon Sep 17 00:00:00 2001 From: Yavor Ivanov Date: Wed, 20 Mar 2024 16:32:13 +0200 Subject: [PATCH 14/36] refactor: Lib.init analyzer --- src/detectors/typeChecker/FileLinter.ts | 102 ++++++++---------- .../src/main/js/library.js | 3 + 2 files changed, 47 insertions(+), 58 deletions(-) diff --git a/src/detectors/typeChecker/FileLinter.ts b/src/detectors/typeChecker/FileLinter.ts index 63e7b43a..56fe6a7e 100644 --- a/src/detectors/typeChecker/FileLinter.ts +++ b/src/detectors/typeChecker/FileLinter.ts @@ -55,7 +55,7 @@ export default class FileLinter { // const nodeType = this.#checker.getTypeAtLocation(node); this.analyzePropertyAccessExpression(node as ts.CallExpression); // Check for global this.analyzeCallExpression(node as ts.CallExpression); // Check for deprecation - this.checkLibInitCall(node as ts.CallExpression); // Check for sap/ui/core/Lib.init usages + this.analyzeLibInitCall(node as ts.CallExpression); // Check for sap/ui/core/Lib.init usages } else if (node.kind === ts.SyntaxKind.PropertyAccessExpression || node.kind === ts.SyntaxKind.ElementAccessExpression) { this.analyzePropertyAccessExpression( @@ -211,88 +211,74 @@ export default class FileLinter { messageDetails: deprecationInfo.messageDetails, }); } - + /** - * Gets arguments from a CallExpression. - * - * It could be the N-th argument from the call or it could - * find a named argument within argument's list. - * The callable function should be a method of an instance i.e. - * Instance.fnInvoke(); + * Extracts & builds object literal * - * @param {ts.CallExpression} node - * @param {object} settings - * @param {string} settings.callExpressionName Method's name - * @param {string} settings.callExpressionPropName Object's instance name - * @param {string|number} settings.fnArgument The N-th argument or argument's name - * @returns + * @param node + * @returns {object} */ - getFnArgument(node: ts.CallExpression, settings: { - callExpressionName: string; - callExpressionPropName: string; - fnArgument: string | number; // Get N-th argument or argument by its name - }) { - const nodeExp = node.expression as ts.PropertyAccessExpression; - if (nodeExp?.name?.text !== settings.callExpressionName || - !ts.isPropertyAccessExpression(nodeExp) || - !ts.isIdentifier(nodeExp.expression) || - nodeExp?.expression?.text !== settings.callExpressionPropName) { - // Didn't match Instance.call(), so we're not interested anymore of analyzing it. - return; - } + extractPropsRecursive = (node: ts.ObjectLiteralExpression) => { + const properties: Record = Object.create(null); - let fnArgumentNode; + node.properties?.forEach((prop) => { + if (!ts.isPropertyAssignment(prop) || !prop.name) { + return; + } - if (typeof settings.fnArgument === "number") { // Get N-th arg - fnArgumentNode = node.arguments[settings.fnArgument]; - } else { - // Arg by name - fnArgumentNode = node.arguments.find((arg: ts.Expression) => - arg.kind === ts.SyntaxKind.Identifier && arg.getText() === settings.fnArgument); - } - return fnArgumentNode ?? null; + const key = prop.name.getText(); + if (prop.initializer.kind === ts.SyntaxKind.FalseKeyword) { + properties[key] = {value: false, node: prop.initializer}; + } else if (prop.initializer.kind === ts.SyntaxKind.NullKeyword) { + properties[key] = {value: null, node: prop.initializer}; + } if (ts.isObjectLiteralExpression(prop.initializer) && prop.initializer.properties) { + properties[key] = { value: this.extractPropsRecursive(prop.initializer), node: prop.initializer }; + } else if ( + (ts.isIdentifier(prop.initializer) || + ts.isNumericLiteral(prop.initializer) || + ts.isStringLiteral(prop.initializer)) + + && prop.initializer.text) { + properties[key] = {value: prop.initializer.getText(), node: prop.initializer}; + } + }); + return properties; } - checkLibInitCall(node: ts.CallExpression) { + analyzeLibInitCall(node: ts.CallExpression) { const nodeExp = node.expression as ts.PropertyAccessExpression; const {symbol} = this.#checker.getTypeAtLocation(nodeExp); + const methodName = symbol && symbol.getName(); + // TS parser uses some intermediate types that are not available as definitions. // In this case SymbolObject which is a ts.Symbol + ts.Node and that's // why we need these ugly type castings const importDeclaration = - ((((symbol as unknown) as ts.Node)?.parent?.parent as unknown) as ts.Symbol)?.getEscapedName() as string; + ((((symbol as unknown) as ts.Node)?.parent?.parent as unknown) as ts.Symbol)?.getName() as string; - if (importDeclaration !== "\"sap/ui/core/Lib\"") { + if (importDeclaration !== "\"sap/ui/core/Lib\"" || methodName !== "init") { return; } - const importedVarName = ((nodeExp.name.parent as unknown) as ts.CallExpression).expression.getText(); - const fnArg = this.getFnArgument(node, { - callExpressionName: "init", // Method's name - callExpressionPropName: importedVarName, - fnArgument: 0, // Lib.init() we're interested only in the first arg - }); + const initArg = node.arguments[0] as ts.ObjectLiteralExpression; let nodeToHighlight; - if (fnArg === null) { // The method is init, but no argument has been found + if (!initArg) { nodeToHighlight = node; - } else if (fnArg) { - const apiKeyProp = (fnArg as ts.ObjectLiteralExpression) - .properties?.find((prop: ts.ObjectLiteralElementLike) => { - return ts.isPropertyAssignment(prop) && - ts.isIdentifier(prop.name) && prop.name.text === "apiVersion"; - }) as ts.PropertyAssignment | undefined; - - if (!apiKeyProp) { // no apiVersion key at all - nodeToHighlight = node; - } else if (ts.isLiteralExpression(apiKeyProp.initializer) && apiKeyProp.initializer.text !== "2") { - // Checks the value itself - nodeToHighlight = apiKeyProp; + } else { + const apiKeyProp = this.extractPropsRecursive(initArg); + + if (!apiKeyProp["apiVersion"]) { + nodeToHighlight = node; + } else if (apiKeyProp["apiVersion"].value !== "2") { // String value would be "\"2\"" + nodeToHighlight = apiKeyProp["apiVersion"].node; } } if (nodeToHighlight) { + const importedVarName = ((nodeExp.name.parent as unknown) as ts.CallExpression).expression.getText(); + this.#reporter.addMessage({ node: nodeToHighlight, severity: LintMessageSeverity.Error, diff --git a/test/fixtures/linter/projects/library.with.custom.paths/src/main/js/library.js b/test/fixtures/linter/projects/library.with.custom.paths/src/main/js/library.js index 558d332e..83159d23 100644 --- a/test/fixtures/linter/projects/library.with.custom.paths/src/main/js/library.js +++ b/test/fixtures/linter/projects/library.with.custom.paths/src/main/js/library.js @@ -23,6 +23,9 @@ sap.ui.define([ Library.init({ apiVersion: 11 }); + Library.init({ + apiVersion: "2" + }); Library.init({ apiVersion: 2 }); From 6675826075db10534470cb81c9ddba646a849f33 Mon Sep 17 00:00:00 2001 From: Yavor Ivanov Date: Thu, 21 Mar 2024 09:09:23 +0200 Subject: [PATCH 15/36] fix: Lint & snapshots --- src/detectors/typeChecker/FileLinter.ts | 37 ++++++++++++------------- test/lib/linter/snapshots/linter.ts.md | 18 ++++++++---- 2 files changed, 31 insertions(+), 24 deletions(-) diff --git a/src/detectors/typeChecker/FileLinter.ts b/src/detectors/typeChecker/FileLinter.ts index 56fe6a7e..26265ba4 100644 --- a/src/detectors/typeChecker/FileLinter.ts +++ b/src/detectors/typeChecker/FileLinter.ts @@ -211,15 +211,16 @@ export default class FileLinter { messageDetails: deprecationInfo.messageDetails, }); } - + /** * Extracts & builds object literal * - * @param node + * @param node * @returns {object} */ extractPropsRecursive = (node: ts.ObjectLiteralExpression) => { - const properties: Record = Object.create(null); + type propsType = Record; + const properties = Object.create(null) as propsType; node.properties?.forEach((prop) => { if (!ts.isPropertyAssignment(prop) || !prop.name) { @@ -231,30 +232,28 @@ export default class FileLinter { properties[key] = {value: false, node: prop.initializer}; } else if (prop.initializer.kind === ts.SyntaxKind.NullKeyword) { properties[key] = {value: null, node: prop.initializer}; - } if (ts.isObjectLiteralExpression(prop.initializer) && prop.initializer.properties) { - properties[key] = { value: this.extractPropsRecursive(prop.initializer), node: prop.initializer }; - } else if ( - (ts.isIdentifier(prop.initializer) || - ts.isNumericLiteral(prop.initializer) || - ts.isStringLiteral(prop.initializer)) - - && prop.initializer.text) { + } else if (ts.isObjectLiteralExpression(prop.initializer) && prop.initializer.properties) { + properties[key] = {value: this.extractPropsRecursive(prop.initializer), node: prop.initializer}; + } else if ((ts.isIdentifier(prop.initializer) || + ts.isNumericLiteral(prop.initializer) || + ts.isStringLiteral(prop.initializer)) && + prop.initializer.text) { properties[key] = {value: prop.initializer.getText(), node: prop.initializer}; } }); return properties; - } + }; analyzeLibInitCall(node: ts.CallExpression) { const nodeExp = node.expression as ts.PropertyAccessExpression; const {symbol} = this.#checker.getTypeAtLocation(nodeExp); - const methodName = symbol && symbol.getName(); - + const methodName = symbol?.getName(); + // TS parser uses some intermediate types that are not available as definitions. // In this case SymbolObject which is a ts.Symbol + ts.Node and that's // why we need these ugly type castings const importDeclaration = - ((((symbol as unknown) as ts.Node)?.parent?.parent as unknown) as ts.Symbol)?.getName() as string; + ((((symbol as unknown) as ts.Node)?.parent?.parent as unknown) as ts.Symbol)?.getName(); if (importDeclaration !== "\"sap/ui/core/Lib\"" || methodName !== "init") { return; @@ -269,10 +268,10 @@ export default class FileLinter { } else { const apiKeyProp = this.extractPropsRecursive(initArg); - if (!apiKeyProp["apiVersion"]) { - nodeToHighlight = node; - } else if (apiKeyProp["apiVersion"].value !== "2") { // String value would be "\"2\"" - nodeToHighlight = apiKeyProp["apiVersion"].node; + if (!apiKeyProp.apiVersion) { + nodeToHighlight = node; + } else if (apiKeyProp.apiVersion.value !== "2") { // String value would be "\"2\"" + nodeToHighlight = apiKeyProp.apiVersion.node; } } diff --git a/test/lib/linter/snapshots/linter.ts.md b/test/lib/linter/snapshots/linter.ts.md index 75d04cb9..cdbc22a7 100644 --- a/test/lib/linter/snapshots/linter.ts.md +++ b/test/lib/linter/snapshots/linter.ts.md @@ -900,7 +900,7 @@ Generated by [AVA](https://avajs.dev). }, { coverageInfo: [], - errorCount: 8, + errorCount: 9, fatalErrorCount: 0, filePath: 'src/main/js/library.js', messages: [ @@ -937,7 +937,7 @@ Generated by [AVA](https://avajs.dev). severity: 2, }, { - column: 3, + column: 15, fatal: undefined, line: 21, message: 'Call to Library.init() must be declared with property {apiVersion: 2}', @@ -945,17 +945,25 @@ Generated by [AVA](https://avajs.dev). severity: 2, }, { - column: 3, + column: 15, fatal: undefined, line: 24, message: 'Call to Library.init() must be declared with property {apiVersion: 2}', ruleId: 'ui5-linter-no-partially-deprecated-api', severity: 2, }, + { + column: 15, + fatal: undefined, + line: 27, + message: 'Call to Library.init() must be declared with property {apiVersion: 2}', + ruleId: 'ui5-linter-no-partially-deprecated-api', + severity: 2, + }, { column: 2, fatal: undefined, - line: 38, + line: 41, message: 'Call to deprecated function \'initLibrary\' of class \'Core\'', messageDetails: 'Deprecated test message', ruleId: 'ui5-linter-no-deprecated-api', @@ -964,7 +972,7 @@ Generated by [AVA](https://avajs.dev). { column: 2, fatal: undefined, - line: 38, + line: 41, message: 'Call to deprecated function \'getCore\' (sap.ui.getCore)', messageDetails: 'Deprecated test message', ruleId: 'ui5-linter-no-deprecated-api', From 8e99eb65a13dffb8909f7f3f7c2e5201c2e0e450 Mon Sep 17 00:00:00 2001 From: Yavor Ivanov Date: Thu, 21 Mar 2024 09:12:58 +0200 Subject: [PATCH 16/36] fix: Merge conflicts --- test/lib/linter/snapshots/linter.ts.snap | Bin 7509 -> 7838 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/test/lib/linter/snapshots/linter.ts.snap b/test/lib/linter/snapshots/linter.ts.snap index 7bd19f66763824b11328dd95e719d98c199aa26e..8a4ca01c983f535ad0984c2248a5b1c3cab795ec 100644 GIT binary patch literal 7838 zcmV;P9%11@RzVdLQZ`jxU5!+RBq5bc(ivHzzyNRvxEXi|cn+wNAS`7HD%r93QZ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JKE~$nuRl~j2 z@T7Q^O{I&(s)0*u;OjN;Pz^jUUSZ>ooOekr^w+}mweUbKJS$#ZNH1TCtm%{C7-)yQjgE)8Lh9;I9`*Cc8*(sfTaX!%ynr-|K*Y*!i`6 z2AtCmY37Z-NbX5E6w?lbTCxrw;|qkiWpo^en54s{ih35$y1`^vj%1&XvlNKb`OMEP zA_YfEAqCOF5N}3b#Q7Bt^$l#(_U$s%ZtY;kz}&3$^v1QGUTd8FAqwFk#>X2M_xTax zG0rd)QV#QrjEMs!(hVCEu_2maV z|AdW@g+*BJFNt>4vk`C{?Wmh-+Ey5w&sX&*_dALl^_Dgjb5q)uUIZH&N%2GF0XAB< zr6N&3ifkom2`!85Ni;`*=1G6Lk{x>cutv!oKR@FlTj-w3Qk-T<#+9hLE;DJ`$AmJ5 zbmpjmZEUs6p{#YC_M4B|A7Jg-lFsK?B=;ebE|N3^M|$;uny~V{>6N%@Sn0?1xJkzs z3^!+-(uT$VA3h f6?KzMX_<>R(_s$>qZ^*M1N;92&{WBMpsN4?3d6>s From 882d22082230eb3320a9c22a03a63d791d440d22 Mon Sep 17 00:00:00 2001 From: Matthias Osswald Date: Thu, 21 Mar 2024 13:24:42 +0100 Subject: [PATCH 17/36] refactor: Check name of ModuleDeclaration instead of ImportDeclaration --- src/detectors/typeChecker/FileLinter.ts | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/src/detectors/typeChecker/FileLinter.ts b/src/detectors/typeChecker/FileLinter.ts index 26265ba4..a4412c1e 100644 --- a/src/detectors/typeChecker/FileLinter.ts +++ b/src/detectors/typeChecker/FileLinter.ts @@ -244,18 +244,27 @@ export default class FileLinter { return properties; }; + getSymbolModuleDeclaration(symbol: ts.Symbol) { + let parent = symbol.valueDeclaration?.parent; + while (parent && !ts.isModuleDeclaration(parent)) { + parent = parent.parent; + } + return parent; + } + analyzeLibInitCall(node: ts.CallExpression) { const nodeExp = node.expression as ts.PropertyAccessExpression; const {symbol} = this.#checker.getTypeAtLocation(nodeExp); + if (!symbol) { + return; + } const methodName = symbol?.getName(); + if (methodName !== "init") { + return; + } - // TS parser uses some intermediate types that are not available as definitions. - // In this case SymbolObject which is a ts.Symbol + ts.Node and that's - // why we need these ugly type castings - const importDeclaration = - ((((symbol as unknown) as ts.Node)?.parent?.parent as unknown) as ts.Symbol)?.getName(); - - if (importDeclaration !== "\"sap/ui/core/Lib\"" || methodName !== "init") { + const moduleDeclaration = this.getSymbolModuleDeclaration(symbol); + if (moduleDeclaration?.name.text !== "sap/ui/core/Lib") { return; } From 64cda85236727a124ea0aaa52be7eabdd1f0655a Mon Sep 17 00:00:00 2001 From: Yavor Ivanov Date: Thu, 21 Mar 2024 15:08:16 +0200 Subject: [PATCH 18/36] refactor: Better types for Lib.init() analyzer --- src/detectors/typeChecker/FileLinter.ts | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/src/detectors/typeChecker/FileLinter.ts b/src/detectors/typeChecker/FileLinter.ts index a4412c1e..075ec4cc 100644 --- a/src/detectors/typeChecker/FileLinter.ts +++ b/src/detectors/typeChecker/FileLinter.ts @@ -253,22 +253,20 @@ export default class FileLinter { } analyzeLibInitCall(node: ts.CallExpression) { - const nodeExp = node.expression as ts.PropertyAccessExpression; - const {symbol} = this.#checker.getTypeAtLocation(nodeExp); - if (!symbol) { - return; - } - const methodName = symbol?.getName(); - if (methodName !== "init") { + const nodeExp = (ts.isPropertyAccessExpression(node.expression) || + ts.isElementAccessExpression(node.expression)) && node.expression; + const nodeType = nodeExp && this.#checker.getTypeAtLocation(nodeExp); + if (!nodeType || nodeType.symbol?.getName() !== "init") { return; } - const moduleDeclaration = this.getSymbolModuleDeclaration(symbol); + const moduleDeclaration = this.getSymbolModuleDeclaration(nodeType.symbol); if (moduleDeclaration?.name.text !== "sap/ui/core/Lib") { return; } - const initArg = node.arguments[0] as ts.ObjectLiteralExpression; + const initArg = node?.arguments[0] && + ts.isObjectLiteralExpression(node.arguments[0]) && node.arguments[0]; let nodeToHighlight; @@ -285,7 +283,7 @@ export default class FileLinter { } if (nodeToHighlight) { - const importedVarName = ((nodeExp.name.parent as unknown) as ts.CallExpression).expression.getText(); + const importedVarName = node.expression.expression.getText() this.#reporter.addMessage({ node: nodeToHighlight, From 0bbf0c415b662ddbbcfa0532ce24caca411d9e92 Mon Sep 17 00:00:00 2001 From: Yavor Ivanov Date: Thu, 21 Mar 2024 15:14:17 +0200 Subject: [PATCH 19/36] fix: Eslint issues --- src/detectors/typeChecker/FileLinter.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/detectors/typeChecker/FileLinter.ts b/src/detectors/typeChecker/FileLinter.ts index 075ec4cc..01ab9e4f 100644 --- a/src/detectors/typeChecker/FileLinter.ts +++ b/src/detectors/typeChecker/FileLinter.ts @@ -253,7 +253,7 @@ export default class FileLinter { } analyzeLibInitCall(node: ts.CallExpression) { - const nodeExp = (ts.isPropertyAccessExpression(node.expression) || + const nodeExp = (ts.isPropertyAccessExpression(node.expression) || ts.isElementAccessExpression(node.expression)) && node.expression; const nodeType = nodeExp && this.#checker.getTypeAtLocation(nodeExp); if (!nodeType || nodeType.symbol?.getName() !== "init") { @@ -283,7 +283,7 @@ export default class FileLinter { } if (nodeToHighlight) { - const importedVarName = node.expression.expression.getText() + const importedVarName = node.expression.expression.getText(); this.#reporter.addMessage({ node: nodeToHighlight, From 04d53042ee39972b7e2b78f337edb6e325918033 Mon Sep 17 00:00:00 2001 From: Yavor Ivanov Date: Thu, 21 Mar 2024 15:16:10 +0200 Subject: [PATCH 20/36] refactor: Tests --- .../src/main/js/library.js | 30 +------- .../rules/NoDeprecatedApi/old_library.js | 36 +++++++++ .../rules/snapshots/NoDeprecatedApi.ts.md | 72 ++++++++++++++++++ test/lib/linter/snapshots/linter.ts.md | 60 +-------------- test/lib/linter/snapshots/linter.ts.snap | Bin 7838 -> 7509 bytes 5 files changed, 112 insertions(+), 86 deletions(-) create mode 100644 test/fixtures/linter/rules/NoDeprecatedApi/old_library.js diff --git a/test/fixtures/linter/projects/library.with.custom.paths/src/main/js/library.js b/test/fixtures/linter/projects/library.with.custom.paths/src/main/js/library.js index 83159d23..d31c50a3 100644 --- a/test/fixtures/linter/projects/library.with.custom.paths/src/main/js/library.js +++ b/test/fixtures/linter/projects/library.with.custom.paths/src/main/js/library.js @@ -6,36 +6,10 @@ * Initialization Code and shared classes of library library.with.custom.paths. */ sap.ui.define([ - "sap/ui/core/library", - "sap/ui/core/Lib", -], function (coreLib, Library) { + "sap/ui/core/library" +], function () { "use strict"; - Library.init(); - Library.init("a"); - Library.init({}); - Library.init({ - test: 12 - }); - Library.init({ - apiVersion: "23" - }); - Library.init({ - apiVersion: 11 - }); - Library.init({ - apiVersion: "2" - }); - Library.init({ - apiVersion: 2 - }); - - // Should be ignored - Library.load({ - apiVersion: 23 - }) - - // delegate further initialization of this library to the Core // Hint: sap.ui.getCore() must still be used to support preload with sync bootstrap! sap.ui.getCore().initLibrary({ diff --git a/test/fixtures/linter/rules/NoDeprecatedApi/old_library.js b/test/fixtures/linter/rules/NoDeprecatedApi/old_library.js new file mode 100644 index 00000000..f2f74903 --- /dev/null +++ b/test/fixtures/linter/rules/NoDeprecatedApi/old_library.js @@ -0,0 +1,36 @@ +/*! + * ${copyright} + */ + +/** + * Initialization Code and shared classes of library library.with.custom.paths. + */ +sap.ui.define([ + "sap/ui/core/Lib", +], function (Library) { + "use strict"; + + Library.init(); + Library.init("a"); + Library.init({}); + Library.init({ + test: 12 + }); + Library.init({ + apiVersion: "23" + }); + Library.init({ + apiVersion: 11 + }); + Library.init({ + apiVersion: "2" + }); + Library.init({ + apiVersion: 2 + }); + + // Should be ignored + Library.load({ + apiVersion: 23 + }); +}); diff --git a/test/lib/linter/rules/snapshots/NoDeprecatedApi.ts.md b/test/lib/linter/rules/snapshots/NoDeprecatedApi.ts.md index 12c97140..c403e3c8 100644 --- a/test/lib/linter/rules/snapshots/NoDeprecatedApi.ts.md +++ b/test/lib/linter/rules/snapshots/NoDeprecatedApi.ts.md @@ -1018,6 +1018,78 @@ Generated by [AVA](https://avajs.dev). }, ] +## General: old_library.js + +> Snapshot 1 + + [ + { + coverageInfo: [], + errorCount: 7, + fatalErrorCount: 0, + filePath: 'old_library.js', + messages: [ + { + column: 2, + fatal: undefined, + line: 13, + message: 'Call to Library.init() must be declared with property {apiVersion: 2}', + ruleId: 'ui5-linter-no-partially-deprecated-api', + severity: 2, + }, + { + column: 2, + fatal: undefined, + line: 14, + message: 'Call to Library.init() must be declared with property {apiVersion: 2}', + ruleId: 'ui5-linter-no-partially-deprecated-api', + severity: 2, + }, + { + column: 2, + fatal: undefined, + line: 15, + message: 'Call to Library.init() must be declared with property {apiVersion: 2}', + ruleId: 'ui5-linter-no-partially-deprecated-api', + severity: 2, + }, + { + column: 2, + fatal: undefined, + line: 16, + message: 'Call to Library.init() must be declared with property {apiVersion: 2}', + ruleId: 'ui5-linter-no-partially-deprecated-api', + severity: 2, + }, + { + column: 15, + fatal: undefined, + line: 20, + message: 'Call to Library.init() must be declared with property {apiVersion: 2}', + ruleId: 'ui5-linter-no-partially-deprecated-api', + severity: 2, + }, + { + column: 15, + fatal: undefined, + line: 23, + message: 'Call to Library.init() must be declared with property {apiVersion: 2}', + ruleId: 'ui5-linter-no-partially-deprecated-api', + severity: 2, + }, + { + column: 15, + fatal: undefined, + line: 26, + message: 'Call to Library.init() must be declared with property {apiVersion: 2}', + ruleId: 'ui5-linter-no-partially-deprecated-api', + severity: 2, + }, + ], + warningCount: 0, + }, + ] + ## General: sap.ui.jsview.js > Snapshot 1 diff --git a/test/lib/linter/snapshots/linter.ts.md b/test/lib/linter/snapshots/linter.ts.md index cdbc22a7..e9240493 100644 --- a/test/lib/linter/snapshots/linter.ts.md +++ b/test/lib/linter/snapshots/linter.ts.md @@ -900,7 +900,7 @@ Generated by [AVA](https://avajs.dev). }, { coverageInfo: [], - errorCount: 9, + errorCount: 2, fatalErrorCount: 0, filePath: 'src/main/js/library.js', messages: [ @@ -908,62 +908,6 @@ Generated by [AVA](https://avajs.dev). column: 2, fatal: undefined, line: 14, - message: 'Call to Library.init() must be declared with property {apiVersion: 2}', - ruleId: 'ui5-linter-no-partially-deprecated-api', - severity: 2, - }, - { - column: 2, - fatal: undefined, - line: 15, - message: 'Call to Library.init() must be declared with property {apiVersion: 2}', - ruleId: 'ui5-linter-no-partially-deprecated-api', - severity: 2, - }, - { - column: 2, - fatal: undefined, - line: 16, - message: 'Call to Library.init() must be declared with property {apiVersion: 2}', - ruleId: 'ui5-linter-no-partially-deprecated-api', - severity: 2, - }, - { - column: 2, - fatal: undefined, - line: 17, - message: 'Call to Library.init() must be declared with property {apiVersion: 2}', - ruleId: 'ui5-linter-no-partially-deprecated-api', - severity: 2, - }, - { - column: 15, - fatal: undefined, - line: 21, - message: 'Call to Library.init() must be declared with property {apiVersion: 2}', - ruleId: 'ui5-linter-no-partially-deprecated-api', - severity: 2, - }, - { - column: 15, - fatal: undefined, - line: 24, - message: 'Call to Library.init() must be declared with property {apiVersion: 2}', - ruleId: 'ui5-linter-no-partially-deprecated-api', - severity: 2, - }, - { - column: 15, - fatal: undefined, - line: 27, - message: 'Call to Library.init() must be declared with property {apiVersion: 2}', - ruleId: 'ui5-linter-no-partially-deprecated-api', - severity: 2, - }, - { - column: 2, - fatal: undefined, - line: 41, message: 'Call to deprecated function \'initLibrary\' of class \'Core\'', messageDetails: 'Deprecated test message', ruleId: 'ui5-linter-no-deprecated-api', @@ -972,7 +916,7 @@ Generated by [AVA](https://avajs.dev). { column: 2, fatal: undefined, - line: 41, + line: 14, message: 'Call to deprecated function \'getCore\' (sap.ui.getCore)', messageDetails: 'Deprecated test message', ruleId: 'ui5-linter-no-deprecated-api', diff --git a/test/lib/linter/snapshots/linter.ts.snap b/test/lib/linter/snapshots/linter.ts.snap index 8a4ca01c983f535ad0984c2248a5b1c3cab795ec..bfa35bfa06e50ffec1020832073db00effed4399 100644 GIT binary patch literal 7509 zcmV-b9jf9%RzV-_4}snb=bP95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r4Fnpu8-Ei({=D#9b8fmx75SW>jm=ZE<5%Q_3%bL%$W@l)zB z2Kbu>SUe9>^90g4F4B+AgB$0;*XP0G^WepKaIOqD$^|1ZenWfh6oA=?}xfFx(u52gC3WVo*-kEnq>t1rD^pjV*9*3p~~W zEsLOM5!^0D))eAEj(ZPWT>8mf(O6wzMdQzlum#>7*HznTEyoeYc{Yje;)T4-t}Vv? zzvVe%pMgm;ulGfqC*e>mzCYBOb^DoEAjFNs<2cGD9V%AryF}I*D#LOl`*eb(K%~xP zeqI47I9v=VhzxNzCgMH4<^+4inJCiWLeH*8GChG~Y4$=D>S#Kr=he@9V*y{HF zM!?nmlQu${3a~y<6z!;G;~?4EQ8U!EtuQ{%zp63rdKEbEFKsI1thOz^6goVf=G)8< zF#m?)Se@6zE)k*Kn1wb2VI-c6o8cC@&+-Ac`#+jcbTuYh8+bz-uLqS>e2=OdaV^;) zpL!@iHVcPilTvgut|StJCk{#lBIKMz$)>A0iP9)gDsTYp9fp!Paz=|%ffzz3QSy!= zaL`GVMrA&{-B6ksH+Io?|M*;sEXXqOz0K^Z$wBkv`HG?iL3pP|O`o`PX9Zj;J>|tX z-JD7&QFU$R^VvE!o>@}M96hy`T{`4YcAYJKjxuU3#dc)hv=?S0&XQ#Mm6R?VtW@`_ zNi+9!rIJu}GyT{aH|coO;g-zd$wOs_S|XXYh3(IJD`3>be$I<7y}5lMO8x{beWy`K wcZLg^aedUkcZ|bYgiK_7Rl#FZ{qf92?CCJrL(#5J+=2c70aGnC`mnVC0DL-c Date: Thu, 21 Mar 2024 15:19:12 +0200 Subject: [PATCH 21/36] fix: Update test snapshots --- .../rules/NoDeprecatedApi/old_library.js | 4 ---- .../rules/snapshots/NoDeprecatedApi.ts.md | 14 +++++++------- test/lib/linter/snapshots/linter.ts.md | 4 ++-- test/lib/linter/snapshots/linter.ts.snap | Bin 7509 -> 7509 bytes 4 files changed, 9 insertions(+), 13 deletions(-) diff --git a/test/fixtures/linter/rules/NoDeprecatedApi/old_library.js b/test/fixtures/linter/rules/NoDeprecatedApi/old_library.js index f2f74903..e0dcf7d2 100644 --- a/test/fixtures/linter/rules/NoDeprecatedApi/old_library.js +++ b/test/fixtures/linter/rules/NoDeprecatedApi/old_library.js @@ -1,10 +1,6 @@ /*! * ${copyright} */ - -/** - * Initialization Code and shared classes of library library.with.custom.paths. - */ sap.ui.define([ "sap/ui/core/Lib", ], function (Library) { diff --git a/test/lib/linter/rules/snapshots/NoDeprecatedApi.ts.md b/test/lib/linter/rules/snapshots/NoDeprecatedApi.ts.md index c403e3c8..04f1b1d2 100644 --- a/test/lib/linter/rules/snapshots/NoDeprecatedApi.ts.md +++ b/test/lib/linter/rules/snapshots/NoDeprecatedApi.ts.md @@ -1032,7 +1032,7 @@ Generated by [AVA](https://avajs.dev). { column: 2, fatal: undefined, - line: 13, + line: 9, message: 'Call to Library.init() must be declared with property {apiVersion: 2}', ruleId: 'ui5-linter-no-partially-deprecated-api', severity: 2, @@ -1040,7 +1040,7 @@ Generated by [AVA](https://avajs.dev). { column: 2, fatal: undefined, - line: 14, + line: 10, message: 'Call to Library.init() must be declared with property {apiVersion: 2}', ruleId: 'ui5-linter-no-partially-deprecated-api', severity: 2, @@ -1048,7 +1048,7 @@ Generated by [AVA](https://avajs.dev). { column: 2, fatal: undefined, - line: 15, + line: 11, message: 'Call to Library.init() must be declared with property {apiVersion: 2}', ruleId: 'ui5-linter-no-partially-deprecated-api', severity: 2, @@ -1056,7 +1056,7 @@ Generated by [AVA](https://avajs.dev). { column: 2, fatal: undefined, - line: 16, + line: 12, message: 'Call to Library.init() must be declared with property {apiVersion: 2}', ruleId: 'ui5-linter-no-partially-deprecated-api', severity: 2, @@ -1064,7 +1064,7 @@ Generated by [AVA](https://avajs.dev). { column: 15, fatal: undefined, - line: 20, + line: 16, message: 'Call to Library.init() must be declared with property {apiVersion: 2}', ruleId: 'ui5-linter-no-partially-deprecated-api', severity: 2, @@ -1072,7 +1072,7 @@ Generated by [AVA](https://avajs.dev). { column: 15, fatal: undefined, - line: 23, + line: 19, message: 'Call to Library.init() must be declared with property {apiVersion: 2}', ruleId: 'ui5-linter-no-partially-deprecated-api', severity: 2, @@ -1080,7 +1080,7 @@ Generated by [AVA](https://avajs.dev). { column: 15, fatal: undefined, - line: 26, + line: 22, message: 'Call to Library.init() must be declared with property {apiVersion: 2}', ruleId: 'ui5-linter-no-partially-deprecated-api', severity: 2, diff --git a/test/lib/linter/snapshots/linter.ts.md b/test/lib/linter/snapshots/linter.ts.md index e9240493..64d85ed8 100644 --- a/test/lib/linter/snapshots/linter.ts.md +++ b/test/lib/linter/snapshots/linter.ts.md @@ -907,7 +907,7 @@ Generated by [AVA](https://avajs.dev). { column: 2, fatal: undefined, - line: 14, + line: 15, message: 'Call to deprecated function \'initLibrary\' of class \'Core\'', messageDetails: 'Deprecated test message', ruleId: 'ui5-linter-no-deprecated-api', @@ -916,7 +916,7 @@ Generated by [AVA](https://avajs.dev). { column: 2, fatal: undefined, - line: 14, + line: 15, message: 'Call to deprecated function \'getCore\' (sap.ui.getCore)', messageDetails: 'Deprecated test message', ruleId: 'ui5-linter-no-deprecated-api', diff --git a/test/lib/linter/snapshots/linter.ts.snap b/test/lib/linter/snapshots/linter.ts.snap index bfa35bfa06e50ffec1020832073db00effed4399..7bd19f66763824b11328dd95e719d98c199aa26e 100644 GIT binary patch delta 6980 zcmV-K8@uGyI@LNdK~_N^Q*L2!b7*gLAa*kf0|3ox6}&8db|PvNS>ltUvUr>8ev*=U1mrovu1{>S*`A zxE|eae(qM)(yX{@ouwvJLy5P`9r^*)P))YK;O^~ z3`+jL^T9v*;8h<4{jk6?bCG4pb zNCGaBv#MZw74%iXHC1qDl|T}7k(^%*7gfV$)$omKc(__1DR+@*HK5nPksA1J4LngJ zkW{!xK35AzYT@2mc&Zj&sTD{nU8BS&3UE}h)E?a!NQ<4_|3mW2qIx{lm&oMK7jk`Z zEum)eyh2_eBkY;qo^OA#C!y?%tFoobNI?aDbIwKs`H#rG4Hkc`NNn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OPD66QlaIH(P+A7LxdoTUr8tRJCuJI=qTYvXxc zp=Qeurd)*@sg=a From 93af76684eb01af37707995217c5bc3687268759 Mon Sep 17 00:00:00 2001 From: Yavor Ivanov Date: Fri, 22 Mar 2024 11:10:11 +0200 Subject: [PATCH 22/36] fix: Merge conflicts --- .../rules/snapshots/NoDeprecatedApi.ts.snap | Bin 5923 -> 6279 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/test/lib/linter/rules/snapshots/NoDeprecatedApi.ts.snap b/test/lib/linter/rules/snapshots/NoDeprecatedApi.ts.snap index 212108067fda9b3c8de9df2a754d62632b21e375..fa8647a62c980015154b3a6b27029b6bb75179f3 100644 GIT binary patch literal 6279 zcmV;2730#a$*sB%tQza z|9re^?;nc@00000000B+oqK#7Wx2<{GkclY-6Wg)z3nz!+Cr1GrG*v>y@A{cExjO6 zuue9UblT1CvOAkJKvD4kUO?m~cM(NEkei4Hr6|b9kEnP-K?Dy7c;upT1QAg<98PAk z*-dAX%x06NNt^tWH`#q=-ub=ryzg)3_q@+@Q%74Q7T%V;@~f(@=@E5%?a^vfO(>B= zLnp-AQxWypu6Qh=w`@&n$*2-fZi(s1Pu+ zgwiVr1Fc{%h~P&M5CVd*bihdJ0d@e_0S^IxG!FpHLi#}7HEmnfur7$1W@%|DLNS6D zp+peY3Q#Gy5Iki z?P{boX55XfYmQWO{zTou2%ZE0KXRCzXW(ifWHgyz5uca6(UR*VU7q3MOY@n zaeW@OQG}0+uuXJu(V#g#-J&@@0YSK5WMI(#VKhavd5{Z?-Ub9AVKm)l^IoIrF`I7~ zO|RK(H7-dqo6-KOGn#iAO`qBPtI_nE%>zBgS??uXd{i@9twKPCVt1|SlE&jjG+ z0K6Z7!-}B0$YSoZnSZGWt}lY`6~S+d;O|9nbTOP?3=bDu%>6d=7mDHKVsMv0s05al zz@;Vd%M$PhE#?86`2j(g7ladour&x51mW=@_)FoaQj2+!&0H;oZKd$pQuul)JW>j+ zWzbayx0PAUi*4qQmBBB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/typeChecker/FileLinter.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/detectors/typeChecker/FileLinter.ts b/src/detectors/typeChecker/FileLinter.ts index 01ab9e4f..e2c2831f 100644 --- a/src/detectors/typeChecker/FileLinter.ts +++ b/src/detectors/typeChecker/FileLinter.ts @@ -261,7 +261,7 @@ export default class FileLinter { } const moduleDeclaration = this.getSymbolModuleDeclaration(nodeType.symbol); - if (moduleDeclaration?.name.text !== "sap/ui/core/Lib") { + if (!moduleDeclaration || moduleDeclaration.name.text !== "sap/ui/core/Lib") { return; } From 517d9c90fb8a42675c6646a60e46b02525b013fb Mon Sep 17 00:00:00 2001 From: Yavor Ivanov Date: Fri, 22 Mar 2024 15:28:30 +0200 Subject: [PATCH 24/36] refactor: Node availability checks Co-authored-by: Merlin Beutlberger --- src/detectors/typeChecker/FileLinter.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/detectors/typeChecker/FileLinter.ts b/src/detectors/typeChecker/FileLinter.ts index e2c2831f..b8cc1efb 100644 --- a/src/detectors/typeChecker/FileLinter.ts +++ b/src/detectors/typeChecker/FileLinter.ts @@ -256,7 +256,7 @@ export default class FileLinter { const nodeExp = (ts.isPropertyAccessExpression(node.expression) || ts.isElementAccessExpression(node.expression)) && node.expression; const nodeType = nodeExp && this.#checker.getTypeAtLocation(nodeExp); - if (!nodeType || nodeType.symbol?.getName() !== "init") { + if (!nodeType?.symbol || nodeType.symbol.getName() !== "init") { return; } From 60a957e3421f7bcc9494385bcc907d9ab1401503 Mon Sep 17 00:00:00 2001 From: Yavor Ivanov Date: Fri, 22 Mar 2024 15:31:22 +0200 Subject: [PATCH 25/36] refactor: Node availability checks --- src/detectors/typeChecker/FileLinter.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/detectors/typeChecker/FileLinter.ts b/src/detectors/typeChecker/FileLinter.ts index b8cc1efb..06270658 100644 --- a/src/detectors/typeChecker/FileLinter.ts +++ b/src/detectors/typeChecker/FileLinter.ts @@ -256,7 +256,7 @@ export default class FileLinter { const nodeExp = (ts.isPropertyAccessExpression(node.expression) || ts.isElementAccessExpression(node.expression)) && node.expression; const nodeType = nodeExp && this.#checker.getTypeAtLocation(nodeExp); - if (!nodeType?.symbol || nodeType.symbol.getName() !== "init") { + if (!nodeType || !nodeType.symbol || nodeType.symbol.getName() !== "init") { return; } From e23e47af328d5c6f1268e6a96b1adc6c1bc5ca4e Mon Sep 17 00:00:00 2001 From: Yavor Ivanov Date: Fri, 22 Mar 2024 15:42:48 +0200 Subject: [PATCH 26/36] refactor: Split library.js fixtures --- .../{old_library.js => library.js} | 8 - .../rules/NoDeprecatedApi/library_negative.js | 17 ++ .../rules/snapshots/NoDeprecatedApi.ts.md | 231 ++++++++++++------ .../rules/snapshots/NoDeprecatedApi.ts.snap | Bin 6279 -> 6548 bytes 4 files changed, 176 insertions(+), 80 deletions(-) rename test/fixtures/linter/rules/NoDeprecatedApi/{old_library.js => library.js} (75%) create mode 100644 test/fixtures/linter/rules/NoDeprecatedApi/library_negative.js diff --git a/test/fixtures/linter/rules/NoDeprecatedApi/old_library.js b/test/fixtures/linter/rules/NoDeprecatedApi/library.js similarity index 75% rename from test/fixtures/linter/rules/NoDeprecatedApi/old_library.js rename to test/fixtures/linter/rules/NoDeprecatedApi/library.js index e0dcf7d2..b95741bb 100644 --- a/test/fixtures/linter/rules/NoDeprecatedApi/old_library.js +++ b/test/fixtures/linter/rules/NoDeprecatedApi/library.js @@ -21,12 +21,4 @@ sap.ui.define([ Library.init({ apiVersion: "2" }); - Library.init({ - apiVersion: 2 - }); - - // Should be ignored - Library.load({ - apiVersion: 23 - }); }); diff --git a/test/fixtures/linter/rules/NoDeprecatedApi/library_negative.js b/test/fixtures/linter/rules/NoDeprecatedApi/library_negative.js new file mode 100644 index 00000000..fa14ad79 --- /dev/null +++ b/test/fixtures/linter/rules/NoDeprecatedApi/library_negative.js @@ -0,0 +1,17 @@ +/*! + * ${copyright} + */ +sap.ui.define([ + "sap/ui/core/Lib", +], function (Library) { + "use strict"; + + Library.init({ + apiVersion: 2 + }); + + // Should be ignored + Library.load({ + apiVersion: 23 + }); +}); diff --git a/test/lib/linter/rules/snapshots/NoDeprecatedApi.ts.md b/test/lib/linter/rules/snapshots/NoDeprecatedApi.ts.md index 04f1b1d2..3703d248 100644 --- a/test/lib/linter/rules/snapshots/NoDeprecatedApi.ts.md +++ b/test/lib/linter/rules/snapshots/NoDeprecatedApi.ts.md @@ -788,6 +788,93 @@ Generated by [AVA](https://avajs.dev). }, ] +## General: library.js + +> Snapshot 1 + + [ + { + coverageInfo: [], + errorCount: 7, + fatalErrorCount: 0, + filePath: 'library.js', + messages: [ + { + column: 2, + fatal: undefined, + line: 9, + message: 'Call to Library.init() must be declared with property {apiVersion: 2}', + ruleId: 'ui5-linter-no-partially-deprecated-api', + severity: 2, + }, + { + column: 2, + fatal: undefined, + line: 10, + message: 'Call to Library.init() must be declared with property {apiVersion: 2}', + ruleId: 'ui5-linter-no-partially-deprecated-api', + severity: 2, + }, + { + column: 2, + fatal: undefined, + line: 11, + message: 'Call to Library.init() must be declared with property {apiVersion: 2}', + ruleId: 'ui5-linter-no-partially-deprecated-api', + severity: 2, + }, + { + column: 2, + fatal: undefined, + line: 12, + message: 'Call to Library.init() must be declared with property {apiVersion: 2}', + ruleId: 'ui5-linter-no-partially-deprecated-api', + severity: 2, + }, + { + column: 15, + fatal: undefined, + line: 16, + message: 'Call to Library.init() must be declared with property {apiVersion: 2}', + ruleId: 'ui5-linter-no-partially-deprecated-api', + severity: 2, + }, + { + column: 15, + fatal: undefined, + line: 19, + message: 'Call to Library.init() must be declared with property {apiVersion: 2}', + ruleId: 'ui5-linter-no-partially-deprecated-api', + severity: 2, + }, + { + column: 15, + fatal: undefined, + line: 22, + message: 'Call to Library.init() must be declared with property {apiVersion: 2}', + ruleId: 'ui5-linter-no-partially-deprecated-api', + severity: 2, + }, + ], + warningCount: 0, + }, + ] + +## General: library_negative.js + +> Snapshot 1 + + [ + { + coverageInfo: [], + errorCount: 0, + fatalErrorCount: 0, + filePath: 'library_negative.js', + messages: [], + warningCount: 0, + }, + ] + ## General: manifest.json > Snapshot 1 @@ -1018,78 +1105,6 @@ Generated by [AVA](https://avajs.dev). }, ] -## General: old_library.js - -> Snapshot 1 - - [ - { - coverageInfo: [], - errorCount: 7, - fatalErrorCount: 0, - filePath: 'old_library.js', - messages: [ - { - column: 2, - fatal: undefined, - line: 9, - message: 'Call to Library.init() must be declared with property {apiVersion: 2}', - ruleId: 'ui5-linter-no-partially-deprecated-api', - severity: 2, - }, - { - column: 2, - fatal: undefined, - line: 10, - message: 'Call to Library.init() must be declared with property {apiVersion: 2}', - ruleId: 'ui5-linter-no-partially-deprecated-api', - severity: 2, - }, - { - column: 2, - fatal: undefined, - line: 11, - message: 'Call to Library.init() must be declared with property {apiVersion: 2}', - ruleId: 'ui5-linter-no-partially-deprecated-api', - severity: 2, - }, - { - column: 2, - fatal: undefined, - line: 12, - message: 'Call to Library.init() must be declared with property {apiVersion: 2}', - ruleId: 'ui5-linter-no-partially-deprecated-api', - severity: 2, - }, - { - column: 15, - fatal: undefined, - line: 16, - message: 'Call to Library.init() must be declared with property {apiVersion: 2}', - ruleId: 'ui5-linter-no-partially-deprecated-api', - severity: 2, - }, - { - column: 15, - fatal: undefined, - line: 19, - message: 'Call to Library.init() must be declared with property {apiVersion: 2}', - ruleId: 'ui5-linter-no-partially-deprecated-api', - severity: 2, - }, - { - column: 15, - fatal: undefined, - line: 22, - message: 'Call to Library.init() must be declared with property {apiVersion: 2}', - ruleId: 'ui5-linter-no-partially-deprecated-api', - severity: 2, - }, - ], - warningCount: 0, - }, - ] - ## General: sap.ui.jsview.js > Snapshot 1 @@ -1164,3 +1179,75 @@ Generated by [AVA](https://avajs.dev). warningCount: 0, }, ] + +## General: old_library.js + +> Snapshot 1 + + [ + { + coverageInfo: [], + errorCount: 7, + fatalErrorCount: 0, + filePath: 'old_library.js', + messages: [ + { + column: 2, + fatal: undefined, + line: 9, + message: 'Call to Library.init() must be declared with property {apiVersion: 2}', + ruleId: 'ui5-linter-no-partially-deprecated-api', + severity: 2, + }, + { + column: 2, + fatal: undefined, + line: 10, + message: 'Call to Library.init() must be declared with property {apiVersion: 2}', + ruleId: 'ui5-linter-no-partially-deprecated-api', + severity: 2, + }, + { + column: 2, + fatal: undefined, + line: 11, + message: 'Call to Library.init() must be declared with property {apiVersion: 2}', + ruleId: 'ui5-linter-no-partially-deprecated-api', + severity: 2, + }, + { + column: 2, + fatal: undefined, + line: 12, + message: 'Call to Library.init() must be declared with property {apiVersion: 2}', + ruleId: 'ui5-linter-no-partially-deprecated-api', + severity: 2, + }, + { + column: 15, + fatal: undefined, + line: 16, + message: 'Call to Library.init() must be declared with property {apiVersion: 2}', + ruleId: 'ui5-linter-no-partially-deprecated-api', + severity: 2, + }, + { + column: 15, + fatal: undefined, + line: 19, + message: 'Call to Library.init() must be declared with property {apiVersion: 2}', + ruleId: 'ui5-linter-no-partially-deprecated-api', + severity: 2, + }, + { + column: 15, + fatal: undefined, + line: 22, + message: 'Call to Library.init() must be declared with property {apiVersion: 2}', + ruleId: 'ui5-linter-no-partially-deprecated-api', + severity: 2, + }, + ], + warningCount: 0, + }, + ] diff --git a/test/lib/linter/rules/snapshots/NoDeprecatedApi.ts.snap b/test/lib/linter/rules/snapshots/NoDeprecatedApi.ts.snap index fa8647a62c980015154b3a6b27029b6bb75179f3..aa25630db3b4fd73bfb8405b5c7ce87f8f235d02 100644 GIT binary patch literal 6548 zcmV;F8EfW2RzV%BuWJyRPI|kB)KA;PfvK7Koprt^eY^AhNpg{Tbm9})DkW%P_0xerxUZE6d;ZdGv zEKANv_9(K2?Zo-VHIlz3NT)0bxYk4#p z=oMn1Ra{(*@FE1lC&ZG0PI3>h6}Sp`5crdM0B9141G!hVZc^KHAtjq7B_)VLgd0&L z#A*Q*!hvv=ih{Oqw;By}sz-)8!iZwZg*5P;SB*x)(G}r%NH;%n8bjIP7sVX`Jr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B61bi*xn2O}pFQ>W4?n>|jr!Jnnh{zM7lI xeKX^6e-YqK0fHhND8kVqTqDBMLnUP%t;gkCm%}Nc{GQ}-{|^smW)+&b002-^4T}H( From d944e3a29269d046cdc71704073f086c94622162 Mon Sep 17 00:00:00 2001 From: Yavor Ivanov Date: Fri, 22 Mar 2024 15:47:09 +0200 Subject: [PATCH 27/36] fix: Add tests for ElementAccessExpression --- .../linter/rules/NoDeprecatedApi/library.js | 3 + .../rules/NoDeprecatedApi/library_negative.js | 4 + .../rules/snapshots/NoDeprecatedApi.ts.md | 82 ++---------------- .../rules/snapshots/NoDeprecatedApi.ts.snap | Bin 6548 -> 6334 bytes 4 files changed, 16 insertions(+), 73 deletions(-) diff --git a/test/fixtures/linter/rules/NoDeprecatedApi/library.js b/test/fixtures/linter/rules/NoDeprecatedApi/library.js index b95741bb..544bfe0b 100644 --- a/test/fixtures/linter/rules/NoDeprecatedApi/library.js +++ b/test/fixtures/linter/rules/NoDeprecatedApi/library.js @@ -21,4 +21,7 @@ sap.ui.define([ Library.init({ apiVersion: "2" }); + Library["init"]({ + apiVersion: 1 + }); }); diff --git a/test/fixtures/linter/rules/NoDeprecatedApi/library_negative.js b/test/fixtures/linter/rules/NoDeprecatedApi/library_negative.js index fa14ad79..994fac93 100644 --- a/test/fixtures/linter/rules/NoDeprecatedApi/library_negative.js +++ b/test/fixtures/linter/rules/NoDeprecatedApi/library_negative.js @@ -9,6 +9,10 @@ sap.ui.define([ Library.init({ apiVersion: 2 }); + + Library["init"]({ + apiVersion: 2 + }); // Should be ignored Library.load({ diff --git a/test/lib/linter/rules/snapshots/NoDeprecatedApi.ts.md b/test/lib/linter/rules/snapshots/NoDeprecatedApi.ts.md index 3703d248..4ba961ce 100644 --- a/test/lib/linter/rules/snapshots/NoDeprecatedApi.ts.md +++ b/test/lib/linter/rules/snapshots/NoDeprecatedApi.ts.md @@ -795,7 +795,7 @@ Generated by [AVA](https://avajs.dev). [ { coverageInfo: [], - errorCount: 7, + errorCount: 8, fatalErrorCount: 0, filePath: 'library.js', messages: [ @@ -855,6 +855,14 @@ Generated by [AVA](https://avajs.dev). ruleId: 'ui5-linter-no-partially-deprecated-api', severity: 2, }, + { + column: 15, + fatal: undefined, + line: 25, + message: 'Call to Library.init() must be declared with property {apiVersion: 2}', + ruleId: 'ui5-linter-no-partially-deprecated-api', + severity: 2, + }, ], warningCount: 0, }, @@ -1179,75 +1187,3 @@ Generated by [AVA](https://avajs.dev). warningCount: 0, }, ] - -## General: old_library.js - -> Snapshot 1 - - [ - { - coverageInfo: [], - errorCount: 7, - fatalErrorCount: 0, - filePath: 'old_library.js', - messages: [ - { - column: 2, - fatal: undefined, - line: 9, - message: 'Call to Library.init() must be declared with property {apiVersion: 2}', - ruleId: 'ui5-linter-no-partially-deprecated-api', - severity: 2, - }, - { - column: 2, - fatal: undefined, - line: 10, - message: 'Call to Library.init() must be declared with property {apiVersion: 2}', - ruleId: 'ui5-linter-no-partially-deprecated-api', - severity: 2, - }, - { - column: 2, - fatal: undefined, - line: 11, - message: 'Call to Library.init() must be declared with property {apiVersion: 2}', - ruleId: 'ui5-linter-no-partially-deprecated-api', - severity: 2, - }, - { - column: 2, - fatal: undefined, - line: 12, - message: 'Call to Library.init() must be declared with property {apiVersion: 2}', - ruleId: 'ui5-linter-no-partially-deprecated-api', - severity: 2, - }, - { - column: 15, - fatal: undefined, - line: 16, - message: 'Call to Library.init() must be declared with property {apiVersion: 2}', - ruleId: 'ui5-linter-no-partially-deprecated-api', - severity: 2, - }, - { - column: 15, - fatal: undefined, - line: 19, - message: 'Call to Library.init() must be declared with property {apiVersion: 2}', - ruleId: 'ui5-linter-no-partially-deprecated-api', - severity: 2, - }, - { - column: 15, - fatal: undefined, - line: 22, - message: 'Call to Library.init() must be declared with property {apiVersion: 2}', - ruleId: 'ui5-linter-no-partially-deprecated-api', - severity: 2, - }, - ], - warningCount: 0, - }, - ] diff --git a/test/lib/linter/rules/snapshots/NoDeprecatedApi.ts.snap b/test/lib/linter/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6D){n5m6iJ)@U#Qo zcEE{FxW+yz_(3N;>Vy}a@SziGUGQlaJZc{m{HH`hd)WzRulK+P5A=HAG7sG4fhsR-u#XBp z(+i*T!nIzw-wRKBVTlhuHyIT?o+CLYqk<=+f+wSbC!>PL8%mQ=!Mj;h@c#oqwmWGm G#{dA!|BA8z From 9d0c6c8a95c7192467615267182c87df74a5717f Mon Sep 17 00:00:00 2001 From: Yavor Ivanov Date: Fri, 22 Mar 2024 16:48:05 +0200 Subject: [PATCH 28/36] feat: Detect destructuring and assignment of Lib.init --- src/detectors/typeChecker/FileLinter.ts | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/detectors/typeChecker/FileLinter.ts b/src/detectors/typeChecker/FileLinter.ts index 06270658..effd92f4 100644 --- a/src/detectors/typeChecker/FileLinter.ts +++ b/src/detectors/typeChecker/FileLinter.ts @@ -253,7 +253,9 @@ export default class FileLinter { } analyzeLibInitCall(node: ts.CallExpression) { - const nodeExp = (ts.isPropertyAccessExpression(node.expression) || + const nodeExp = ( + ts.isIdentifier(node.expression) || + ts.isPropertyAccessExpression(node.expression) || ts.isElementAccessExpression(node.expression)) && node.expression; const nodeType = nodeExp && this.#checker.getTypeAtLocation(nodeExp); if (!nodeType || !nodeType.symbol || nodeType.symbol.getName() !== "init") { @@ -283,14 +285,19 @@ export default class FileLinter { } if (nodeToHighlight) { - const importedVarName = node.expression.expression.getText(); + let importedVarName: string; + if (ts.isIdentifier(nodeExp)) { + importedVarName = nodeExp.getText(); + } else { + importedVarName = nodeExp.expression.getText() + ".init"; + } this.#reporter.addMessage({ node: nodeToHighlight, severity: LintMessageSeverity.Error, ruleId: "ui5-linter-no-partially-deprecated-api", message: - `Call to ${importedVarName}.init() must be declared with property {apiVersion: 2}`, + `Call to ${importedVarName}() must be declared with property {apiVersion: 2}`, }); } } From 4fcc83ab202258ec795c31576e1162ceccc64055 Mon Sep 17 00:00:00 2001 From: Yavor Ivanov Date: Fri, 22 Mar 2024 16:48:51 +0200 Subject: [PATCH 29/36] fix: Add tests for the new scenarios --- .../linter/rules/NoDeprecatedApi/library.js | 15 ++++++++++ .../rules/NoDeprecatedApi/library_negative.js | 15 ++++++++++ .../rules/snapshots/NoDeprecatedApi.ts.md | 26 +++++++++++++++++- .../rules/snapshots/NoDeprecatedApi.ts.snap | Bin 6334 -> 6467 bytes 4 files changed, 55 insertions(+), 1 deletion(-) diff --git a/test/fixtures/linter/rules/NoDeprecatedApi/library.js b/test/fixtures/linter/rules/NoDeprecatedApi/library.js index 544bfe0b..019befec 100644 --- a/test/fixtures/linter/rules/NoDeprecatedApi/library.js +++ b/test/fixtures/linter/rules/NoDeprecatedApi/library.js @@ -24,4 +24,19 @@ sap.ui.define([ Library["init"]({ apiVersion: 1 }); + + const LibInit = Library.init; + LibInit({ + apiVersion: 1 + }); + + const {init} = Library; + init({ + apiVersion: 1 + }); + + const {init: intRenames} = Library; + intRenames({ + apiVersion: 1 + }); }); diff --git a/test/fixtures/linter/rules/NoDeprecatedApi/library_negative.js b/test/fixtures/linter/rules/NoDeprecatedApi/library_negative.js index 994fac93..055bb82d 100644 --- a/test/fixtures/linter/rules/NoDeprecatedApi/library_negative.js +++ b/test/fixtures/linter/rules/NoDeprecatedApi/library_negative.js @@ -18,4 +18,19 @@ sap.ui.define([ Library.load({ apiVersion: 23 }); + + const LibInit = Library.init; + LibInit({ + apiVersion: 2 + }); + + const {init} = Library; + init({ + apiVersion: 2 + }); + + const {init: intRenames} = Library; + intRenames({ + apiVersion: 2 + }); }); diff --git a/test/lib/linter/rules/snapshots/NoDeprecatedApi.ts.md b/test/lib/linter/rules/snapshots/NoDeprecatedApi.ts.md index 4ba961ce..0950883e 100644 --- a/test/lib/linter/rules/snapshots/NoDeprecatedApi.ts.md +++ b/test/lib/linter/rules/snapshots/NoDeprecatedApi.ts.md @@ -795,7 +795,7 @@ Generated by [AVA](https://avajs.dev). [ { coverageInfo: [], - errorCount: 8, + errorCount: 11, fatalErrorCount: 0, filePath: 'library.js', messages: [ @@ -863,6 +863,30 @@ Generated by [AVA](https://avajs.dev). ruleId: 'ui5-linter-no-partially-deprecated-api', severity: 2, }, + { + column: 15, + fatal: undefined, + line: 30, + message: 'Call to LibInit() must be declared with property {apiVersion: 2}', + ruleId: 'ui5-linter-no-partially-deprecated-api', + severity: 2, + }, + { + column: 15, + fatal: undefined, + line: 35, + message: 'Call to init() must be declared with property {apiVersion: 2}', + ruleId: 'ui5-linter-no-partially-deprecated-api', + severity: 2, + }, + { + column: 15, + fatal: undefined, + line: 40, + message: 'Call to intRenames() must be declared with property {apiVersion: 2}', + ruleId: 'ui5-linter-no-partially-deprecated-api', + severity: 2, + }, ], warningCount: 0, }, diff --git a/test/lib/linter/rules/snapshots/NoDeprecatedApi.ts.snap b/test/lib/linter/rules/snapshots/NoDeprecatedApi.ts.snap index ce4a79d7bf4e64cf4027210cce6ba2f663d193ac..95fe995dbc99f2d5f21b1941d391b38de0114bda 100644 GIT binary patch literal 6467 zcmV-J8NB8}RzVgx%Ss0V=%s0-_*tzl$I@K?Fp6xhm+(M-&uMDuORpUoI6<5D}FZc{7vE zZaR}>Hk&L-+T@>{WasRh`OZA&{N_B*InNDk&EZ(fmc->ZDw?W=m915WDN!XJ3NH>G z9cxX7l_Me@vAEW_IiV(^p^n6+n3njD8(LdKTIhJk90wBmk01-;zQ8=7RB#syuI2G~ zs9O;FN`Ai|!HXau_yl1|UnQvv*aln!JOcc|_yTAUQeWg=-Mm?8(F8GF3 ze5mO#Oh?IWYFJql(l({5nJ^ix3ioT398nU9P`i>aeN#bKC>~X#?K_`L-ie=MCw{UZ zUL?R3!p@ML14F(+NI{lg5#S90oFW88SR%p|B5W5S;4p!9SwKsshPzv0;bbJ5!Wb}p z>M}4Ie@TU=&zxa3stkf(N@42z`@mkJ!B|_cRq2Q;Eg?;54Mq&u!5N8AM^jR5io{x# za8pcw8k<%h64F9P>;ITx`s$+8S0AEiAvK)n`*-CbneWw|R8!&&(O5&KZ4IFg)%>s|lujk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}Jo=Ok_XYErD6P!9Uw{%?WopZTn2KeZ~8;;mwUG2~Fw9ZfElf zVrNYP4$jriP8n}Is~ZY0qj||f+1o&v{~YY?wzR#yo;ug2EBt0laFhgBN$`{eWuvt> zGv^$uzzcg)Vv+%C+h-_i)1tAk(xZg4+uMSI*xPggi*vQNP2+8E4MQVlG;mv?Ebcl1 zH|Az>-%MNFp9Q=rpj3hbB{*7wof15qEr9t*EiT_2Hg?Gu_9Tn@f6-r6*~Yv801MD2 AmH+?% From da59f34b2619a07e9a66692a836fa2c6a2d959f0 Mon Sep 17 00:00:00 2001 From: Yavor Ivanov Date: Fri, 22 Mar 2024 16:50:31 +0200 Subject: [PATCH 30/36] refactor: Add comments --- src/detectors/typeChecker/FileLinter.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/detectors/typeChecker/FileLinter.ts b/src/detectors/typeChecker/FileLinter.ts index effd92f4..d4f54bed 100644 --- a/src/detectors/typeChecker/FileLinter.ts +++ b/src/detectors/typeChecker/FileLinter.ts @@ -254,7 +254,7 @@ export default class FileLinter { analyzeLibInitCall(node: ts.CallExpression) { const nodeExp = ( - ts.isIdentifier(node.expression) || + ts.isIdentifier(node.expression) || // Assignment `const LibInit = Library.init` and destructuring ts.isPropertyAccessExpression(node.expression) || ts.isElementAccessExpression(node.expression)) && node.expression; const nodeType = nodeExp && this.#checker.getTypeAtLocation(nodeExp); From 677f58d452212628d37a70a8cbe82a79fe83548c Mon Sep 17 00:00:00 2001 From: Yavor Ivanov Date: Mon, 25 Mar 2024 09:03:52 +0200 Subject: [PATCH 31/36] refactor: Check for apiVersion: 2 only --- src/detectors/typeChecker/FileLinter.ts | 45 +++++-------------------- 1 file changed, 9 insertions(+), 36 deletions(-) diff --git a/src/detectors/typeChecker/FileLinter.ts b/src/detectors/typeChecker/FileLinter.ts index d4f54bed..1479b697 100644 --- a/src/detectors/typeChecker/FileLinter.ts +++ b/src/detectors/typeChecker/FileLinter.ts @@ -212,38 +212,6 @@ export default class FileLinter { }); } - /** - * Extracts & builds object literal - * - * @param node - * @returns {object} - */ - extractPropsRecursive = (node: ts.ObjectLiteralExpression) => { - type propsType = Record; - const properties = Object.create(null) as propsType; - - node.properties?.forEach((prop) => { - if (!ts.isPropertyAssignment(prop) || !prop.name) { - return; - } - - const key = prop.name.getText(); - if (prop.initializer.kind === ts.SyntaxKind.FalseKeyword) { - properties[key] = {value: false, node: prop.initializer}; - } else if (prop.initializer.kind === ts.SyntaxKind.NullKeyword) { - properties[key] = {value: null, node: prop.initializer}; - } else if (ts.isObjectLiteralExpression(prop.initializer) && prop.initializer.properties) { - properties[key] = {value: this.extractPropsRecursive(prop.initializer), node: prop.initializer}; - } else if ((ts.isIdentifier(prop.initializer) || - ts.isNumericLiteral(prop.initializer) || - ts.isStringLiteral(prop.initializer)) && - prop.initializer.text) { - properties[key] = {value: prop.initializer.getText(), node: prop.initializer}; - } - }); - return properties; - }; - getSymbolModuleDeclaration(symbol: ts.Symbol) { let parent = symbol.valueDeclaration?.parent; while (parent && !ts.isModuleDeclaration(parent)) { @@ -275,12 +243,17 @@ export default class FileLinter { if (!initArg) { nodeToHighlight = node; } else { - const apiKeyProp = this.extractPropsRecursive(initArg); + const apiVersionNode = initArg.properties.find((prop) => { + return ts.isPropertyAssignment(prop) && + ts.isIdentifier(prop.name) && + prop.name.text === "apiVersion"; + }); - if (!apiKeyProp.apiVersion) { + if (!apiVersionNode) { // No arguments or no 'apiVersion' property nodeToHighlight = node; - } else if (apiKeyProp.apiVersion.value !== "2") { // String value would be "\"2\"" - nodeToHighlight = apiKeyProp.apiVersion.node; + } else if (ts.isPropertyAssignment(apiVersionNode) && + apiVersionNode.initializer.getText() !== "2") { // String value would be "\"2\"" + nodeToHighlight = apiVersionNode; } } From 00ba4ad362891195c35d42f861dc6b7d841223e8 Mon Sep 17 00:00:00 2001 From: Yavor Ivanov Date: Mon, 25 Mar 2024 09:04:29 +0200 Subject: [PATCH 32/36] fix: Tests --- .../rules/snapshots/NoDeprecatedApi.ts.md | 14 +++++++------- .../rules/snapshots/NoDeprecatedApi.ts.snap | Bin 6467 -> 6467 bytes 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/test/lib/linter/rules/snapshots/NoDeprecatedApi.ts.md b/test/lib/linter/rules/snapshots/NoDeprecatedApi.ts.md index 0950883e..05c0f50a 100644 --- a/test/lib/linter/rules/snapshots/NoDeprecatedApi.ts.md +++ b/test/lib/linter/rules/snapshots/NoDeprecatedApi.ts.md @@ -832,7 +832,7 @@ Generated by [AVA](https://avajs.dev). severity: 2, }, { - column: 15, + column: 3, fatal: undefined, line: 16, message: 'Call to Library.init() must be declared with property {apiVersion: 2}', @@ -840,7 +840,7 @@ Generated by [AVA](https://avajs.dev). severity: 2, }, { - column: 15, + column: 3, fatal: undefined, line: 19, message: 'Call to Library.init() must be declared with property {apiVersion: 2}', @@ -848,7 +848,7 @@ Generated by [AVA](https://avajs.dev). severity: 2, }, { - column: 15, + column: 3, fatal: undefined, line: 22, message: 'Call to Library.init() must be declared with property {apiVersion: 2}', @@ -856,7 +856,7 @@ Generated by [AVA](https://avajs.dev). severity: 2, }, { - column: 15, + column: 3, fatal: undefined, line: 25, message: 'Call to Library.init() must be declared with property {apiVersion: 2}', @@ -864,7 +864,7 @@ Generated by [AVA](https://avajs.dev). severity: 2, }, { - column: 15, + column: 3, fatal: undefined, line: 30, message: 'Call to LibInit() must be declared with property {apiVersion: 2}', @@ -872,7 +872,7 @@ Generated by [AVA](https://avajs.dev). severity: 2, }, { - column: 15, + column: 3, fatal: undefined, line: 35, message: 'Call to init() must be declared with property {apiVersion: 2}', @@ -880,7 +880,7 @@ Generated by [AVA](https://avajs.dev). severity: 2, }, { - column: 15, + column: 3, fatal: undefined, line: 40, message: 'Call to intRenames() must be declared with property {apiVersion: 2}', diff --git a/test/lib/linter/rules/snapshots/NoDeprecatedApi.ts.snap b/test/lib/linter/rules/snapshots/NoDeprecatedApi.ts.snap index 95fe995dbc99f2d5f21b1941d391b38de0114bda..c19ae67938b5bd60cad7403fc038120ff740ea39 100644 GIT binary patch delta 88 zcmV-e0H^=MGQ%=5K~_N^Q*L2!b7*gLAa*kf0|450Xpis(hPGUG1sDVQq5XE9*K1)G%b6|*!2keLmnAL$ delta 88 zcmV-e0H^=MGQ%=5K~_N^Q*L2!b7*gLAa*kf0{};HFeL-hTARB4GtM6fw{iQ6`#!;V uJ~*mCo**~2XhN|vkrD&f0ob#~5^4q$O@d{Yy=7Ojxc>)-_bdko!2kgDM Date: Mon, 25 Mar 2024 09:15:24 +0200 Subject: [PATCH 33/36] refactor: Add comments --- src/detectors/typeChecker/FileLinter.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/detectors/typeChecker/FileLinter.ts b/src/detectors/typeChecker/FileLinter.ts index 1479b697..ad812fc6 100644 --- a/src/detectors/typeChecker/FileLinter.ts +++ b/src/detectors/typeChecker/FileLinter.ts @@ -223,8 +223,8 @@ export default class FileLinter { analyzeLibInitCall(node: ts.CallExpression) { const nodeExp = ( ts.isIdentifier(node.expression) || // Assignment `const LibInit = Library.init` and destructuring - ts.isPropertyAccessExpression(node.expression) || - ts.isElementAccessExpression(node.expression)) && node.expression; + ts.isPropertyAccessExpression(node.expression) || /* Lib.init() */ + ts.isElementAccessExpression(node.expression) /* Lib["init"]() */) && node.expression; const nodeType = nodeExp && this.#checker.getTypeAtLocation(nodeExp); if (!nodeType || !nodeType.symbol || nodeType.symbol.getName() !== "init") { return; From 0bb711f85e12a4cd588ebfd9528dd01ebcd61462 Mon Sep 17 00:00:00 2001 From: Matthias Osswald Date: Fri, 22 Mar 2024 14:16:54 +0100 Subject: [PATCH 34/36] fix: Add messageDetails for Lib.init apiVersion check --- src/detectors/typeChecker/FileLinter.ts | 1 + .../rules/snapshots/NoDeprecatedApi.ts.md | 11 +++++++++++ .../rules/snapshots/NoDeprecatedApi.ts.snap | Bin 6467 -> 6552 bytes 3 files changed, 12 insertions(+) diff --git a/src/detectors/typeChecker/FileLinter.ts b/src/detectors/typeChecker/FileLinter.ts index ad812fc6..6aebe0d9 100644 --- a/src/detectors/typeChecker/FileLinter.ts +++ b/src/detectors/typeChecker/FileLinter.ts @@ -271,6 +271,7 @@ export default class FileLinter { ruleId: "ui5-linter-no-partially-deprecated-api", message: `Call to ${importedVarName}() must be declared with property {apiVersion: 2}`, + messageDetails: this.#messageDetails ? `{@link sap.ui.core.Lib.init Lib.init}` : undefined, }); } } diff --git a/test/lib/linter/rules/snapshots/NoDeprecatedApi.ts.md b/test/lib/linter/rules/snapshots/NoDeprecatedApi.ts.md index 05c0f50a..eee0a0b2 100644 --- a/test/lib/linter/rules/snapshots/NoDeprecatedApi.ts.md +++ b/test/lib/linter/rules/snapshots/NoDeprecatedApi.ts.md @@ -804,6 +804,7 @@ Generated by [AVA](https://avajs.dev). fatal: undefined, line: 9, message: 'Call to Library.init() must be declared with property {apiVersion: 2}', + messageDetails: 'Lib.init (https://ui5.sap.com/1.120/#/api/sap.ui.core.Lib)', ruleId: 'ui5-linter-no-partially-deprecated-api', severity: 2, }, @@ -812,6 +813,7 @@ Generated by [AVA](https://avajs.dev). fatal: undefined, line: 10, message: 'Call to Library.init() must be declared with property {apiVersion: 2}', + messageDetails: 'Lib.init (https://ui5.sap.com/1.120/#/api/sap.ui.core.Lib)', ruleId: 'ui5-linter-no-partially-deprecated-api', severity: 2, }, @@ -820,6 +822,7 @@ Generated by [AVA](https://avajs.dev). fatal: undefined, line: 11, message: 'Call to Library.init() must be declared with property {apiVersion: 2}', + messageDetails: 'Lib.init (https://ui5.sap.com/1.120/#/api/sap.ui.core.Lib)', ruleId: 'ui5-linter-no-partially-deprecated-api', severity: 2, }, @@ -828,6 +831,7 @@ Generated by [AVA](https://avajs.dev). fatal: undefined, line: 12, message: 'Call to Library.init() must be declared with property {apiVersion: 2}', + messageDetails: 'Lib.init (https://ui5.sap.com/1.120/#/api/sap.ui.core.Lib)', ruleId: 'ui5-linter-no-partially-deprecated-api', severity: 2, }, @@ -836,6 +840,7 @@ Generated by [AVA](https://avajs.dev). fatal: undefined, line: 16, message: 'Call to Library.init() must be declared with property {apiVersion: 2}', + messageDetails: 'Lib.init (https://ui5.sap.com/1.120/#/api/sap.ui.core.Lib)', ruleId: 'ui5-linter-no-partially-deprecated-api', severity: 2, }, @@ -844,6 +849,7 @@ Generated by [AVA](https://avajs.dev). fatal: undefined, line: 19, message: 'Call to Library.init() must be declared with property {apiVersion: 2}', + messageDetails: 'Lib.init (https://ui5.sap.com/1.120/#/api/sap.ui.core.Lib)', ruleId: 'ui5-linter-no-partially-deprecated-api', severity: 2, }, @@ -852,6 +858,7 @@ Generated by [AVA](https://avajs.dev). fatal: undefined, line: 22, message: 'Call to Library.init() must be declared with property {apiVersion: 2}', + messageDetails: 'Lib.init (https://ui5.sap.com/1.120/#/api/sap.ui.core.Lib)', ruleId: 'ui5-linter-no-partially-deprecated-api', severity: 2, }, @@ -860,6 +867,7 @@ Generated by [AVA](https://avajs.dev). fatal: undefined, line: 25, message: 'Call to Library.init() must be declared with property {apiVersion: 2}', + messageDetails: 'Lib.init (https://ui5.sap.com/1.120/#/api/sap.ui.core.Lib)', ruleId: 'ui5-linter-no-partially-deprecated-api', severity: 2, }, @@ -868,6 +876,7 @@ Generated by [AVA](https://avajs.dev). fatal: undefined, line: 30, message: 'Call to LibInit() must be declared with property {apiVersion: 2}', + messageDetails: 'Lib.init (https://ui5.sap.com/1.120/#/api/sap.ui.core.Lib)', ruleId: 'ui5-linter-no-partially-deprecated-api', severity: 2, }, @@ -876,6 +885,7 @@ Generated by [AVA](https://avajs.dev). fatal: undefined, line: 35, message: 'Call to init() must be declared with property {apiVersion: 2}', + messageDetails: 'Lib.init (https://ui5.sap.com/1.120/#/api/sap.ui.core.Lib)', ruleId: 'ui5-linter-no-partially-deprecated-api', severity: 2, }, @@ -884,6 +894,7 @@ Generated by [AVA](https://avajs.dev). fatal: undefined, line: 40, message: 'Call to intRenames() must be declared with property {apiVersion: 2}', + messageDetails: 'Lib.init (https://ui5.sap.com/1.120/#/api/sap.ui.core.Lib)', ruleId: 'ui5-linter-no-partially-deprecated-api', severity: 2, }, diff --git a/test/lib/linter/rules/snapshots/NoDeprecatedApi.ts.snap b/test/lib/linter/rules/snapshots/NoDeprecatedApi.ts.snap index c19ae67938b5bd60cad7403fc038120ff740ea39..c5cc41434dc08ea88e6b68a3d6298546f830cf63 100644 GIT binary patch literal 6552 zcmV;J8E57}RzVmna^g)3>wo+c9KxxaPJkMB` zoEh1p$X0A8_CLP1bfr7LJLjI?+}}C(T;JIij;|%dQP&yLb3ILux2| zsNroG-X(P^VR=usz83+#p{sq(PQm7T|RO>>>n3SR}&bB0M8Pnau#S!vwU;FmPvkES!o&(=e79 zUUld&>VLUP46oV4N>m;Mepec%{=X0GLo^uc40g!zgxnrd<&I!P2RqoD48>bhN^2z6 zA%|OI+TGZ?@{o`kI$HZjv*Dvl(;t0^tcH|uvj5*Thh#rjm6K{P{Wjy}Cba48=>M}Z zrOcZdR-&q$m>G@D%#LklD6SZ9mZaP*Cls|Oea&LOku_wDY(*?PiluQSr=8VpDTv-u$<)f85a1~R{#$@I1o)c(p9mm{P$9x(5oU-mSA@kP z9NBA8>qIzNgw3LbiTd^V=@#|*@e0CyBK?#0fz}lD=6*KNM(Y)Xgx0j{&3m+_LvOyT zHJy61Rl6jY-i-ELoz}cVYr6I3U$mx2Z|>vJzEy8-(waWK`8};!qBq~vnx*>U(d>ko zPB_X5T~7Fl6P|WLxeJbV4ZV0sf)sH<(ghc~;0_o3!UdBgSTDh4lA*iP)cuDNY?I&x z3H~lYxf?dR;U+h{;x=@5nYs%eaCu-a4=nY-NglY%1MhfXy4TQMGIc-P3oE=3_QF@a zaDx{<@xp;V==K@9yG`9M^T9Pfc)$n0_rc$Ma99bPRRRx}7`l5*-Cr(&*Gs@&3c*rX zR0Khn5+-`%K;CGT2-OUn_$f%ixhR zXbnIl0Jj7T-Ahc}9}B>*1MrssNae6+Ib2i@zbyxEg`s0;8IHv-B zT>-vISYB!9?l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eW z{Ig8oIqsIXZk=wnuXt}d&4#Fw(3IAJ?QBk7?5s|J{j;^R9g0{lhjjqsZ#!l5EuA;NYM0wc9Iv*sMFom+OL%tn3Iw#Q)Bro}qKN~aPY z*xu&l#one0urOPD+c?(tRx>y;qk&!dvbbvnxG_76`%c>8-WK3J0sJD&7U3`vt`gz7 dfifTr*Wz+r9$=TfWmmGe{|8XZnJx#x002efWi0>z From 4d3ee61f1f5c33545e66e52829caf5400007d50a Mon Sep 17 00:00:00 2001 From: Yavor Ivanov Date: Mon, 25 Mar 2024 11:06:37 +0200 Subject: [PATCH 35/36] refactor: Check for analyzeLibInitCall arg's type --- src/detectors/typeChecker/FileLinter.ts | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/detectors/typeChecker/FileLinter.ts b/src/detectors/typeChecker/FileLinter.ts index 6aebe0d9..bf2ccc7f 100644 --- a/src/detectors/typeChecker/FileLinter.ts +++ b/src/detectors/typeChecker/FileLinter.ts @@ -221,12 +221,15 @@ export default class FileLinter { } analyzeLibInitCall(node: ts.CallExpression) { - const nodeExp = ( - ts.isIdentifier(node.expression) || // Assignment `const LibInit = Library.init` and destructuring - ts.isPropertyAccessExpression(node.expression) || /* Lib.init() */ - ts.isElementAccessExpression(node.expression) /* Lib["init"]() */) && node.expression; - const nodeType = nodeExp && this.#checker.getTypeAtLocation(nodeExp); - if (!nodeType || !nodeType.symbol || nodeType.symbol.getName() !== "init") { + if (!ts.isIdentifier(node.expression) && // Assignment `const LibInit = Library.init` and destructuring + !ts.isPropertyAccessExpression(node.expression) && /* Lib.init() */ + !ts.isElementAccessExpression(node.expression) /* Lib["init"]() */) { + return; + } + + const nodeExp = node.expression; + const nodeType = this.#checker.getTypeAtLocation(nodeExp); + if (!nodeType.symbol || nodeType.symbol.getName() !== "init") { return; } @@ -236,7 +239,8 @@ export default class FileLinter { } const initArg = node?.arguments[0] && - ts.isObjectLiteralExpression(node.arguments[0]) && node.arguments[0]; + ts.isObjectLiteralExpression(node.arguments[0]) && + node.arguments[0]; let nodeToHighlight; From 8f42b6ee2a0696f66c1900c790d9f3e743f7f50f Mon Sep 17 00:00:00 2001 From: Yavor Ivanov Date: Mon, 25 Mar 2024 11:35:25 +0200 Subject: [PATCH 36/36] fix: Eslint --- src/detectors/typeChecker/FileLinter.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/detectors/typeChecker/FileLinter.ts b/src/detectors/typeChecker/FileLinter.ts index bf2ccc7f..3be04f34 100644 --- a/src/detectors/typeChecker/FileLinter.ts +++ b/src/detectors/typeChecker/FileLinter.ts @@ -226,7 +226,7 @@ export default class FileLinter { !ts.isElementAccessExpression(node.expression) /* Lib["init"]() */) { return; } - + const nodeExp = node.expression; const nodeType = this.#checker.getTypeAtLocation(nodeExp); if (!nodeType.symbol || nodeType.symbol.getName() !== "init") { @@ -239,7 +239,7 @@ export default class FileLinter { } const initArg = node?.arguments[0] && - ts.isObjectLiteralExpression(node.arguments[0]) && + ts.isObjectLiteralExpression(node.arguments[0]) && node.arguments[0]; let nodeToHighlight;