-
Notifications
You must be signed in to change notification settings - Fork 174
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
Add eslint rule to forbid imports from path containing packages/ from root dir of OSD #1500
Add eslint rule to forbid imports from path containing packages/ from root dir of OSD #1500
Conversation
Signed-off-by: Craig Perkins <[email protected]>
… root dir of OSD Signed-off-by: Craig Perkins <[email protected]>
basePath: __dirname, | ||
zones: [ | ||
{ | ||
target: ['(public|server)/**/*'], |
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.
Can these be expanded, maybe .ts/.js files under any path?
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.
@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.
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 |
@DarshitChanpura @RyanL1997 @cliu123 @davidlago Could we get another review on this change? |
… root dir of OSD (opensearch-project#1500) * Add lint rule to forbid imports from packages Signed-off-by: Craig Perkins <[email protected]> * Add eslint rule to forbid imports from path containing packages/ from root dir of OSD Signed-off-by: Craig Perkins <[email protected]> --------- Signed-off-by: Craig Perkins <[email protected]> Co-authored-by: Stephen Crawford <[email protected]> Co-authored-by: Peter Nied <[email protected]> Signed-off-by: Sam <[email protected]>
Description
Opening a Draft PR with a new eslint rule forbidding imports from
./packages
directory 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.