Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Detect partially deprecated APIs #286

Merged
merged 12 commits into from
Sep 12, 2024
93 changes: 93 additions & 0 deletions src/linter/messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,14 @@ export enum MESSAGE {
NO_DIRECT_DATATYPE_ACCESS,
NO_DIRECT_ENUM_ACCESS,
NO_GLOBALS,
PARTIALLY_DEPRECATED_PARAMETERS_GET,
PARTIALLY_DEPRECATED_CREATE_COMPONENT,
PARTIALLY_DEPRECATED_ODATA_MODEL_V2_CREATE_ENTRY,
PARTIALLY_DEPRECATED_ODATA_MODEL_V2_CREATE_ENTRY_PROPERTIES_ARRAY,
PARTIALLY_DEPRECATED_JSON_MODEL_LOAD_DATA,
PARTIALLY_DEPRECATED_MOBILE_INIT,
PARTIALLY_DEPRECATED_CORE_ROUTER,
PARTIALLY_DEPRECATED_ODATA_MODEL_V4,
}
export const MESSAGE_INFO = {

Expand Down Expand Up @@ -145,4 +153,89 @@ export const MESSAGE_INFO = {
details: () => undefined,
},

[MESSAGE.PARTIALLY_DEPRECATED_PARAMETERS_GET]: {
severity: LintMessageSeverity.Error,
ruleId: RULES["ui5-linter-no-partially-deprecated-api"],

message: () =>
`Usage of deprecated variant of 'sap/ui/core/theming/Parameters.get'`,
details: () => `{@link sap.ui.core.theming.Parameters#sap.ui.core.theming.Parameters.get Parameters.get}`,
},

[MESSAGE.PARTIALLY_DEPRECATED_CREATE_COMPONENT]: {
severity: LintMessageSeverity.Error,
ruleId: RULES["ui5-linter-no-partially-deprecated-api"],

message: () =>
`Usage of deprecated value for parameter 'async' of 'sap/ui/core/Component#createComponent'`,
details: () => `Property 'async' must be either omitted or set to true. ` +
`{@link sap.ui.core.Component#createComponent See API reference}`,
},

[MESSAGE.PARTIALLY_DEPRECATED_ODATA_MODEL_V2_CREATE_ENTRY]: {
severity: LintMessageSeverity.Error,
ruleId: RULES["ui5-linter-no-partially-deprecated-api"],

message: () =>
`Usage of deprecated parameter 'batchGroupId' in 'sap/ui/model/odata/v2/ODataModel#createEntry'`,
details: () => `Use parameter 'groupId' instead. ` +
`{@link sap.ui.model.odata.v2.ODataModel#createEntry See API reference}`,
},

[MESSAGE.PARTIALLY_DEPRECATED_ODATA_MODEL_V2_CREATE_ENTRY_PROPERTIES_ARRAY]: {
severity: LintMessageSeverity.Error,
ruleId: RULES["ui5-linter-no-partially-deprecated-api"],

message: () =>
`Usage of deprecated value for parameter 'properties' in 'sap/ui/model/odata/v2/ODataModel#createEntry'`,
details: () =>
`Passing a list of property names is deprecated. Pass the initial values as an object instead. ` +
`{@link sap.ui.model.odata.v2.ODataModel#createEntry See API reference}`,
},

[MESSAGE.PARTIALLY_DEPRECATED_JSON_MODEL_LOAD_DATA]: {
severity: LintMessageSeverity.Error,
ruleId: RULES["ui5-linter-no-partially-deprecated-api"],

message: ({paramName}: {paramName: string}) =>
`Usage of deprecated value for parameter '${paramName}' of 'sap/ui/model/json/JSONModel#loadData'`,
details: ({paramName}: {paramName: string}) =>
`Parameter '${paramName}' must be either omitted or set to true. ` +
`{@link sap.ui.model.json.JSONModel#loadData See API reference}`,
},

[MESSAGE.PARTIALLY_DEPRECATED_MOBILE_INIT]: {
severity: LintMessageSeverity.Error,
ruleId: RULES["ui5-linter-no-partially-deprecated-api"],

message: ({paramName}: {paramName: string}) =>
`Usage of deprecated value for parameter '${paramName}' of 'sap/ui/util/Mobile#init'`,
details: ({paramName}: {paramName: string}) =>
`Parameter '${paramName}' must be either omitted or set to true. ` +
`{@link sap.ui.util.Mobile#init See API reference}`,
},

[MESSAGE.PARTIALLY_DEPRECATED_CORE_ROUTER]: {
severity: LintMessageSeverity.Error,
ruleId: RULES["ui5-linter-no-partially-deprecated-api"],

message: () =>
`Usage of deprecated value for parameter 'oConfig.async' of constructor 'sap/ui/core/Router'`,
details: () =>
`Parameter 'oConfig.async' must be set to true. ` +
`{@link sap/ui/core/routing/Router#constructor See API reference}`,
},

[MESSAGE.PARTIALLY_DEPRECATED_ODATA_MODEL_V4]: {
severity: LintMessageSeverity.Error,
ruleId: RULES["ui5-linter-no-partially-deprecated-api"],

message: () =>
`Usage of deprecated parameter 'mParameters.synchronizationMode' ` +
`of constructor 'sap/ui/model/odata/v4/ODataModel'`,
details: () =>
`Parameter 'synchronizationMode' is obsolete and must be omitted. ` +
`{@link sap/ui/model/odata/v4/ODataModel#constructor See API reference}`,
},

} as const;
Loading