generated from SAP/repository-template
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Detect usage of deprecated jQuery.sap API
So far, only the usage of global API such as `jQuery.sap` was detected. However, when using `jQuery` as local variable via a dependency, the usage of `jQuery.sap` was not detected, although all APIs within that namespace are deprecated.
- Loading branch information
Showing
13 changed files
with
272 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
import "./jquery.sap.mobile"; | ||
import "./jquery.sap"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
// General deprecation of jQuery.sap namespace | ||
interface JQueryStatic { | ||
/** | ||
* @deprecated since 1.58. To avoid usage of global variables in general, please | ||
* do not use the jQuery.sap namespace any longer. Most of the jQuery.sap functionalities | ||
* are replaced by alternative modules which can be found in the API doc. | ||
*/ | ||
sap: object; | ||
} | ||
|
||
// Add exports of all jquery.sap.* modules (except for "jquery.sap.promise" which does not export jQuery) | ||
declare module "jquery.sap.act" { | ||
export default jQuery; | ||
} | ||
declare module "jquery.sap.dom" { | ||
export default jQuery; | ||
} | ||
declare module "jquery.sap.encoder" { | ||
export default jQuery; | ||
} | ||
declare module "jquery.sap.events" { | ||
export default jQuery; | ||
} | ||
declare module "jquery.sap.global" { | ||
export default jQuery; | ||
} | ||
declare module "jquery.sap.history" { | ||
export default jQuery; | ||
} | ||
declare module "jquery.sap.keycodes" { | ||
export default jQuery; | ||
} | ||
declare module "jquery.sap.mobile" { | ||
export default jQuery; | ||
} | ||
declare module "jquery.sap.properties" { | ||
export default jQuery; | ||
} | ||
declare module "jquery.sap.resources" { | ||
export default jQuery; | ||
} | ||
declare module "jquery.sap.script" { | ||
export default jQuery; | ||
} | ||
declare module "jquery.sap.sjax" { | ||
export default jQuery; | ||
} | ||
declare module "jquery.sap.storage" { | ||
export default jQuery; | ||
} | ||
declare module "jquery.sap.strings" { | ||
export default jQuery; | ||
} | ||
declare module "jquery.sap.stubs" { | ||
export default jQuery; | ||
} | ||
declare module "jquery.sap.trace" { | ||
export default jQuery; | ||
} | ||
declare module "jquery.sap.ui" { | ||
export default jQuery; | ||
} | ||
declare module "jquery.sap.xml" { | ||
export default jQuery; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,7 +11,3 @@ interface JQueryStatic { | |
*/ | ||
device: object; | ||
} | ||
|
||
declare module "jquery.sap.mobile" { | ||
export default jQuery; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 0 additions & 3 deletions
3
test/fixtures/linter/rules/NoDeprecatedApi/jQuery.sap-global.js
This file was deleted.
Oops, something went wrong.
3 changes: 0 additions & 3 deletions
3
test/fixtures/linter/rules/NoDeprecatedApi/jQuery.sap-jquery.js
This file was deleted.
Oops, something went wrong.
3 changes: 0 additions & 3 deletions
3
test/fixtures/linter/rules/NoDeprecatedApi/jQuery.sap-module.js
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
sap.ui.define(["sap/ui/thirdparty/jquery", "jquery.sap.properties"], function(importedJQuery, importedJQuerySapProperties) { | ||
|
||
// Global access | ||
var oProperties1 = jQuery.sap.properties(); // jQuery.sap.properties is deprecated | ||
var oProperties2 = jQuery["sap"].properties(); // jQuery.sap.properties is deprecated | ||
var oProperties3 = jQuery["sap"]["properties"](); // jQuery.sap.properties is deprecated | ||
|
||
// via thirdparty jQuery | ||
var oProperties1 = importedJQuery.sap.properties(); // jQuery.sap.properties is deprecated | ||
var oProperties2 = importedJQuery["sap"].properties(); // jQuery.sap.properties is deprecated | ||
var oProperties3 = importedJQuery["sap"]["properties"](); // jQuery.sap.properties is deprecated | ||
|
||
// via jquery.sap module | ||
var oProperties1 = importedJQuerySapProperties.sap.properties(); // jQuery.sap.properties is deprecated | ||
var oProperties2 = importedJQuerySapProperties["sap"].properties(); // jQuery.sap.properties is deprecated | ||
var oProperties3 = importedJQuerySapProperties["sap"]["properties"](); // jQuery.sap.properties is deprecated | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Oops, something went wrong.