Skip to content

Packages: Fix all missing or obsolete dependencies in packages - #16969

Merged
gziolo merged 4 commits into
masterfrom
update/packages-dependencies
Aug 9, 2019
Merged

gziolo merged 4 commits into
masterfrom
update/packages-dependencies

Conversation

@gziolo

@gziolo gziolo commented Aug 8, 2019 •

Copy link
Copy Markdown
Member

Description

I discovered that we have some differences in the list of dependencies for WordPress packages. In particular, I have some issues integrating all recently published npm packages with WordPress core. Related ticket:
https://core.trac.wordpress.org/ticket/47843

How has this been tested?

In general, on Gutenberg side, it all should be transparent as we have build tools which properly generate dependencies consumed by WordPress. In core, we have to do it manually so that might be why it doesn't quite work as necessary.

@gziolo gziolo added [Type] Bug An existing feature does not function as intended [Priority] High Used to indicate top priority items that need quick attention npm Packages Related to npm packages labels Aug 8, 2019
@gziolo
gziolo requested review from a team and youknowriad August 8, 2019 15:25
@gziolo gziolo self-assigned this Aug 8, 2019
@gziolo
gziolo force-pushed the update/packages-dependencies branch from 1e34cdb to 000de40 Compare August 8, 2019 15:29
@gziolo
gziolo force-pushed the update/packages-dependencies branch from 000de40 to bf67453 Compare August 8, 2019 15:32
Comment thread .eslintrc.js
'import/no-extraneous-dependencies': 'error',
},
excludedFiles: [
'**/*.@(android|ios|native).js',

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@hypest and @koke - I disabled native files for now to fix all the issues which web version has, but we definitely should revisit it really soon.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

there is a follow-up: #16978

@ellatrix

ellatrix commented Aug 8, 2019

Copy link
Copy Markdown
Member

I wonder if there's any way we can check the JS files for imports and error if the dependency is not found in the package.json file, and also error if there are dependencies that are listed and not used.

@gziolo

gziolo commented Aug 8, 2019

Copy link
Copy Markdown
Member Author

I wonder if there's any way we can check the JS files for imports and error if the dependency is not found in the package.json file, and also error if there are dependencies that are listed and not used.

So this new ESLint rule (import/no-extraneous-dependencies) I added in this PR solves the first case :)
I couldn't find anything which covers 2nd scenario.

Comment thread packages/block-editor/package.json Resolved
@ellatrix

ellatrix commented Aug 9, 2019

Copy link
Copy Markdown
Member

I couldn't find anything which covers 2nd scenario.

How did you know which dependencies to remove then?

@ellatrix ellatrix left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Awesome!

@gziolo

gziolo commented Aug 9, 2019

Copy link
Copy Markdown
Member Author

I couldn't find anything which covers 2nd scenario.

How did you know which dependencies to remove then?

It was a manual process. I went through build folder where we have JSON files generated with dependencies for each module which are used in the code. Based on that, I removed those WP packages which weren't listed. It would be great to have this automated with a linter rule.

@gziolo
gziolo merged commit a12ac00 into master Aug 9, 2019
@gziolo
gziolo deleted the update/packages-dependencies branch August 9, 2019 08:48
@gziolo gziolo added this to the Gutenberg 6.3 milestone Aug 9, 2019
gziolo added a commit that referenced this pull request Aug 29, 2019
* Packages: Fix all missing or obsolete dependencies in packages

* Enable import/no-extraneous-dependencies rule and fix reported violations

* Remove 2 dependencies not used in the project on the global level

* Remove unused @wordpress/core-data dependnecy from @wordpress/block-editor
gziolo added a commit that referenced this pull request Aug 29, 2019
* Packages: Fix all missing or obsolete dependencies in packages

* Enable import/no-extraneous-dependencies rule and fix reported violations

* Remove 2 dependencies not used in the project on the global level

* Remove unused @wordpress/core-data dependnecy from @wordpress/block-editor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

npm Packages Related to npm packages [Priority] High Used to indicate top priority items that need quick attention [Type] Bug An existing feature does not function as intended

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants