generated from SAP/repository-template
-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Detect usage of non exported values by library.js #468
Merged
Merged
Changes from all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
4de7e91
feat: Add new message type
d3xter666 595e0d3
feat: Detect exported values by library
d3xter666 5f1e58a
refactor: Use getter for the name
d3xter666 57b7956
test: Add test cases
d3xter666 c51cb02
fix: Breaking check
d3xter666 5b5f3db
test: Add more test cases
d3xter666 c11d7a8
refactor: Add support for PropertyAccessExpression-s
d3xter666 3cb4e5e
test: Update snapshots
d3xter666 68ee498
test: Fix test cases
d3xter666 0c2b254
refactor: Improve messaging
d3xter666 5207d26
fix: Allow ElementAccessExpressions
d3xter666 ff8910e
test: Add more test cases
d3xter666 3a5a668
docs: Update comments
d3xter666 8bb9d55
fix: Merge conflicts
d3xter666 82a2920
refactor: Remove redundant check
d3xter666 9a39a75
test: Remove redundant tests
d3xter666 ccf7380
fix: Properly detect non exported elements
d3xter666 46c7683
test: Update snapshots with the correct findings
d3xter666 b5dccb3
refactor: Exported values messaging
d3xter666 d6e3f0f
test: Update snapshots w/ the new messages
d3xter666 2cbb8f4
refactor: Restore the non exported negative examples
d3xter666 ef38758
refactor: Update messages
d3xter666 c6bde70
fix: Resolve nested namespaces
d3xter666 734d1fb
test: Update snapshots
d3xter666 3d050be
refactor: Move sample to the negative test
d3xter666 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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/NoExportedLibValues.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/ui/unified/library", "sap/ui/core/library"], | ||
function (unifiedLibrary, coreLibrary) { | ||
"use strict"; | ||
|
||
var CalendarDayType = unifiedLibrary.CalendarDayType, | ||
DateRange = unifiedLibrary["DateRange"], | ||
DateTypeRange = unifiedLibrary.DateTypeRange, | ||
DOMAttribute = coreLibrary.tmpl.DOMAttribute, | ||
DOMAttribute2 = coreLibrary["tmpl"].DOMAttribute, | ||
DOMAttribute3 = coreLibrary["tmpl"]["DOMAttribute"], | ||
DOMAttribute4 = coreLibrary.tmpl["DOMAttribute"]; | ||
} | ||
); |
23 changes: 23 additions & 0 deletions
23
test/fixtures/linter/rules/NoGlobals/NoExportedLibValues_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,23 @@ | ||
sap.ui.define( | ||
[ | ||
"sap/ui/unified/library", | ||
"sap/ui/core/library", | ||
"sap/ui/comp/library", | ||
// This ones are correct- elements, imported as modules | ||
"sap/ui/unified/DateTypeRange", | ||
"sap/ui/unified/CalendarDayType", | ||
], | ||
function (unifiedLibrary, coreLibrary, compLibrary) { | ||
"use strict"; | ||
|
||
// These are data types that are actually exported by the library | ||
var SelectOptionSign = compLibrary.smartfilterbar.SelectOptionSign; | ||
|
||
var CalendarAppointmentHeight = | ||
unifiedLibrary.CalendarAppointmentHeight, | ||
CalendarAppointmentRoundWidth = | ||
unifiedLibrary.CalendarAppointmentRoundWidth, | ||
ColorPickerMode = unifiedLibrary.ColorPickerMode, | ||
ContentSwitcherAnimation = unifiedLibrary.ContentSwitcherAnimation; | ||
} | ||
); |
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is actually a pseudo module (see finding in test snapshot), and it should rather be accessed via the library module.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, and that's why I added it. With the prevous miss, actually the pseudo modules were also reported as non exported values. Let's leave this as a safeguard.