Skip to content
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

Enforce shimmed plugin boundaries #52633

Merged
merged 24 commits into from
Dec 20, 2019
Merged

Conversation

flash1293
Copy link
Contributor

@flash1293 flash1293 commented Dec 10, 2019

This PR introduces new linting rules for the shimmed plugins of the kibana app team ('visualize, discover, dashboard, devTools, home) that validate no cross-imports are made and all imports from legacy world are centralized. Following the convention of other plugins everything within the np_ready directory within a plugin should be free of these kind of imports and nothing from within these directories is imported directly somewhere else

Pieces that are not covered by the shim have not been moved into np_ready. As the visulize embeddable is going to move into the visualizations plugin, it is moved out of the visualize plugin completely into its own directory visualize_embeddable.

@kertal
Copy link
Member

kertal commented Dec 10, 2019

@flash1293 thx, i will have a look and take care of Discover related stuff

@flash1293
Copy link
Contributor Author

Jenkins, test this.

@flash1293 flash1293 marked this pull request as ready for review December 12, 2019 17:13
@flash1293 flash1293 requested review from a team as code owners December 12, 2019 17:13
@flash1293 flash1293 added the release_note:skip Skip the PR/issue when compiling release notes label Dec 13, 2019
Copy link
Contributor

@lizozom lizozom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only 1 file for @elastic/kibana-app-arch changed.
LGTM

Copy link
Contributor

@cchaos cchaos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most of these SASS imports would be more manageable with moves like this if each folder has its own _index.scss manifest file. It still compiles as-is, but with the addition of the np_ready folders, they really should have their own manifests.

I can help with this structure if need be.

@import 'components/field_chooser/index';
@import 'angular/directives/index';
@import 'angular/doc_table/index';
@import 'np_ready/components/fetch_error/index';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The np_ready folder should really have its own _index.scss manifest file.

@import 'np_ready/components/fetch_error/index';
@import 'np_ready/components/field_chooser/index';
@import 'np_ready/angular/directives/index';
@import 'np_ready/angular/doc_table/index';

@import 'hacks';

@import 'discover';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These files and _mixins.scss should also be moved to np_ready folder

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Essentially this whole file should be moved to np_ready and then this file just imports the index file from there.

Copy link
Contributor Author

@flash1293 flash1293 Dec 16, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good point @cchaos , thanks for raising. I totally agree to have index files for the sub folders. But I would like to ignore the np_ready folder while doing this because it is just a temporary measure and will go away when we move discover to the new platform - so _index.scss for components and angular, but not for np_ready.

Also strictly speaking scss is not "np ready" because there is no way to compile scss in the new platform yet: #42185 It shouldn't be an issue for discover because once we move it over there probably will be a solution, but when we are cleaning up those imports it would be good to keep the future structure in mind (which is like today, but np_ready merged into the top level directly)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The main reason to consider it for np_ready is if you have the manifest in plugin/np_ready/_index.scss like:

@import 'discover';
@import 'components/index';
...etc...

Then when you move/rename the whole np_ready folder, you don't have to change any of the imports in the _index.scss manifest file, you just change the single import of the index file.

Whereas right now you have many import paths directing to /np_ready/... explicitly that would need to change.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right, I moved them into np_ready - doing it like this means the smallest change later when we migrate.

@flash1293 flash1293 added the Team:Visualizations Visualization editors, elastic-charts and infrastructure label Dec 17, 2019
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-app (Team:KibanaApp)

@flash1293
Copy link
Contributor Author

Jenkins, test this. I can't reproduce this failing test locally, checking whether it's just flaky

Copy link
Contributor

@darnautov darnautov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@cqliu1 cqliu1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Canvas changes LGTM 👍

Copy link
Member

@kertal kertal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code LGTM, thanks for cleaning up some discover leftovers!

Copy link
Contributor

@cchaos cchaos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found a missing import and another optional opportunity to create a manifest file inside np_ready.

@@ -0,0 +1,2 @@
@import 'fetch_error/index';
@import 'field_chooser/index';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing the doc_viewer/index import

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, fixed!

Comment on lines 8 to 10
@import 'np_ready/editor/index';
@import 'np_ready/listing/index';
@import 'np_ready/wizard/index';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another opportunity to not list np_ready multiple times

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, took same approach as in discover

Copy link
Contributor

@cchaos cchaos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@flash1293 flash1293 merged commit 06d26f6 into elastic:master Dec 20, 2019
@flash1293 flash1293 deleted the lint-import-paths branch December 20, 2019 18:02
flash1293 added a commit to flash1293/kibana that referenced this pull request Dec 20, 2019
flash1293 added a commit that referenced this pull request Dec 20, 2019
* Enforce shimmed plugin boundaries (#52633)

* resolve conflicts around field chooser
jkelastic pushed a commit to jkelastic/kibana that referenced this pull request Jan 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:NP Migration release_note:skip Skip the PR/issue when compiling release notes Team:Visualizations Visualization editors, elastic-charts and infrastructure v7.6.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants