Skip to content

Commit

Permalink
Code style: Use wp-scripts format-js to change file formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
gziolo committed Feb 24, 2020
1 parent 0957f61 commit 649e38d
Show file tree
Hide file tree
Showing 29 changed files with 2,273 additions and 1,557 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ jobs:
- name: npm install, build, and test
run: |
npm ci
npm run lint-js
npm run lint:js
npm run lint:pkg-json
npm test
env:
CI: true
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' => '9e66ec208e27c761dbe91c1e3400eb50');
<?php return array('dependencies' => array('wp-blocks', 'wp-element', 'wp-i18n', 'wp-polyfill'), 'version' => 'd062ac108ab50114b5165b25defb1696');
2 changes: 1 addition & 1 deletion 01-basic-esnext/build/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions 01-basic-esnext/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@
"license": "GPL-2.0-or-later",
"main": "build/index.js",
"devDependencies": {
"@wordpress/scripts": "^6.1.1"
"@wordpress/scripts": "^7.1.1"
},
"scripts": {
"start": "wp-scripts start",
"build": "wp-scripts build",
"lint-js": "wp-scripts lint-js"
"format:js": "wp-scripts format-js",
"lint:js": "wp-scripts lint-js",
"start": "wp-scripts start"
}
}
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' => 'e6dd8af0992c4aabf4b0a46b6442249a');
<?php return array('dependencies' => array('wp-block-editor', 'wp-blocks', 'wp-element', 'wp-i18n', 'wp-polyfill'), 'version' => '37992986accc8dacd5f960ede217b8b5');
2 changes: 1 addition & 1 deletion 03-editable-esnext/build/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions 03-editable-esnext/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@
"license": "GPL-2.0-or-later",
"main": "build/index.js",
"devDependencies": {
"@wordpress/scripts": "^6.1.1"
"@wordpress/scripts": "^7.1.1"
},
"scripts": {
"start": "wp-scripts start",
"build": "wp-scripts build",
"lint-js": "wp-scripts lint-js"
"format:js": "wp-scripts format-js",
"lint:js": "wp-scripts lint-js",
"start": "wp-scripts start"
}
}
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' => '57d7ec9b925308113dc0232e6ceb5739');
<?php return array('dependencies' => array('wp-block-editor', 'wp-blocks', 'wp-element', 'wp-i18n', 'wp-polyfill'), 'version' => 'f182886b60e65789a6f7ab87658974b0');
2 changes: 1 addition & 1 deletion 04-controls-esnext/build/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions 04-controls-esnext/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@
"license": "GPL-2.0-or-later",
"main": "build/index.js",
"devDependencies": {
"@wordpress/scripts": "^6.1.1"
"@wordpress/scripts": "^7.1.1"
},
"scripts": {
"start": "wp-scripts start",
"build": "wp-scripts build",
"lint-js": "wp-scripts lint-js"
"format:js": "wp-scripts format-js",
"lint:js": "wp-scripts lint-js",
"start": "wp-scripts start"
}
}
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' => '861ce1675b5f5db693edb8f64d77cd4f');
<?php return array('dependencies' => array('wp-block-editor', 'wp-blocks', 'wp-components', 'wp-element', 'wp-i18n', 'wp-polyfill'), 'version' => '2798184d8e56e17ca0d7d759c9255a63');
7 changes: 4 additions & 3 deletions 05-recipe-card-esnext/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@
"license": "GPL-2.0-or-later",
"main": "build/index.js",
"devDependencies": {
"@wordpress/scripts": "^6.1.1"
"@wordpress/scripts": "^7.1.1"
},
"scripts": {
"start": "wp-scripts start",
"build": "wp-scripts build",
"lint-js": "wp-scripts lint-js"
"format:js": "wp-scripts format-js",
"lint:js": "wp-scripts lint-js",
"start": "wp-scripts start"
}
}
Loading

0 comments on commit 649e38d

Please sign in to comment.