diff --git a/src/linter/LinterContext.ts b/src/linter/LinterContext.ts index b1ac8177a..94026a23e 100644 --- a/src/linter/LinterContext.ts +++ b/src/linter/LinterContext.ts @@ -203,12 +203,12 @@ export default class LinterContext { severity: messageInfo.severity, line: rawMessage.position ? rawMessage.position.line : undefined, column: rawMessage.position ? rawMessage.position.column : undefined, - message: messageFunc(rawMessage.args), + message: messageFunc(rawMessage.args || {}), }; if (this.#includeMessageDetails) { const detailsFunc = messageInfo.details as (args: MessageArgs[M]) => string | undefined; - const messageDetails = detailsFunc(rawMessage.args); + const messageDetails = detailsFunc(rawMessage.args || {}); if (messageDetails) { message.messageDetails = resolveLinks(messageDetails); } diff --git a/src/linter/manifestJson/ManifestLinter.ts b/src/linter/manifestJson/ManifestLinter.ts index 9de1db4a9..adc4df07a 100644 --- a/src/linter/manifestJson/ManifestLinter.ts +++ b/src/linter/manifestJson/ManifestLinter.ts @@ -79,10 +79,7 @@ export default class ManifestLinter { }); if (resources?.js) { - this.#reporter?.addMessage(MESSAGE.DEPRECATED_PROPERTY, { - propertyName: "sap.ui5/resources/js", - details: "", // TODO - }, "/sap.ui5/resources/js"); + this.#reporter?.addMessage(MESSAGE.DEPRECATED_MANIFEST_JS_RESOURCES, "/sap.ui5/resources/js"); } const modelKeys: string[] = (models && Object.keys(models)) ?? []; @@ -116,10 +113,8 @@ export default class ManifestLinter { if (curModel.type === "sap.ui.model.odata.v4.ODataModel" && curModel.settings && "synchronizationMode" in curModel.settings) { - this.#reporter?.addMessage(MESSAGE.DEPRECATED_PROPERTY_OF_CLASS, { - propertyName: "synchronizationMode", - className: "sap.ui.model.odata.v4.ODataModel", - details: "As of Version 1.110.0, this parameter is obsolete.", + this.#reporter?.addMessage(MESSAGE.DEPRECATED_ODATA_MODEL_V4_SYNCHRONIZATION_MODE, { + modelName: modelKey, }, `/sap.ui5/models/${modelKey}/settings/synchronizationMode`); } }); diff --git a/src/linter/messages.ts b/src/linter/messages.ts index aa9d4223d..86fe8676d 100644 --- a/src/linter/messages.ts +++ b/src/linter/messages.ts @@ -28,6 +28,7 @@ export enum MESSAGE { DEPRECATED_COMPONENT, DEPRECATED_FUNCTION_CALL, DEPRECATED_LIBRARY, + DEPRECATED_MANIFEST_JS_RESOURCES, DEPRECATED_MODULE_IMPORT, DEPRECATED_PROPERTY_OF_CLASS, DEPRECATED_PROPERTY, @@ -43,7 +44,7 @@ export enum MESSAGE { PARTIALLY_DEPRECATED_JSON_MODEL_LOAD_DATA, PARTIALLY_DEPRECATED_MOBILE_INIT, PARTIALLY_DEPRECATED_CORE_ROUTER, - PARTIALLY_DEPRECATED_ODATA_MODEL_V4, + DEPRECATED_ODATA_MODEL_V4_SYNCHRONIZATION_MODE, PARSING_ERROR, SVG_IN_XML, } @@ -137,6 +138,16 @@ export const MESSAGE_INFO = { details: () => undefined, }, + [MESSAGE.DEPRECATED_MANIFEST_JS_RESOURCES]: { + severity: LintMessageSeverity.Error, + ruleId: RULES["ui5-linter-no-deprecated-api"], + + message: () => + `Use of deprecated property 'sap.ui5/resources/js'`, + details: () => "As of version 1.94, the usage of js resources is deprecated. " + + "Please use regular dependencies instead.", + }, + [MESSAGE.DEPRECATED_MODULE_IMPORT]: { severity: LintMessageSeverity.Error, ruleId: RULES["ui5-linter-no-deprecated-api"], @@ -283,15 +294,15 @@ export const MESSAGE_INFO = { `{@link sap/ui/core/routing/Router#constructor See API reference}`, }, - [MESSAGE.PARTIALLY_DEPRECATED_ODATA_MODEL_V4]: { + [MESSAGE.DEPRECATED_ODATA_MODEL_V4_SYNCHRONIZATION_MODE]: { severity: LintMessageSeverity.Error, - ruleId: RULES["ui5-linter-no-partially-deprecated-api"], + ruleId: RULES["ui5-linter-no-deprecated-property"], - message: () => - `Usage of deprecated parameter 'mParameters.synchronizationMode' ` + - `of constructor 'sap/ui/model/odata/v4/ODataModel'`, + message: ({modelName}: {modelName?: string}) => + `Usage of deprecated parameter 'synchronizationMode' ` + + `of constructor 'sap/ui/model/odata/v4/ODataModel'${modelName ? ` (model: '${modelName}')` : ""}`, details: () => - `Parameter 'synchronizationMode' is obsolete and must be omitted. ` + + `As of version 1.110.0, parameter 'synchronizationMode' is obsolete and must be omitted. ` + `{@link sap/ui/model/odata/v4/ODataModel#constructor See API reference}`, }, diff --git a/src/linter/ui5Types/SourceFileLinter.ts b/src/linter/ui5Types/SourceFileLinter.ts index eee9ee88b..a993e2864 100644 --- a/src/linter/ui5Types/SourceFileLinter.ts +++ b/src/linter/ui5Types/SourceFileLinter.ts @@ -588,7 +588,7 @@ export default class SourceFileLinter { } if (synchronizationModeProb) { - this.#reporter.addMessage(MESSAGE.PARTIALLY_DEPRECATED_ODATA_MODEL_V4, synchronizationModeProb); + this.#reporter.addMessage(MESSAGE.DEPRECATED_ODATA_MODEL_V4_SYNCHRONIZATION_MODE, synchronizationModeProb); } } diff --git a/test/lib/linter/rules/snapshots/NoDeprecatedApi.ts.md b/test/lib/linter/rules/snapshots/NoDeprecatedApi.ts.md index 2234d897e..b50c68e9b 100644 --- a/test/lib/linter/rules/snapshots/NoDeprecatedApi.ts.md +++ b/test/lib/linter/rules/snapshots/NoDeprecatedApi.ts.md @@ -497,17 +497,17 @@ Generated by [AVA](https://avajs.dev). { column: 3, line: 29, - message: 'Usage of deprecated parameter \'mParameters.synchronizationMode\' of constructor \'sap/ui/model/odata/v4/ODataModel\'', - messageDetails: 'Parameter \'synchronizationMode\' is obsolete and must be omitted. See API reference (https://ui5.sap.com/1.120/#/api/sap/ui/model/odata/v4/ODataModel#constructor)', - ruleId: 'ui5-linter-no-partially-deprecated-api', + message: 'Usage of deprecated parameter \'synchronizationMode\' of constructor \'sap/ui/model/odata/v4/ODataModel\'', + messageDetails: 'As of version 1.110.0, parameter \'synchronizationMode\' is obsolete and must be omitted. See API reference (https://ui5.sap.com/1.120/#/api/sap/ui/model/odata/v4/ODataModel#constructor)', + ruleId: 'ui5-linter-no-deprecated-property', severity: 2, }, { column: 3, line: 32, - message: 'Usage of deprecated parameter \'mParameters.synchronizationMode\' of constructor \'sap/ui/model/odata/v4/ODataModel\'', - messageDetails: 'Parameter \'synchronizationMode\' is obsolete and must be omitted. See API reference (https://ui5.sap.com/1.120/#/api/sap/ui/model/odata/v4/ODataModel#constructor)', - ruleId: 'ui5-linter-no-partially-deprecated-api', + message: 'Usage of deprecated parameter \'synchronizationMode\' of constructor \'sap/ui/model/odata/v4/ODataModel\'', + messageDetails: 'As of version 1.110.0, parameter \'synchronizationMode\' is obsolete and must be omitted. See API reference (https://ui5.sap.com/1.120/#/api/sap/ui/model/odata/v4/ODataModel#constructor)', + ruleId: 'ui5-linter-no-deprecated-property', severity: 2, }, { @@ -1661,23 +1661,24 @@ Generated by [AVA](https://avajs.dev). column: 13, line: 79, message: 'Use of deprecated property \'sap.ui5/resources/js\'', - ruleId: 'ui5-linter-no-deprecated-property', + messageDetails: 'As of version 1.94, the usage of js resources is deprecated. Please use regular dependencies instead.', + ruleId: 'ui5-linter-no-deprecated-api', severity: 2, }, { column: 21, line: 92, - message: 'Use of deprecated property \'synchronizationMode\' of class \'sap.ui.model.odata.v4.ODataModel\'', - messageDetails: 'As of Version 1.110.0, this parameter is obsolete.', - ruleId: 'ui5-linter-no-deprecated-api', + message: 'Usage of deprecated parameter \'synchronizationMode\' of constructor \'sap/ui/model/odata/v4/ODataModel\' (model: \'odata-v4\')', + messageDetails: 'As of version 1.110.0, parameter \'synchronizationMode\' is obsolete and must be omitted. See API reference (https://ui5.sap.com/1.120/#/api/sap/ui/model/odata/v4/ODataModel#constructor)', + ruleId: 'ui5-linter-no-deprecated-property', severity: 2, }, { column: 21, line: 98, - message: 'Use of deprecated property \'synchronizationMode\' of class \'sap.ui.model.odata.v4.ODataModel\'', - messageDetails: 'As of Version 1.110.0, this parameter is obsolete.', - ruleId: 'ui5-linter-no-deprecated-api', + message: 'Usage of deprecated parameter \'synchronizationMode\' of constructor \'sap/ui/model/odata/v4/ODataModel\' (model: \'odata-v4-via-dataSource\')', + messageDetails: 'As of version 1.110.0, parameter \'synchronizationMode\' is obsolete and must be omitted. See API reference (https://ui5.sap.com/1.120/#/api/sap/ui/model/odata/v4/ODataModel#constructor)', + ruleId: 'ui5-linter-no-deprecated-property', severity: 2, }, { diff --git a/test/lib/linter/rules/snapshots/NoDeprecatedApi.ts.snap b/test/lib/linter/rules/snapshots/NoDeprecatedApi.ts.snap index b96eddd6a..aad2203a7 100644 Binary files a/test/lib/linter/rules/snapshots/NoDeprecatedApi.ts.snap and b/test/lib/linter/rules/snapshots/NoDeprecatedApi.ts.snap differ diff --git a/test/lib/linter/snapshots/linter.ts.md b/test/lib/linter/snapshots/linter.ts.md index 5b7f754f0..b001126c5 100644 --- a/test/lib/linter/snapshots/linter.ts.md +++ b/test/lib/linter/snapshots/linter.ts.md @@ -454,23 +454,24 @@ Generated by [AVA](https://avajs.dev). column: 13, line: 59, message: 'Use of deprecated property \'sap.ui5/resources/js\'', - ruleId: 'ui5-linter-no-deprecated-property', + messageDetails: 'As of version 1.94, the usage of js resources is deprecated. Please use regular dependencies instead.', + ruleId: 'ui5-linter-no-deprecated-api', severity: 2, }, { column: 21, line: 72, - message: 'Use of deprecated property \'synchronizationMode\' of class \'sap.ui.model.odata.v4.ODataModel\'', - messageDetails: 'As of Version 1.110.0, this parameter is obsolete.', - ruleId: 'ui5-linter-no-deprecated-api', + message: 'Usage of deprecated parameter \'synchronizationMode\' of constructor \'sap/ui/model/odata/v4/ODataModel\' (model: \'odata-v4\')', + messageDetails: 'As of version 1.110.0, parameter \'synchronizationMode\' is obsolete and must be omitted. See API reference (https://ui5.sap.com/1.120/#/api/sap/ui/model/odata/v4/ODataModel#constructor)', + ruleId: 'ui5-linter-no-deprecated-property', severity: 2, }, { column: 21, line: 78, - message: 'Use of deprecated property \'synchronizationMode\' of class \'sap.ui.model.odata.v4.ODataModel\'', - messageDetails: 'As of Version 1.110.0, this parameter is obsolete.', - ruleId: 'ui5-linter-no-deprecated-api', + message: 'Usage of deprecated parameter \'synchronizationMode\' of constructor \'sap/ui/model/odata/v4/ODataModel\' (model: \'odata-v4-via-dataSource\')', + messageDetails: 'As of version 1.110.0, parameter \'synchronizationMode\' is obsolete and must be omitted. See API reference (https://ui5.sap.com/1.120/#/api/sap/ui/model/odata/v4/ODataModel#constructor)', + ruleId: 'ui5-linter-no-deprecated-property', severity: 2, }, { diff --git a/test/lib/linter/snapshots/linter.ts.snap b/test/lib/linter/snapshots/linter.ts.snap index 90d715cd3..44de1ddcd 100644 Binary files a/test/lib/linter/snapshots/linter.ts.snap and b/test/lib/linter/snapshots/linter.ts.snap differ