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

Missing autofix for methods related to jQuery.sap.* (String Utils) #527

Open
6 tasks
flovogt opened this issue Feb 11, 2025 · 1 comment
Open
6 tasks

Missing autofix for methods related to jQuery.sap.* (String Utils) #527

flovogt opened this issue Feb 11, 2025 · 1 comment
Labels
autofix An issue related to the autofix capabilities enhancement New feature or request

Comments

@flovogt
Copy link
Member

flovogt commented Feb 11, 2025

Missing autofix for methods related to jQuery.sap.* (String Utils)

Methods related to jQuery.sap.* (String Utils) are deprecated. Therefore an autofix should be offered by UI5 linter.

Deprecated APIs:

  • jQuery.sap.camelCase
  • jQuery.sap.charToUpperCase
  • jQuery.sap.escapeRegExp
  • jQuery.sap.formatMessage
  • jQuery.sap.hashCode
  • jQuery.sap.hyphen

Deprecated Usage

var textCamelVase = jQuery.sap.camelCase(" First Name Last ");
var textUpperCase = jQuery.sap.charToUpperCase("myValue", 0);
var textEscapedRegx = jQuery.sap.escapeRegExp("ab.c");
var textWithReplacedPlaceholder = jQuery.sap.formatMessage("Say '{0}'", ["Hello"]);
var hashCode = jQuery.sap.hashCode("test");
var textHyphenated = jQuery.sap.hyphen("fooBar");

Recommended Usage

sap.ui.define([
  "sap/base/strings/camelize",
  "sap/base/strings/capitalize",
  "sap/base/strings/escapeRegExp",
  "sap/base/strings/formatMessage",
  "sap/base/strings/hash",
  "sap/base/strings/hyphenate"
], (camelize, capitalize, escapeRegExp, formatMessage, hash, hyphenate) => {
  var textCamelVase = camelize(" First Name Last ");
  var textUpperCase = capitalize("myValue");
  var textEscapedRegx = escapeRegExp("ab.c");
  var textWithReplacedPlaceholder = formatMessage("Say '{0}'", ["Hello"]);
  var hashCode = hash("test");
  var textHyphenated = hyphenate("fooBar");
});

Note for jQuery.sap.charToUpperCase: If no position is given or when it is negative or beyond the last character of the given string, the first character will be converted to upper case.

Note: In older UI5 versions, there were two additional jQuery based APIs available. jQuery.sap.unicode and jQuery.sap.isStringNFC. With UI5 1.58, these APIs were replaced by sap/base/strings/NormalizePolyfill. With the de-support of IE11, all three APIs (also NormalizePolyfill) were removed from the code base because functionality is already supported by native browser APIs. We should also come up with a proposal to offer a migration for these three cases.

@flovogt flovogt added autofix An issue related to the autofix capabilities enhancement New feature or request labels Feb 11, 2025
@flovogt
Copy link
Member Author

flovogt commented Feb 11, 2025

Will be implemented in CPOUI5FOUNDATION-990.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
autofix An issue related to the autofix capabilities enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant