Skip to content
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] eslint-deprecation plugin implementation (#6914) #8198

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

Cedgo1997
Copy link

@Cedgo1997 Cedgo1997 commented Dec 3, 2024

Summary

This PR provides:

This PR doesn't contain:

  • Fixes to deprecated code marked inside the code with @deprecated decorator.
  • Fixes to deprecated methods or implementation that may modify the software behavior.

Implementation:

  • eslint-plugin-deprecation v2.0.0 (v3.0.0 is not compatible)
    image

  • .eslintrc.js updated with new rule and plugin added to handle deprecation warns:

image
image
image

Replaced/updated code

Replaced Deprecated Aliases:

  • toBeCalled -> toHaveBeenCalled
  • toBeCalledTimes -> toHaveBeenCalledTimes
  • toBeCalledWith -> toHaveBeenCalledWith

Replaced css style declarations:

  • clip -> clipPath
  • webkitUserSelect -> userSelect

Replaced deprecated type declarations:

  • HTMLTableHeaderCellElement -> HTMLTableCellElement

Others replacements:

  • Replaced createStore with legacy_createStore as adviced.
  • Replaced ClientRect with DomRect, ClientRect inherits from DOMRect, which is perfectly compatible, but less specific.
  • Using JSX imported from React instead of global JSX.
  • Added new ReactChild type declaration in src/components/common.js to handle ReactChild deprecation alternative (Type was extracted by original declaration from react).

image

Pending deprecate code (Recommended to open a new issue):

  • color prop from _breadcrumb_content.tsx.
  • useColorStopsState reported as deprecated.
  • The document.execCommand is reported as deprecated, however, there isn't a known alternative to it.
  • hasDragDrop from popover.tsx.
  • Goal from elastic_charts mark as deprecated by plugin but alternative may require further analysis.
  • EuiFilterSelectItem and EuiFilterSelectItemClass are reported as deprecated.
  • PlayFunctionContext from '@storybook/csf' is marked as deprecated.
  • name prop from button_group.tsx.

QA

Remove or strikethrough items that do not apply to your PR.

General checklist

  • Browser QA
    • Checked in both light and dark modes
    • Checked in mobile
    • Checked in Chrome, Safari, Edge, and Firefox
    • Checked for accessibility including keyboard-only and screenreader modes
  • Docs site QA
  • Code quality checklist
  • Release checklist
    • A changelog entry exists and is marked appropriately.
    • If applicable, added the breaking change issue label (and filled out the breaking change checklist)
  • Designer checklist
    • If applicable, file an issue to update EUI's Figma library with any corresponding UI changes. (This is an internal repo, if you are external to Elastic, ask a maintainer to submit this request)

… alternatives.

- Self declarated deprecated occurrences were not replaced.
- Hooks, components, context and sections of the code that can be potentially harmfull if changed were not replaced, but marked as pending on PR.
@Cedgo1997 Cedgo1997 requested a review from a team as a code owner December 3, 2024 00:56
Copy link

cla-checker-service bot commented Dec 3, 2024

💚 CLA has been signed

Copy link

github-actions bot commented Dec 3, 2024

👋 Since this is a community submitted pull request, a Buildkite build has not been started automatically. Would an Elastic organization member please verify the contents of this pull request and kick off a build manually?

@Cedgo1997
Copy link
Author

Hello!
I've just created this PR aiming to solve this issue (and many more). I just sign the Contributor Agreement, is there any other thing I need to do before expecting a review?
Thanks in advance!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant