-
Notifications
You must be signed in to change notification settings - Fork 8.5k
disallow external imports to src/core/utils #64852
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
disallow external imports to src/core/utils #64852
Conversation
c4b2c90 to
4c86c5e
Compare
src/core/server/index.ts
Outdated
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.
@joshdover I'm surprised we have this in utils. Shouldn't we move it to the application or another service instead? utils are meant to provide functionality extending the language standard library.
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.
I believe this is utils due to problems with importing from server into public. We can't use the server/types workaround since this is a value. Long-term we could fix this by either leveraging a common directory or the organize by domain proposal for core #52182
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.
Ok, I think we can get rid of the server-side use-cases when all plugin migrate to KP most plugins migrate to KP and we can inline values in the remaining cases.
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.
DEFAULT_APP_CATEGORIES 'util' was introduced during the grouped nav PR, because these values needed to be accessed by the legacy apps registrations that are performed on the server-side. I agree with @restrry that once we only have a small amount of legacy app registrations, moving this back to client-side and using inline values for the legacy apps would be an acceptable solution.
2e768c5 to
1331b8d
Compare
1331b8d to
ccdb8e7
Compare
|
@elasticmachine merge upstream |
…ports-for-core-utils # Conflicts: # x-pack/legacy/plugins/canvas/index.js
|
Pinging @elastic/kibana-operations (Team:Operations) |
|
@elasticmachine merge upstream |
nreese
left a comment
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.
maps LGTM
code review
jportner
left a comment
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.
Security changes LGTM
chrisronline
left a comment
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.
LGTM for stack monitoring
crob611
left a comment
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.
Canvas looks fine 👍
mikecote
left a comment
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.
Alerting changes LGTM
mattkime
left a comment
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.
app arch changes lgtm
dgieselaar
left a comment
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.
APM changes LGTM
nchaulet
left a comment
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.
Ingest management changes LGTM
jasonrhodes
left a comment
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.
Infra and Ingest Manager changes LGTM, just simple path changes 👍
wylieconlon
left a comment
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.
Scanned all the code changes, LGTM. Left a question to confirm my understanding.
| // https://www.typescriptlang.org/docs/handbook/advanced-types.html#exhaustiveness-checking | ||
| export function assertNever(x: never): never { | ||
| throw new Error(`Unexpected object: ${x}`); | ||
| } |
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.
Why not import this assertNever just like all the otherrs? Is it because it's in common?
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, there isn't currently a common import for src/core and it was just so simple.
joshdover
left a comment
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.
Platform changes LGTM
|
@elasticmachine merge upstream |
|
Pinging @elastic/apm-ui (Team:apm) |
💚 Build SucceededHistory
To update your PR or re-run it, just comment with: |
While working on #64843 I noticed a number of imports for the
src/core/utilsmodule, which the platform team didn't expect to be used externally, so I've re-exported portions of that module fromsrc/core/serverandsrc/core/public, updated all uses, and added an eslint config to validate we don't add moresrc/core/utilsimports down the road.