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

FEUIUX-407 feat: add no-deprecated-components rule #21

Merged
merged 5 commits into from
Jan 31, 2024

Conversation

kubaprzetakiewicz
Copy link
Contributor

Jira

https://plentific.atlassian.net/browse/FEUIUX-315
https://plentific.atlassian.net/browse/FEUIUX-407

Description

This is a new rule that will detect imports from paths that were configured as restricted and output a message with a suitable replacement.

Example configuration:

'plentific/no-deprecated-components': [
  'error',
  {
    'components/ButtonBlock': 'components/Button',
  },
],

Screenshots

Screenshot 2024-01-31 at 13 09 28 image

"eslint-comments/no-unused-disable": "error",
"plentific/debug": "error",
"plentific/no-concurrent-async": "error",
"plentific/no-deprecated-components": [
Copy link
Contributor Author

Choose a reason for hiding this comment

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

note: the only change in this file, everything else is prettified

@kubaprzetakiewicz kubaprzetakiewicz merged commit b84eca6 into main Jan 31, 2024
1 check passed
@kubaprzetakiewicz kubaprzetakiewicz deleted the kp/FEUIUX-315 branch January 31, 2024 13:38
"error",
{
"examples/app/components/ComponentDeprecated":
"examples/app/components/Component",
Copy link

Choose a reason for hiding this comment

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

Leaving it as suggestion here, potentially this can be extended to an array, where as a second optional value we can provide a link to storybook where detailed examples can help developers with migrations.

Copy link
Contributor

Choose a reason for hiding this comment

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

I was thinking about that as well but the value is quite universal you can even do

{
  "examples/app/components/ComponentDeprecated":
    "examples/app/components/Component (see documentation on https://bla.com)",
}

Copy link
Contributor

Choose a reason for hiding this comment

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

but probably i'd won't do exact matching because if deprecated component will be moved, and somebody forget to adjust the rule, it will stop matching, maybe so if we do matching like import ends with, you can still do exact match or just sub matching components/ComponentDeprecated or just ComponentDeprecated

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i wouldn't lock it into Storybook, because not every substitution is UX/UI/Storybook/Blueprint-related

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

Successfully merging this pull request may close these issues.

3 participants