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

Code style: Use wp-scripts format-js to change file formatting #107

Merged
merged 2 commits into from
Feb 26, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion 01-basic-esnext/build/index.asset.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return array('dependencies' => array('wp-blocks', 'wp-element', 'wp-i18n', 'wp-polyfill'), 'version' => 'a969943c342da6c77e273cbdec8df5ed');
<?php return array('dependencies' => array('wp-blocks', 'wp-element', 'wp-i18n', 'wp-polyfill'), 'version' => 'a969943c342da6c77e273cbdec8df5ed');
3 changes: 2 additions & 1 deletion 01-basic-esnext/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@
},
"main": "build/index.js",
"devDependencies": {
"@wordpress/scripts": "^6.1.1"
"@wordpress/scripts": "^7.1.1"
},
"scripts": {
"build": "wp-scripts build",
"format:js": "wp-scripts format-js",
"lint:js": "wp-scripts lint-js",
"start": "wp-scripts start"
}
Expand Down
9 changes: 6 additions & 3 deletions 01-basic-esnext/src/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

import { __ } from '@wordpress/i18n';
import { registerBlockType } from '@wordpress/blocks';

Expand All @@ -15,12 +14,16 @@ registerBlockType( 'gutenberg-examples/example-01-basic-esnext', {
example: {},
edit() {
return (
<div style={ blockStyle }>Hello World, step 1 (from the editor).</div>
<div style={ blockStyle }>
Hello World, step 1 (from the editor).
</div>
);
},
save() {
return (
<div style={ blockStyle }>Hello World, step 1 (from the frontend).</div>
<div style={ blockStyle }>
Hello World, step 1 (from the frontend).
</div>
);
},
} );
6 changes: 1 addition & 5 deletions 01-basic/block.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,4 @@
);
},
} );
}(
window.wp.blocks,
window.wp.i18n,
window.wp.element
) );
} )( window.wp.blocks, window.wp.i18n, window.wp.element );
6 changes: 1 addition & 5 deletions 02-stylesheets/block.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,4 @@
);
},
} );
}(
window.wp.blocks,
window.wp.i18n,
window.wp.element
) );
} )( window.wp.blocks, window.wp.i18n, window.wp.element );
2 changes: 1 addition & 1 deletion 03-editable-esnext/build/index.asset.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return array('dependencies' => array('wp-block-editor', 'wp-blocks', 'wp-element', 'wp-i18n', 'wp-polyfill'), 'version' => '6ec6cdb692e51e32daea62223ce8a386');
<?php return array('dependencies' => array('wp-block-editor', 'wp-blocks', 'wp-element', 'wp-i18n', 'wp-polyfill'), 'version' => '6ec6cdb692e51e32daea62223ce8a386');
3 changes: 2 additions & 1 deletion 03-editable-esnext/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@
},
"main": "build/index.js",
"devDependencies": {
"@wordpress/scripts": "^6.1.1"
"@wordpress/scripts": "^7.1.1"
},
"scripts": {
"build": "wp-scripts build",
"format:js": "wp-scripts format-js",
"lint:js": "wp-scripts lint-js",
"start": "wp-scripts start"
}
Expand Down
11 changes: 8 additions & 3 deletions 03-editable-esnext/src/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

import { __ } from '@wordpress/i18n';
import { registerBlockType } from '@wordpress/blocks';
import { RichText } from '@wordpress/block-editor';
Expand All @@ -20,7 +19,11 @@ registerBlockType( 'gutenberg-examples/example-03-editable-esnext', {
},
},
edit: ( props ) => {
const { attributes: { content }, setAttributes, className } = props;
const {
attributes: { content },
setAttributes,
className,
} = props;
const onChangeContent = ( newContent ) => {
setAttributes( { content: newContent } );
};
Expand All @@ -34,6 +37,8 @@ registerBlockType( 'gutenberg-examples/example-03-editable-esnext', {
);
},
save: ( props ) => {
return <RichText.Content tagName="p" value={ props.attributes.content } />;
return (
<RichText.Content tagName="p" value={ props.attributes.content } />
);
},
} );
25 changes: 9 additions & 16 deletions 03-editable/block.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,26 +34,19 @@
props.setAttributes( { content: newContent } );
}

return el(
RichText,
{
tagName: 'p',
className: props.className,
onChange: onChangeContent,
value: content,
}
);
return el( RichText, {
tagName: 'p',
className: props.className,
onChange: onChangeContent,
value: content,
} );
},

save: function( props ) {
return el( RichText.Content, {
tagName: 'p', value: props.attributes.content,
tagName: 'p',
value: props.attributes.content,
} );
},
} );
}(
window.wp.blocks,
window.wp.editor,
window.wp.i18n,
window.wp.element
) );
} )( window.wp.blocks, window.wp.editor, window.wp.i18n, window.wp.element );
2 changes: 1 addition & 1 deletion 04-controls-esnext/build/index.asset.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return array('dependencies' => array('wp-block-editor', 'wp-blocks', 'wp-element', 'wp-i18n', 'wp-polyfill'), 'version' => 'e690c8d1df99cc560b34322a6948d309');
<?php return array('dependencies' => array('wp-block-editor', 'wp-blocks', 'wp-element', 'wp-i18n', 'wp-polyfill'), 'version' => 'e690c8d1df99cc560b34322a6948d309');
3 changes: 2 additions & 1 deletion 04-controls-esnext/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@
},
"main": "build/index.js",
"devDependencies": {
"@wordpress/scripts": "^6.1.1"
"@wordpress/scripts": "^7.1.1"
},
"scripts": {
"build": "wp-scripts build",
"format:js": "wp-scripts format-js",
"lint:js": "wp-scripts lint-js",
"start": "wp-scripts start"
}
Expand Down
14 changes: 5 additions & 9 deletions 04-controls-esnext/src/index.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@

import { __ } from '@wordpress/i18n';
import {
registerBlockType,
} from '@wordpress/blocks';
import { registerBlockType } from '@wordpress/blocks';

import {
RichText,
Expand Down Expand Up @@ -33,10 +30,7 @@ registerBlockType( 'gutenberg-examples/example-04-controls-esnext', {
},
edit: ( props ) => {
const {
attributes: {
content,
alignment,
},
attributes: { content, alignment },
className,
} = props;

Expand All @@ -45,7 +39,9 @@ registerBlockType( 'gutenberg-examples/example-04-controls-esnext', {
};

const onChangeAlignment = ( newAlignment ) => {
props.setAttributes( { alignment: newAlignment === undefined ? 'none' : newAlignment } );
props.setAttributes( {
alignment: newAlignment === undefined ? 'none' : newAlignment,
} );
};

return (
Expand Down
45 changes: 19 additions & 26 deletions 04-controls/block.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,46 +43,39 @@
}

function onChangeAlignment( newAlignment ) {
props.setAttributes( { alignment: newAlignment === undefined ? 'none' : newAlignment } );
props.setAttributes( {
alignment:
newAlignment === undefined ? 'none' : newAlignment,
} );
}

return [
el(
BlockControls,
{ key: 'controls' },
el(
AlignmentToolbar,
{
value: alignment,
onChange: onChangeAlignment,
}
)
),
el(
RichText,
{
key: 'richtext',
tagName: 'p',
style: { textAlign: alignment },
className: props.className,
onChange: onChangeContent,
value: content,
}
el( AlignmentToolbar, {
value: alignment,
onChange: onChangeAlignment,
} )
),
el( RichText, {
key: 'richtext',
tagName: 'p',
style: { textAlign: alignment },
className: props.className,
onChange: onChangeContent,
value: content,
} ),
];
},

save: function( props ) {
return el( RichText.Content, {
tagName: 'p',
className: 'gutenberg-examples-align-' + props.attributes.alignment,
className:
'gutenberg-examples-align-' + props.attributes.alignment,
value: props.attributes.content,
} );
},
} );
}(
window.wp.blocks,
window.wp.editor,
window.wp.i18n,
window.wp.element
) );
} )( window.wp.blocks, window.wp.editor, window.wp.i18n, window.wp.element );
2 changes: 1 addition & 1 deletion 05-recipe-card-esnext/build/index.asset.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return array('dependencies' => array('wp-block-editor', 'wp-blocks', 'wp-components', 'wp-element', 'wp-i18n', 'wp-polyfill'), 'version' => 'f52eddba43b22641c8c8e5a57fd3166c');
<?php return array('dependencies' => array('wp-block-editor', 'wp-blocks', 'wp-components', 'wp-element', 'wp-i18n', 'wp-polyfill'), 'version' => 'f52eddba43b22641c8c8e5a57fd3166c');
3 changes: 2 additions & 1 deletion 05-recipe-card-esnext/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@
},
"main": "build/index.js",
"devDependencies": {
"@wordpress/scripts": "^6.1.1"
"@wordpress/scripts": "^7.1.1"
},
"scripts": {
"build": "wp-scripts build",
"format:js": "wp-scripts format-js",
"lint:js": "wp-scripts lint-js",
"start": "wp-scripts start"
}
Expand Down
Loading