-
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
Fix eslint-import resolver with extraneous dependencies #32906
Conversation
Size Change: +1 B (0%) Total Size: 1.04 MB
ℹ️ View Unchanged
|
The
It looks like the update to the package is all that is necessary. |
Oh cool, didn't know that, will update. |
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.
I can confirm that it reports linting errors correctly for WordPress packages that aren't listed as package dependencies, good finding 👍🏻
Description
Originally reported in #31792 (comment)
This fixes an issue #31792 introduced when importing a
@wordpress/*
dependency without listing it inpackage.json
doesn't report error in ESLint.The solution is in the rule
import/no-extraneous-dependencies
. Had to update the plugin so that it can correctly walk up to the correctpackage.json
(import-js/eslint-plugin-import#1174, import-js/eslint-plugin-import#1696).I wonder if this rule should be enabled in the scope of the@wordpress/eslint-plugin
package? Seems pretty helpful to me.How has this been tested?
Add a random
@wordpress/*
dependency in a package without listing it inpackage.json
. It should show error when runningnpm run lint-js
or in your code editor.Screenshots
Types of changes
Bug fix
Checklist:
*.native.js
files for terms that need renaming or removal).