Add eslint rule to forbid imports from path containing packages/ from root dir of OSD#1500
Merged
davidlago merged 5 commits intoopensearch-project:mainfrom Jul 19, 2023
Merged
Conversation
Signed-off-by: Craig Perkins <cwperx@amazon.com>
… root dir of OSD Signed-off-by: Craig Perkins <cwperx@amazon.com>
peternied
reviewed
Jul 10, 2023
| basePath: __dirname, | ||
| zones: [ | ||
| { | ||
| target: ['(public|server)/**/*'], |
Member
There was a problem hiding this comment.
Can these be expanded, maybe .ts/.js files under any path?
Member
Author
There was a problem hiding this comment.
@peternied Sorry I did not see this comment last week. This was modeled after eslint rules from OSD core. Example: https://github.com/opensearch-project/OpenSearch-Dashboards/blob/main/.eslintrc.js#L320-L334
I was trying to add this rule to OSD Core instead of this repo to enforce it across all dashboards plugins, but I was not ultimately able to figure out how to.
peternied
approved these changes
Jul 10, 2023
Codecov Report
@@ Coverage Diff @@
## main #1500 +/- ##
=======================================
Coverage 66.06% 66.06%
=======================================
Files 93 93
Lines 2328 2328
Branches 310 310
=======================================
Hits 1538 1538
Misses 722 722
Partials 68 68 |
Member
|
@DarshitChanpura @RyanL1997 @cliu123 @davidlago Could we get another review on this change? |
davidlago
approved these changes
Jul 19, 2023
samuelcostae
pushed a commit
to samuelcostae/security-dashboards-plugin
that referenced
this pull request
Aug 10, 2023
… root dir of OSD (opensearch-project#1500) * Add lint rule to forbid imports from packages Signed-off-by: Craig Perkins <cwperx@amazon.com> * Add eslint rule to forbid imports from path containing packages/ from root dir of OSD Signed-off-by: Craig Perkins <cwperx@amazon.com> --------- Signed-off-by: Craig Perkins <cwperx@amazon.com> Co-authored-by: Stephen Crawford <65832608+scrawfor99@users.noreply.github.com> Co-authored-by: Peter Nied <petern@amazon.com> Signed-off-by: Sam <samuel.costa@eliatra.com>
1 task
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
Opening a Draft PR with a new eslint rule forbidding imports from
./packagesdirectory of OpenSearch dashboards which is only used for development. I added the rule directly into security-dashboards-plugin to show it working, but it would probably be best to place this directly in OSD. I have not been able to get this working with a rule in OSD core and not quite sure how dashboards plugins inherit rules from the OSD core.I see the following rule in OSD core which looks like it should have caught the bad import: https://github.com/opensearch-project/OpenSearch-Dashboards/blob/main/.eslintrc.js#L295-L319
Category
Bug fix
Issues Resolved
#1487
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.