-
Notifications
You must be signed in to change notification settings - Fork 8.1k
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
[SIEM] Low impact linter rules to start with #37137
Conversation
Pinging @elastic/secops |
💚 Build Succeeded |
…we are going to fix right now
// these rules cannot be turned on and tested at the moment until this issue is resolved: | ||
// https://github.com/prettier/prettier-eslint/issues/201 | ||
// '@typescript-eslint/await-thenable': 'error', | ||
// '@typescript-eslint/no-non-null-assertion': 'error' |
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.
Looking forward to this one!
:)
// These will be turned on after bug fixes are mostly completed and we can | ||
// run a fix-lint | ||
/* | ||
'import/order': [ |
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.
Excited to get this back in as well. This is going to be a big change though, so I think holding off for now is 👍
// This style will be turned on after most bugs are fixed | ||
// 'prefer-template': 'warn', | ||
// This style will be turned on after most bugs are fixed | ||
// quotes: ['warn', 'single', { avoidEscape: true }], |
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.
There've been plenty of PR comments for this one. ++ for this rule.
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.
Soon for ones such as that one.
'react/void-dom-elements-no-children': 'error', | ||
'react/jsx-boolean-value': ['error', 'warn'], | ||
// will introduced after the other warns are fixed | ||
// 'react/jsx-no-bind': 'error', |
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 think there's a strong argument for getting this rule on sooner than later from a perf standpoint. Should we open an issue for tracking to raise visibility? Turning it on showed 120 errors
and it's pretty rampant around the DnD areas within the app.
'react/jsx-fragments': 'error', | ||
'react/jsx-sort-default-props': 'error', | ||
// might be introduced after the other warns are fixed | ||
// 'react/jsx-sort-props': 'error', |
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.
From the existing patterns in the codebase, I think the team would be happy to have this enabled, albeit with the callbacksLast and reservedFirst options enabled as well.
@@ -57,6 +57,7 @@ type KeyUrlState = keyof UrlState; | |||
|
|||
interface UrlStateProps { | |||
indexPattern: StaticIndexPattern; | |||
// eslint-disable-next-line @typescript-eslint/no-explicit-any |
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.
Good news -- I think this one is getting cleaned up here: https://github.com/elastic/kibana/pull/36954/files#diff-8fd82466ad8233a23f8deedd497d9058R58
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
💚 Build Succeeded |
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.
Checked out, ran linter locally and received 17 warnings as expected. Thanks for taking the time to curate these rules and also creating issues for tracking the high-impact rules. I think having the heavy-offenders commented out and turning them on + bugfixing one at a time is a good strategy for getting these enabled and the codebase cleaned up as we move to release.
I've left a few comments, but no changes necessary. Only addition I think would be to create a ticket for tracking the enabling of 'react/jsx-no-bind'
as that should result in measurable performance gains with the number of errors that we have for it in our project. Anyway, LGTM! 👍
## Summary Low impact linter rules to help catch bugs for back-porting as well as moving into the future. We will slowly turn the warns into errors and fix the errors as we go along. This helps us avoid a "big bang" switch over approach to avoid back-port issues as we are porting bugs aggressively at the beginning. Added a custom pattern detection rule for determining if the UI is trying to import anything from the server backend since that would cause web-pack front to pull in backend code. Also forbid the use of NodeJS imports on the front end. Double checked that I was not duplicating rules from: * https://github.com/elastic/kibana/blob/master/packages/eslint-config-kibana/typescript.js * https://github.com/elastic/kibana/blob/master/packages/eslint-config-kibana/javascript.js ### Checklist Use ~~strikethroughs~~ to remove checklist items you don't feel are applicable to this PR. ~- [ ] This was checked for cross-browser compatibility, [including a check against IE11](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#cross-browser-compatibility)~ ~- [ ] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/master/packages/kbn-i18n/README.md)~ ~- [ ] [Documentation](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#writing-documentation) was added for features that require explanation or tutorials~ ~- [ ] [Unit or functional tests](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#cross-browser-compatibility) were updated or added to match the most common scenarios~ ~- [ ] This was checked for [keyboard-only and screenreader accessibility](https://developer.mozilla.org/en-US/docs/Learn/Tools_and_testing/Cross_browser_testing/Accessibility#Accessibility_testing_checklist)~ ### For maintainers ~- [ ] This was checked for breaking API changes and was [labeled appropriately](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#release-notes-process)~ ~- [ ] This includes a feature addition or change that requires a release note and was [labeled appropriately](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#release-notes-process)~
## Summary Low impact linter rules to help catch bugs for back-porting as well as moving into the future. We will slowly turn the warns into errors and fix the errors as we go along. This helps us avoid a "big bang" switch over approach to avoid back-port issues as we are porting bugs aggressively at the beginning. Added a custom pattern detection rule for determining if the UI is trying to import anything from the server backend since that would cause web-pack front to pull in backend code. Also forbid the use of NodeJS imports on the front end. Double checked that I was not duplicating rules from: * https://github.com/elastic/kibana/blob/master/packages/eslint-config-kibana/typescript.js * https://github.com/elastic/kibana/blob/master/packages/eslint-config-kibana/javascript.js ### Checklist Use ~~strikethroughs~~ to remove checklist items you don't feel are applicable to this PR. ~- [ ] This was checked for cross-browser compatibility, [including a check against IE11](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#cross-browser-compatibility)~ ~- [ ] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/master/packages/kbn-i18n/README.md)~ ~- [ ] [Documentation](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#writing-documentation) was added for features that require explanation or tutorials~ ~- [ ] [Unit or functional tests](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#cross-browser-compatibility) were updated or added to match the most common scenarios~ ~- [ ] This was checked for [keyboard-only and screenreader accessibility](https://developer.mozilla.org/en-US/docs/Learn/Tools_and_testing/Cross_browser_testing/Accessibility#Accessibility_testing_checklist)~ ### For maintainers ~- [ ] This was checked for breaking API changes and was [labeled appropriately](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#release-notes-process)~ ~- [ ] This includes a feature addition or change that requires a release note and was [labeled appropriately](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#release-notes-process)~
## Summary Low impact linter rules to help catch bugs for back-porting as well as moving into the future. We will slowly turn the warns into errors and fix the errors as we go along. This helps us avoid a "big bang" switch over approach to avoid back-port issues as we are porting bugs aggressively at the beginning. Added a custom pattern detection rule for determining if the UI is trying to import anything from the server backend since that would cause web-pack front to pull in backend code. Also forbid the use of NodeJS imports on the front end. Double checked that I was not duplicating rules from: * https://github.com/elastic/kibana/blob/master/packages/eslint-config-kibana/typescript.js * https://github.com/elastic/kibana/blob/master/packages/eslint-config-kibana/javascript.js ### Checklist Use ~~strikethroughs~~ to remove checklist items you don't feel are applicable to this PR. ~- [ ] This was checked for cross-browser compatibility, [including a check against IE11](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#cross-browser-compatibility)~ ~- [ ] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/master/packages/kbn-i18n/README.md)~ ~- [ ] [Documentation](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#writing-documentation) was added for features that require explanation or tutorials~ ~- [ ] [Unit or functional tests](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#cross-browser-compatibility) were updated or added to match the most common scenarios~ ~- [ ] This was checked for [keyboard-only and screenreader accessibility](https://developer.mozilla.org/en-US/docs/Learn/Tools_and_testing/Cross_browser_testing/Accessibility#Accessibility_testing_checklist)~ ### For maintainers ~- [ ] This was checked for breaking API changes and was [labeled appropriately](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#release-notes-process)~ ~- [ ] This includes a feature addition or change that requires a release note and was [labeled appropriately](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#release-notes-process)~
Summary
Low impact linter rules to help catch bugs for back-porting as well as moving into the future. We will slowly turn the warns into errors and fix the errors as we go along. This helps us avoid a "big bang" switch over approach to avoid back-port issues as we are porting bugs aggressively at the beginning.
Added a custom pattern detection rule for determining if the UI is trying to import anything from the server backend since that would cause web-pack front to pull in backend code. Also forbid the use of NodeJS imports on the front end.
Double checked that I was not duplicating rules from:
Checklist
Use
strikethroughsto remove checklist items you don't feel are applicable to this PR.- [ ] This was checked for cross-browser compatibility, including a check against IE11- [ ] Any text added follows EUI's writing guidelines, uses sentence case text and includes i18n support- [ ] Documentation was added for features that require explanation or tutorials- [ ] Unit or functional tests were updated or added to match the most common scenarios- [ ] This was checked for keyboard-only and screenreader accessibilityFor maintainers
- [ ] This was checked for breaking API changes and was labeled appropriately- [ ] This includes a feature addition or change that requires a release note and was labeled appropriately