-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[discuss] Need shared pattern for plugin private common
code
#118826
Comments
Pinging @elastic/kibana-core (Team:Core) |
This is just about a pattern right? We're not expecting to allow If that's the case, I'm personally fine with it. I would change |
This is forbidden by Lines 514 to 529 in 9a8499c
We didn't want to introduce another environment and wanted plugins to import only from |
Okay, I'll take a closer look at this, perhaps I was mistaken. |
Either I'm confused or I see quite a number of exceptions to this - https://github.com/elastic/kibana/pull/126315/files |
@mattkime As Mikhail pointed out above, the intent for sharing static code has always been that we should only be importing from Other than that scenario, I'd recommend avoiding cross-plugin As for how to distinguish between shared and internal common code, I think this is mostly determined by the The mechanics of how you export private code is an implementation detail of your plugin, and I think there are several viable options -- including |
@lukeelmers I guess the |
I actually don't think it's that we are taking |
Its clear that at very least we should remove imports from Past that, I'm confused why dashboards
clearly, this isn't true and I don't understand why. |
Thanks for tagging me @lukeelmers. I would actually like to see I don't see anything wrong with @mattkime's original suggestion, though sounds like we'd have to fix the lint rules to allow deep imports from the same plugin's server and public dirs. cc @spalger |
@mattkime Yeah, I think the reason why our eslint rules don't currently enforce this is precisely because of the existence of
The existing lint rules should already allow for this. e.g. if I am in
Agreed 🙂 Spencer marked this setting as deprecated from the beginning in #68986, with the understanding that this was only ever intended as a temporary solution as we worked on better ways of sharing static code. But I think we could instead enforce that sharing of static code only happens from |
The problem -
We have three directories we export from -
public
,server
, andcommon
. Code exported frompublic
andserver
can only be consumed by other plugins but code exported fromcommon
may either be consumed by other plugins OR may be exported for internal use bypublic
orserver
functionality. Currently, as best I can tell, we don't have an agreed upon pattern for drawing a distinction between the two intentions.The proposal -
common/index.ts
will be exports for other plugins.common/private.ts
will be for internal use.The text was updated successfully, but these errors were encountered: