-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Allow ariakit and framer motion imports in the components package #63123
Conversation
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Size Change: -81 B (0%) Total Size: 1.75 MB
ℹ️ View Unchanged
|
Flaky tests detected in eba94e7. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/9794443435
|
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.
Thanks @ciampo, looks good 🚀
It's a bit of a bummer that the ESLint config gets more and more complicated, but the change makes sense and I appreciate not having to ignore each and every import in the components package.
.eslintrc.js
Outdated
{ | ||
files: [ 'packages/components/src/**' ], | ||
rules: { | ||
'no-restricted-imports': [ | ||
'error', | ||
{ | ||
paths: restrictedImports.filter( | ||
( { name } ) => | ||
! [ | ||
'@ariakit/react', | ||
'framer-motion', | ||
].includes( name ) | ||
), | ||
}, | ||
], | ||
}, | ||
}, |
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.
It may be useful to add a comment that we're re-exporting them in the package so we're allowing usage inside the package. Right now it's not so obvious without looking deeper into why they were forbidden in the first place.
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.
Sure, I'll add a comment
This makes sense, though I agree that the config is getting complicated. We could simplify it by creating a package-specific config file that extends the root one, and then apply the overrides there. |
Not sure we wanna go that way though. If we want to upgrade to ESLint v9+, we might want to inspect migrating to a flat config instead. They're planning to remove |
…ess#63123) * ESLint: allow importing from ariakit and framer motion in the components package * Remove unnecessary eslint disable comments * CHANGELOG * Add comment in ESLint config --- Co-authored-by: ciampo <[email protected]> Co-authored-by: tyxla <[email protected]>
What?
Tweak the ESLint configuration to allow, only for the components package, importing from
ariakit
andframer-motion
, as initially suggested in #62919 (comment)Why?
For better DevEx. The reason they are disabled in the first place is that they should be only consumer by the
@wordpress/components
package, so this ESlint config change just puts that advice in practive.How?
eslint-disable
comments forariakit
andframer-motion
imports in the components packageTesting Instructions
eslint-disable
comments left in the components packageariakit
andframer-motion
imports still generate an ESLint error when imported outside of the components package