Skip to content
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

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

Merged
merged 4 commits into from Aug 9, 2019

Conversation

@gziolo
Copy link
Member

commented Aug 8, 2019

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 requested review from youknowriad and WordPress/gutenberg-core Aug 8, 2019

@gziolo gziolo self-assigned this Aug 8, 2019

@gziolo gziolo force-pushed the update/packages-dependencies branch from 1e34cdb to 000de40 Aug 8, 2019

@gziolo gziolo force-pushed the update/packages-dependencies branch from 000de40 to bf67453 Aug 8, 2019

@gziolo gziolo requested review from dmsnell, nosolosw and ntwb as code owners Aug 8, 2019

'import/no-extraneous-dependencies': 'error',
},
excludedFiles: [
'**/*.@(android|ios|native).js',

This comment has been minimized.

Copy link
@gziolo

gziolo Aug 8, 2019

Author Member

@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.

This comment has been minimized.

Copy link
@gziolo

gziolo Aug 9, 2019

Author Member

there is a follow-up: #16978

@ellatrix

This comment has been minimized.

Copy link
Member

commented Aug 8, 2019

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

This comment has been minimized.

Copy link
Member Author

commented Aug 8, 2019

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.

@ellatrix

This comment has been minimized.

Copy link
Member

commented Aug 9, 2019

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

How did you know which dependencies to remove then?

@ellatrix
Copy link
Member

left a comment

Awesome!

@gziolo

This comment has been minimized.

Copy link
Member Author

commented Aug 9, 2019

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

1 of 4 checks passed

Filter opened Filter opened
Details
Filter opened Filter opened
Details
Milestone It Milestone It
Details
Travis CI - Pull Request Build Passed
Details

@gziolo gziolo deleted the update/packages-dependencies branch Aug 9, 2019

@gziolo gziolo added this to the Gutenberg 6.3 milestone Aug 9, 2019

@jorgefilipecosta jorgefilipecosta referenced this pull request Aug 9, 2019
0 of 5 tasks complete
gziolo added a commit that referenced this pull request Aug 29, 2019
Packages: Fix all missing or obsolete dependencies in packages (#16969)
* 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 (#16969)
* 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
You can’t perform that action at this time.