-
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
[eslint] enable type-specific lint rules #114184
[eslint] enable type-specific lint rules #114184
Conversation
2b53991
to
53d7fd7
Compare
8ebbfb1
to
ed5dcd9
Compare
@elasticmachine merge upstream |
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 monitoring
plugin code changes LGTM
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.
Thank you for doing this.
@spenceralger should we create a meta-issue to track the effort? or will plugins be able to add it on a voluntary basis? |
I'm not planning on forcing plugins to enable it as of right now, but I think it's a reasonable initiative if folks think it's a good idea. The plan is for plugins to opt-into for now. |
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 Solution Management changes LGTM!
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.
ML and Transform changes LGTM
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.
Code only review, Presentation team changes LGTM! Super exciting change
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.
VisEditors changes LGTM
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.
kibana app services change lgtm
@elasticmachine merge upstream |
…kibana into implement/type-specific-linting
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 look good.
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.
Asset management LGTM
💚 Build Succeeded
Metrics [docs]Module Count
Async chunks
Page load bundle
History
To update your PR or re-run it, just comment with: cc @spalger |
Thanks to everyone who reviewed this, the changes still requiring reviews are all made automatically by well a tested eslint rule. I'm going to merge to prevent a 5th conflict resolution today. |
💔 Backport failed
To backport manually run: |
* [eslint] enable type-specific lint rules * autofix violations * duplicate eslint-disable to new export statement Co-authored-by: spalger <[email protected]> Co-authored-by: Kibana Machine <[email protected]> # Conflicts: # src/plugins/share/common/index.ts
* [eslint] enable type-specific lint rules (#114184) * [eslint] enable type-specific lint rules * autofix violations * duplicate eslint-disable to new export statement Co-authored-by: spalger <[email protected]> Co-authored-by: Kibana Machine <[email protected]> # Conflicts: # src/plugins/share/common/index.ts * autofix more types Co-authored-by: spalger <[email protected]>
* [eslint] enable type-specific lint rules (cherry picked from commit e824fdc) * autofix all violations Co-authored-by: spalger <[email protected]>
Fixes #114175
Enables ESLint rules which require types in a separate eslint config. This requires that we run ESLint separately in every typescript project, but it gives us access to very powerful ESLint rules like:
@typescript-eslint/prefer-export-type
: prevents using standardexport
statements to export types, which bloats bundles when unnecessary exports are left behind by babel and gets us closed to being able to enableisolatedModules: true
on all TS Projects. This rule is enabled by this PR and autofixed in all code.@typescript-eslint/no-floating-promises
: allows us to check that promises are handled when they are created. This rule is not enabled by this plugin but will be the next focus, ideally we will be able to provide contributors with a method for enabling this rule in their plugin and fixing the violations if they decide they want to do so. We can also enable it in all plugins which have few or no issues to prevent new issues from popping up.One drawback of this approach is that the code is being linted by ESLint twice, which it doesn't love. Unexpected
/* eslint-disable*
directives make it upset and it requires that we disable the inline directives for this config. Because of this I plan to create a POC which runs all of our ESLint configs this way so we can get back to a single ESLint config for each file. It requires config files in every plugin so that editors can load the correct config for each file, and it might not even work then, but we'll see if we can get it working.The command implemented in this PR is: