Merged
Conversation
a74a2bd to
e1bd620
Compare
58947f4 to
fa3010a
Compare
fa3010a to
0724281
Compare
3631545 to
659adf2
Compare
…ana into feature/telemetry-renewed
1611ecd to
afd7fbe
Compare
356965a to
aaf5462
Compare
dgieselaar
approved these changes
Mar 11, 2023
.../public/components/app/settings/custom_link/create_edit_custom_link_flyout/documentation.tsx
Outdated
Show resolved
Hide resolved
kpatticha
reviewed
Mar 11, 2023
.../public/components/app/dependency_operation_detail_view/dependency_operation_detail_link.tsx
Outdated
Show resolved
Hide resolved
kpatticha
approved these changes
Mar 11, 2023
Contributor
kpatticha
left a comment
There was a problem hiding this comment.
it looks great, thanks for adding it 💯 . I left a few suggestions where the component (context) is missing from the id.
…create_edit_custom_link_flyout/documentation.tsx Co-authored-by: Dario Gieselaar <d.gieselaar@gmail.com>
…urations/index.tsx Co-authored-by: Katerina Patticha <kate@kpatticha.com>
…create_edit_custom_link_flyout/flyout_footer.tsx Co-authored-by: Katerina Patticha <kate@kpatticha.com>
…empty_prompt.tsx Co-authored-by: Katerina Patticha <kate@kpatticha.com>
…create_edit_custom_link_flyout/filters_section.tsx Co-authored-by: Katerina Patticha <kate@kpatticha.com>
…create_edit_custom_link_flyout/flyout_footer.tsx Co-authored-by: Katerina Patticha <kate@kpatticha.com>
…detail_view/dependency_operation_detail_link.tsx Co-authored-by: Katerina Patticha <kate@kpatticha.com>
…create_edit_custom_link_flyout/filters_section.tsx Co-authored-by: Katerina Patticha <kate@kpatticha.com>
jbudz
approved these changes
Mar 14, 2023
Contributor
Author
|
@elasticmachine merge upstream |
💛 Build succeeded, but was flaky
Failed CI StepsMetrics [docs]Async chunks
Page load bundle
Unknown metric groupsESLint disabled line counts
Total ESLint disabled count
History
To update your PR or re-run it, just comment with: |
This was referenced Mar 20, 2023
2 tasks
walterra
added a commit
that referenced
this pull request
Sep 28, 2023
… eslint rule. (#167317) Implements #153108. This enables the `@kbn/telemetry/event_generating_elements_should_be_instrumented` eslint rule for the `aiops` plugin to enforce `data-test-subj` attributes on actionable EUI components so they are auto-instrumented by telemetry. The ids were first auto-created using `node scripts/eslint --fix x-pack/plugins/aiops` and then adapted.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves #144887
Summary
This PR adds an ESLint Plugin which checks specific
Euielements for the existence of adata-test-subjprop. This rule will make having one for these elements required.This rule is currently only enabled for Observability apps (APM, Infra, Observability, Synthetics, Uptime).
The plugin is also able to generate a suggestion based on the context in which the element is used. In the IDE this suggestion can be applied by using the autofix capability (see video below).
When opening a PR, the CI will automatically apply the suggestion to qualifying Eui elements in the branch.
bla.mov
Why do this?
There is an increased push to move towards data driven feature development. In order to facilitate this, we need to have an increased focus on instrumenting user event generating elements in the Kibana codebase. This linting rule is an attempt to nudge Kibana engineers to not forget to add this property when writing frontend code. It also saves a bit of work for engineers by suggesting a value for the
data-test-subjbased on the location of the file in the codebase and any potential default values that might be present in the JSX node tree. Finally, because the suggestion is always of the same form, it can increase the consistency in the values given to these elements.Shape of the suggestion
The suggestion for the value of data-test-subj is of the form:
[app][componentName][intent][euiElementName].For example, when working in a component in the location:
x-pack/plugins/observability/public/pages/overview/containers/overview_page/header_actions.tsx, and having the code:the suggestion becomes:
data-test-subj=o11yHeaderActionsSubmitFormButton.For elements that don't take a
defaultMessageprop / translation, the suggestion takes the form:[app][componentName][euiElementName]Which elements are checked by the ESLint rule?
In its current iteration the rule checks these Eui elements:
EuiButtonEuiButtonEmptyEuiLinkEuiFieldTextEuiFieldSearchEuiFieldNumberEuiSelectEuiRadioGroupWhat types of prop setting does this rule support?
<EuiButton data-test-subj="foo">(direct prop)<EuiButton {...foo}>(via spreaded object; rule checks fordata-test-subjkey in object)What types of function declarations does this rule support?
function Foo(){}(Named function)const Foo = () => {}(Arrow function assigned to variable)const Foo = memo(() => {})(Arrow function assigned to variable wrapped in function)const Foo = hoc(uponHoc(uponHoc(() => {})))(Arrow function assigned to variable wrapped in infinite levels of functions)Things to note
data-test-subjthe rule will not kick in as any existing instrumentation might depend on the value.data-test-subjbefore or after committing. Once a value is present (autofixed or manually set) the rule will not kick in.