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
gziolo
left a comment
There was a problem hiding this comment.
Everything looks great as it goes for the ESLint changes.
There is some usual dance left with rebases and the package lock file.
gziolo
left a comment
There was a problem hiding this comment.
Nice work, thank you for wrangling it 💯
Description
Fix #28510.
Add
eslint-plugin-importand enable theimport/defaultandimport/namedrules.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: