-
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
Add eslint rules to guard against unexpected imports/exports #28513
Conversation
b3d4f27
to
0536de7
Compare
Size Change: 0 B Total Size: 1.37 MB
ℹ️ View Unchanged
|
Great idea to add those rules. I see there are several violations to fix first, though. If you want to add it to the ESLint plugin with WordPress configs, I would recommend starting with the warning level to not fail their CI checks after a minor update of dependencies. This is a common strategy that other ESLint plugins use to roll out more strict checks gradually. Even looking at Gutenberg changes necessary to satisfy linter - it's a breaking change. The approach we used in the past was marking new rules at warning level in the package and promote to an error in the Gutenberg repo. |
@gziolo That's an excellent idea! Will try! |
0946c12
to
1ec8e2d
Compare
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.
Everything looks great as it goes for the ESLint changes.
There is some usual dance left with rebases and the package lock file.
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.
Nice work, thank you for wrangling it 💯
Description
Fix #28510.
Add
eslint-plugin-import
and enable theimport/default
andimport/named
rules.A typo is introduced in #28176, after briefly discussed on Slack, I think it's best to update the linter to guard against these kinds of bugs.
This PR also fixes the errors found by the linter.
How has this been tested?
Only apply the first commit of this PR and run the linter:
Observe that there're errors reported.
After applying all the changes, run the linter again, observe that there're no more errors.
Types of changes
Bug fix
Checklist: