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 for formatters in JS/TS
- Loading branch information
1 parent
8d2ad2f
commit d11d061
Showing
9 changed files
with
162 additions
and
159 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
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
9 changes: 6 additions & 3 deletions
9
test/fixtures/linter/projects/com.ui5.troublesome.app/ui5lint-custom-broken.config.cjs
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,4 +1,7 @@ | ||
module.exports = { | ||
ignores: [ | ||
// CodeQL code scan complains about this file being broken. | ||
// This is a case we test for the config manager. So, wrapping it in a JSON.parse to avoid the error there, | ||
// but keep the test case valid. | ||
module.exports = JSON.parse(`{ | ||
"ignores": [ | ||
"test/**/*", | ||
"!test/sap/m/visual/Wizard.spe | ||
"!test/sap/m/visual/Wizard.spe`); |
8 changes: 8 additions & 0 deletions
8
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,8 @@ | ||
sap.ui.define( | ||
["sap/m/Input"], | ||
(Input) => { | ||
const input = 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' }" | ||
}); | ||
} | ||
); |
Oops, something went wrong.