generated from SAP/repository-template
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: OData implicit globals detection (JS/TS) (#533)
Also improves the existing detection in XML which now also detects multiple function calls within one binding. JIRA: CPOUI5FOUNDATION-1008
- Loading branch information
Showing
16 changed files
with
542 additions
and
36 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
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
11 changes: 11 additions & 0 deletions
11
test/fixtures/linter/rules/NoGlobals/NoImplicitGlobalsOData.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,11 @@ | ||
sap.ui.define(["sap/m/Text"], (Text) => { | ||
const oText1 = new Text({ | ||
text: "{= odata.compare(%{myvalue1},%{myvalue2})}" | ||
}); | ||
const oText2 = new Text({ | ||
text: "{= odata.fillUriTemplate(${myvalue1},${myvalue2})}" | ||
}); | ||
oText2.applySettings({ | ||
text: "{= odata.uriEncode(%{myvalue1},'Edm.String') + ' - ' + odata.uriEncode(%{myvalue2},'Edm.String') }" | ||
}); | ||
}); |
14 changes: 14 additions & 0 deletions
14
test/fixtures/linter/rules/NoGlobals/NoImplicitGlobalsOData_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,14 @@ | ||
sap.ui.define(["sap/m/Text", "sap/ui/model/odata/ODataExpressionAddons"], (Text) => { | ||
const oText1 = new Text({ | ||
text: "{= odata.compare(%{myvalue1},%{myvalue2})}" | ||
}); | ||
const oText2 = new Text({ | ||
text: "{= odata.fillUriTemplate(${myvalue1},${myvalue2})}" | ||
}); | ||
oText2.applySettings({ | ||
text: "{= odata.uriEncode(%{myvalue1},'Edm.String') + ' - ' + odata.uriEncode(%{myvalue2},'Edm.String') }" | ||
}); | ||
oText2.applySettings({ | ||
text: `\\{"foo": "bar"}` // Escaped JSON string should not cause issues when checking for odata globals within a binding | ||
}); | ||
}); |
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
Oops, something went wrong.