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

Convert examples to use import syntax #17502

Merged
merged 3 commits into from
Sep 25, 2019
Merged

Convert examples to use import syntax #17502

merged 3 commits into from
Sep 25, 2019

Conversation

mkaz
Copy link
Member

@mkaz mkaz commented Sep 20, 2019

Description

Updates the examples to use the syntax:

import { ... } from '@wordpress/package';

instead of

const { ... } = wp.package;

This is more consistent and better for webpack and build setup.

The gutenberg-examples repo was already switched to use import syntax in:
WordPress/gutenberg-examples#89

Types of changes

Documentation.

Updates the examples to use the syntax:

    import { ... } from '@wordpress/package';

instead of

    const { ... } = wp.package;

This is more consistent and better for webpack and build setup.

The gutenberg-examples repo was already switched to use import syntax
in: WordPress/gutenberg-examples#89
Copy link
Member

@chrisvanpatten chrisvanpatten left a comment

Choose a reason for hiding this comment

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

Two small nits :) Love this!

mkaz and others added 2 commits September 20, 2019 10:29
…block-controls-toolbar-and-sidebar.md

Co-Authored-By: Chris Van Patten <chris@vanpattenmedia.com>
…creating-dynamic-blocks.md

Co-Authored-By: Chris Van Patten <chris@vanpattenmedia.com>
@gziolo
Copy link
Member

gziolo commented Sep 21, 2019

How do we communicate that those import statements should have the corresponding entries in package.json file in “dependencies” section?

We can include ESLint rule which helps with validation of whether imported dependencies are listed in package.json file. Although there is some bug in ESLint which mades its usage in wp-scripts complicated...

@mkaz
Copy link
Member Author

mkaz commented Sep 23, 2019

@gziolo doesn't the reading and including of the dependencies of index.asset.php in the enqueuing insure the @wordpress packages are included? This works in all spots for me without adding anything to package.json.

@gziolo
Copy link
Member

gziolo commented Sep 23, 2019

@gziolo doesn't the reading and including of the dependencies of index.asset.php in the enqueuing insure the @wordpress packages are included? This works in all spots for me without adding anything to package.json.

We use externals for all of them so you are correct. As long as they aren't referenced outside of WordPress context, e.g. unit tests, it should be all fine as is 👍

@mkaz mkaz merged commit 31513b6 into master Sep 25, 2019
@mkaz mkaz deleted the docs/switch2imports branch September 25, 2019 16:39
@youknowriad youknowriad added this to the Gutenberg 6.6 milestone Sep 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Type] Developer Documentation Documentation for developers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants