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(Formatter): Detect globals and strings of formatters in bindings…
… (JS/TS) (#499)
- Loading branch information
1 parent
daff87b
commit 291ffed
Showing
6 changed files
with
152 additions
and
5 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
14 changes: 14 additions & 0 deletions
14
test/fixtures/linter/rules/NoGlobals/FormatterGlobalBindingObject.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/Input", "ui5/walkthrough/model/formatter"], | ||
(Input, formatter) => { | ||
// Should be detected as "unsupported-api-usage" (formatter is a string): | ||
const input = new Input({ | ||
value: { path: 'invoice>Status', formatter: 'formatter.statusText' } | ||
}); | ||
|
||
// Should NOT be detected: | ||
const input2 = new Input({ | ||
value: { path: 'invoice>Status', formatter: formatter.statusText } | ||
}); | ||
} | ||
); |
18 changes: 18 additions & 0 deletions
18
test/fixtures/linter/rules/NoGlobals/FormatterGlobalBindingString.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,18 @@ | ||
sap.ui.define( | ||
["sap/m/Input", "ui5/walkthrough/model/formatter"], | ||
(Input, formatter) => { | ||
// The following two cases using global notations should be detected: | ||
const input = new Input({ | ||
value: "{ path: 'invoice>Status', formatter: 'ui5.walkthrough.model.formatter.statusText' }" | ||
}); | ||
input.applySettings({ | ||
value: "{ path: 'invoice>Status', formatter: 'ui5.walkthrough.model.formatter.statusText' }", | ||
}); | ||
|
||
// Although the formatter property does not look like a global notation, | ||
// it should still be detected if it is a string: | ||
const input2 = new Input({ | ||
value: "{ path: 'invoice>Status', formatter: 'formatter.statusText' }" | ||
}); | ||
} | ||
); |
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.