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: Analyze sap.ui.core.Lib.init() call (#33)
JIRA: CPOUI5FOUNDATION-793 Adds checks whether `Lib.init()` has been called with `apiVersion: 2` property. --------- Co-authored-by: Matthias Oßwald <[email protected]> Co-authored-by: Merlin Beutlberger <[email protected]>
- Loading branch information
1 parent
3c2d0a2
commit 6d5bcdb
Showing
5 changed files
with
277 additions
and
0 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
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,42 @@ | ||
/*! | ||
* ${copyright} | ||
*/ | ||
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: 1 | ||
}); | ||
|
||
const LibInit = Library.init; | ||
LibInit({ | ||
apiVersion: 1 | ||
}); | ||
|
||
const {init} = Library; | ||
init({ | ||
apiVersion: 1 | ||
}); | ||
|
||
const {init: intRenames} = Library; | ||
intRenames({ | ||
apiVersion: 1 | ||
}); | ||
}); |
36 changes: 36 additions & 0 deletions
36
test/fixtures/linter/rules/NoDeprecatedApi/library_negative.js
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,36 @@ | ||
/*! | ||
* ${copyright} | ||
*/ | ||
sap.ui.define([ | ||
"sap/ui/core/Lib", | ||
], function (Library) { | ||
"use strict"; | ||
|
||
Library.init({ | ||
apiVersion: 2 | ||
}); | ||
|
||
Library["init"]({ | ||
apiVersion: 2 | ||
}); | ||
|
||
// Should be ignored | ||
Library.load({ | ||
apiVersion: 23 | ||
}); | ||
|
||
const LibInit = Library.init; | ||
LibInit({ | ||
apiVersion: 2 | ||
}); | ||
|
||
const {init} = Library; | ||
init({ | ||
apiVersion: 2 | ||
}); | ||
|
||
const {init: intRenames} = Library; | ||
intRenames({ | ||
apiVersion: 2 | ||
}); | ||
}); |
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.