Skip to content

Commit

Permalink
chore: linter formatting changes
Browse files Browse the repository at this point in the history
  • Loading branch information
rise-erpelding committed Sep 26, 2023
1 parent 6ea30a0 commit fb2d4d6
Show file tree
Hide file tree
Showing 8 changed files with 42 additions and 51 deletions.
30 changes: 15 additions & 15 deletions src/plugins/example-blocks/blocks/hello-world/block.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
{
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3,
"name": "example-blocks/hello-world",
"version": "0.1.0",
"title": "Hello World",
"category": "widgets",
"icon": "nametag",
"description": "Prints Hello World!",
"supports": {
"html": false
},
"textdomain": "example-blocks",
"editorScript": "file:./build/index.js",
"editorStyle": "file:./build/index.css",
"style": "file:./build/style-index.css"
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3,
"name": "example-blocks/hello-world",
"version": "0.1.0",
"title": "Hello World",
"category": "widgets",
"icon": "nametag",
"description": "Prints Hello World!",
"supports": {
"html": false
},
"textdomain": "example-blocks",
"editorScript": "file:./build/index.js",
"editorStyle": "file:./build/index.css",
"style": "file:./build/style-index.css"
}
6 changes: 1 addition & 5 deletions src/plugins/example-blocks/blocks/hello-world/src/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,5 @@ import './editor.scss';
* @return {WPElement} Element to render.
*/
export default function Edit() {
return (
<p {...useBlockProps()}>
{ __( 'Hello World!', 'example-blocks' ) }
</p>
);
return <p {...useBlockProps()}>{__('Hello World!', 'example-blocks')}</p>;
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
*/

.wp-block-example-blocks-hello-world {

/* insert custom styles here */
}
6 changes: 1 addition & 5 deletions src/plugins/example-blocks/blocks/hello-world/src/save.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,5 @@ import { useBlockProps } from '@wordpress/block-editor';
* @return {WPElement} Element to render.
*/
export default function save() {
return (
<p {...useBlockProps.save()}>
{ 'Hello World!' }
</p>
);
return <p {...useBlockProps.save()}>{'Hello World!'}</p>;
}
30 changes: 15 additions & 15 deletions src/plugins/example-blocks/blocks/reverse-string/block.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
{
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3,
"name": "example-blocks/reverse-string",
"version": "0.1.0",
"title": "Reverse String",
"category": "widgets",
"icon": "smiley",
"description": "Prints a user-entered string in reverse order.",
"supports": {
"html": false
},
"textdomain": "example-blocks",
"editorScript": "file:./build/index.js",
"editorStyle": "file:./build/index.css",
"style": "file:./build/style-index.css"
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3,
"name": "example-blocks/reverse-string",
"version": "0.1.0",
"title": "Reverse String",
"category": "widgets",
"icon": "smiley",
"description": "Prints a user-entered string in reverse order.",
"supports": {
"html": false
},
"textdomain": "example-blocks",
"editorScript": "file:./build/index.js",
"editorStyle": "file:./build/index.css",
"style": "file:./build/style-index.css"
}
11 changes: 5 additions & 6 deletions src/plugins/example-blocks/blocks/reverse-string/src/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,20 @@ import './editor.scss';
* The edit function describes the structure of your block in the context of the
* editor. This represents what the editor will render when the block is used.
*
* @param {Object} props
* @param {Object} props.attributes
* @param {Function} props.setAttributes
* @see https://developer.wordpress.org/block-editor/reference-guides/block-api/block-edit-save/#edit
*
* @return {WPElement} Element to render.
*/
export default function Edit({ attributes, setAttributes }) {
const { textToReverse } = attributes;
const updateTextToReverse = textToReverse => setAttributes({ textToReverse });
const updateTextToReverse = (newText) => setAttributes({ textToReverse: newText });

return (
<div {...useBlockProps()}>
<TextControl
label="Text to Reverse"
value={textToReverse}
onChange={updateTextToReverse}
/>
<TextControl label="Text to Reverse" value={textToReverse} onChange={updateTextToReverse} />
</div>
);
}
8 changes: 3 additions & 5 deletions src/plugins/example-blocks/blocks/reverse-string/src/save.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import { useBlockProps } from '@wordpress/block-editor';
* be combined into the final markup, which is then serialized by the block
* editor into `post_content`.
*
* @param {Object} props
* @param {Object} props.attributes
* @see https://developer.wordpress.org/block-editor/reference-guides/block-api/block-edit-save/#save
*
* @return {WPElement} Element to render.
Expand All @@ -19,9 +21,5 @@ export default function save({ attributes }) {
const { textToReverse } = attributes;
const reversedText = textToReverse.split('').reverse().join('');

return (
<p {...useBlockProps.save()}>
{reversedText}
</p>
);
return <p {...useBlockProps.save()}>{reversedText}</p>;
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@
*/

.wp-block-example-blocks-reverse-string {

/* insert custom styles here */
}

0 comments on commit fb2d4d6

Please sign in to comment.