Skip to content

move react/jsx-a11y rules into shared react preset - #49244

Merged
spalger merged 13 commits into
elastic:masterfrom
spalger:make-react-rules-global
Oct 29, 2019
Merged

spalger merged 13 commits into
elastic:masterfrom
spalger:make-react-rules-global

Conversation

@spalger

@spalger spalger commented Oct 24, 2019

Copy link
Copy Markdown
Contributor

It was pointed out that the react lint rules were only applied to JS files when we moved TS linting over to ESLint. This has been the case for a long time, so we have a lot of violations.

I'm not 100% sure about what we should do here, many of these violations can be auto-fixed, but those autofixes include adding dependencies to hooks which don't just work out of the box without inspection, and might cause undesirable effects, so someone is going to need to carefully consider many of these fixes.

Full list of violations: https://gist.github.com/spalger/b3702d46b004f485c9bcea29f6a0e36c
A summary of violation count by area:

packages/kbn-ui-framework: 1
src/core/public/application: 1
src/core/public/rendering: 1
src/legacy/core_plugins/console: 11
src/legacy/core_plugins/data: 7
src/legacy/core_plugins/expressions: 1
src/legacy/core_plugins/kbn_doc_views: 2
src/legacy/core_plugins/kbn_vislib_vis_types: 14
src/legacy/core_plugins/kibana_react: 1
src/legacy/core_plugins/kibana: 6
src/legacy/core_plugins/tile_map: 1
src/legacy/core_plugins/vis_type_markdown: 1
src/legacy/core_plugins/vis_type_metric: 1
src/legacy/core_plugins/vis_type_table: 3
src/legacy/core_plugins/vis_type_vega: 2
src/legacy/ui/public/capabilities: 3
src/legacy/ui/public/vis: 44
src/plugins/es_ui_shared: 5
src/plugins/eui_utils: 1
src/plugins/kibana_react: 10
src/plugins/kibana_utils: 1
test/plugin_functional/plugins/core_plugin_a: 1
test/plugin_functional/plugins/search_explorer: 4
x-pack/legacy/plugins/apm: 8
x-pack/legacy/plugins/beats_management: 2
x-pack/legacy/plugins/canvas: 11
x-pack/legacy/plugins/code: 27
x-pack/legacy/plugins/cross_cluster_replication: 4
x-pack/legacy/plugins/graph: 6
x-pack/legacy/plugins/index_management: 9
x-pack/legacy/plugins/infra: 60
x-pack/legacy/plugins/lens: 32
x-pack/legacy/plugins/ml: 134
x-pack/legacy/plugins/monitoring: 2
x-pack/legacy/plugins/security: 3
x-pack/legacy/plugins/siem: 66
x-pack/legacy/plugins/snapshot_restore: 7
x-pack/legacy/plugins/spaces: 3
x-pack/legacy/plugins/transform: 16
x-pack/legacy/plugins/upgrade_assistant: 5
x-pack/legacy/plugins/uptime: 13
x-pack/legacy/plugins/watcher: 11
x-pack/plugins/reporting: 1

I'm not really sure what to do here so I'm pushing this up for ideas.

@elasticmachine

Copy link
Copy Markdown
Contributor

💔 Build Failed

@walterra

Copy link
Copy Markdown
Contributor

One suggestion comes to mind: Could this PR set up the overall config but with overrides to disable the rules again in individual plugins? Then each team could follow up in their own PRs, fix the rules and remove the overrides eventually.

@spalger

spalger commented Oct 25, 2019 •

Copy link
Copy Markdown
Contributor Author

Yeah, I like that idea @walterra, I'll create issues for each plugin/area and maybe @timroes can help me get them assigned to the correct teams

@timroes

timroes commented Oct 25, 2019

Copy link
Copy Markdown
Contributor

@spalger I like that idea. Given that I assume a lot of the failures are from the a11y part, depending on how much time @myasonik currently has, we can also try to support other teams creating fixing PRs for the a11y breakages.

@myasonik

Copy link
Copy Markdown
Contributor

I think I'm missing something. Why the focus on jsx-a11y here?

Adding up the numbers in the summary, it looks like there are 542 errors. Doing a find on the full list of violations for jsx-a11y/ brings back 12 results, 11 of which are the same error (Visible, non-interactive elements with click handlers must have at least one keyboard listener jsx-a11y/click-events-have-key-events). I'm betting a majority of those errors can be fixed by replacing whatever element is being used with a button and if not that, I'm happy to help out.

(The only other a11y error is "onBlur must be used instead of onchange..." which should be a quick fix.)

@timroes

timroes commented Oct 25, 2019

Copy link
Copy Markdown
Contributor

Okay awesome, then my assumption was wrong :D Even better, but having only a couple of a11y issues hanging around, do you think we could help fixing those across the different plugins?

@myasonik

Copy link
Copy Markdown
Contributor

On one hand, yes, we/I could submit a PR fixing all of the a11y issues.

On the other hand, that doesn't solve the broader linting problem (so I don't see the hurry) and it shielded people from learning about/practicing keyboard accessibility in a pretty approachable way (linting pointing to a specific line with good messaging and more docs online).

From an a11y education standpoint, I'd certainly rather see the plugin maintainers fix the issues and jump into to help them if it's unclear or review PRs or however else they might need support.

@spalger spalger mentioned this pull request Oct 25, 2019
30 of 31 tasks
@elasticmachine

This comment has been minimized.

@spalger spalger added the Team:Operations Kibana-Operations Team label Oct 25, 2019
@elasticmachine

Copy link
Copy Markdown
Contributor

Pinging @elastic/kibana-operations (Team:Operations)

@spalger spalger added v7.6.0 v8.0.0 release_note:skip Skip the PR/issue when compiling release notes and removed discuss labels Oct 25, 2019
@spalger
spalger marked this pull request as ready for review October 28, 2019 19:25
@spalger
spalger requested review from a team October 28, 2019 19:25
@spalger
spalger requested a review from a team as a code owner October 28, 2019 19:25
@elasticmachine

Copy link
Copy Markdown
Contributor

💚 Build Succeeded

@streamich

Copy link
Copy Markdown
Contributor

53 errors come from react/self-closing-comp rule, which is just a styling choice and could be disabled.

@streamich streamich mentioned this pull request Oct 29, 2019

@walterra walterra left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ML changes LGTM.

@streamich streamich left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

App Architecture code changes LGTM.

@weltenwort weltenwort left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

infra changes LGTM

@legrego legrego left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Spaces changes LGTM

@spalger

spalger commented Oct 29, 2019

Copy link
Copy Markdown
Contributor Author

I'm going to approve on behalf of operations and move on without Canvas so others can get working on removing their overrides.

@spalger
spalger merged commit 19ea92a into elastic:master Oct 29, 2019
spalger pushed a commit to spalger/kibana that referenced this pull request Oct 29, 2019
* move react/jsx-a11y rules into shared react preset

* autofix react/jsx-closing-tag-location

* autofix react/no-unknown-property

* manually fix react/no-unescaped-entities

* maually fix react/jsx-pascal-case

* manually fix react/prefer-stateless-function

* disable known violations in specific plugins/areas

* remove code override

# Conflicts:
#	x-pack/legacy/plugins/upgrade_assistant/public/components/tabs/checkup/deprecations/reindex/flyout/warnings_step.tsx
@spalger

spalger commented Oct 29, 2019

Copy link
Copy Markdown
Contributor Author

7.x/7.6: 0ee219e

@spalger
spalger deleted the make-react-rules-global branch October 29, 2019 14:47
weltenwort added a commit that referenced this pull request Dec 11, 2019
This removes the two eslint exceptions specific to the `infra` plugin introduced in #49244.

fixes #49563
weltenwort added a commit to weltenwort/kibana that referenced this pull request Dec 12, 2019
This removes the two eslint exceptions specific to the `infra` plugin introduced in elastic#49244.

fixes elastic#49563
patrykkopycinski pushed a commit to patrykkopycinski/kibana that referenced this pull request May 6, 2026
* move react/jsx-a11y rules into shared react preset

* autofix react/jsx-closing-tag-location

* autofix react/no-unknown-property

* manually fix react/no-unescaped-entities

* maually fix react/jsx-pascal-case

* manually fix react/prefer-stateless-function

* disable known violations in specific plugins/areas

* remove code override
patrykkopycinski pushed a commit to patrykkopycinski/kibana that referenced this pull request May 6, 2026
This removes the two eslint exceptions specific to the `infra` plugin introduced in elastic#49244.

fixes elastic#49563
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release_note:skip Skip the PR/issue when compiling release notes Team:Operations Kibana-Operations Team v7.6.0 v8.0.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants