Skip to content

Commit 1254c29

Browse files
committed
📖 DOC: Better inline docs updates
1 parent bb3be17 commit 1254c29

5 files changed

Lines changed: 82 additions & 68 deletions

File tree

‎.eslintrc.json‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -92,35 +92,35 @@
9292
},
9393
{
9494
"selector": "ImportDeclaration[source.value=/^blocks$/]",
95-
"message": "Use @wordpress/blocks as the import path instead."
95+
"message": "Use @wordpress/blocks as import path instead."
9696
},
9797
{
9898
"selector": "ImportDeclaration[source.value=/^components$/]",
99-
"message": "Use @wordpress/components as the import path instead."
99+
"message": "Use @wordpress/components as import path instead."
100100
},
101101
{
102102
"selector": "ImportDeclaration[source.value=/^date$/]",
103-
"message": "Use @wordpress/date as the import path instead."
103+
"message": "Use @wordpress/date as import path instead."
104104
},
105105
{
106106
"selector": "ImportDeclaration[source.value=/^editor$/]",
107-
"message": "Use @wordpress/editor as the import path instead."
107+
"message": "Use @wordpress/editor as import path instead."
108108
},
109109
{
110110
"selector": "ImportDeclaration[source.value=/^element$/]",
111-
"message": "Use @wordpress/element as the import path instead."
111+
"message": "Use @wordpress/element as import path instead."
112112
},
113113
{
114114
"selector": "ImportDeclaration[source.value=/^i18n$/]",
115-
"message": "Use @wordpress/i18n as the import path instead."
115+
"message": "Use @wordpress/i18n as import path instead."
116116
},
117117
{
118118
"selector": "ImportDeclaration[source.value=/^data$/]",
119-
"message": "Use @wordpress/data as the import path instead."
119+
"message": "Use @wordpress/data as import path instead."
120120
},
121121
{
122122
"selector": "ImportDeclaration[source.value=/^utils$/]",
123-
"message": "Use @wordpress/utils as the import path instead."
123+
"message": "Use @wordpress/utils as import path instead."
124124
},
125125
{
126126
"selector":

‎package-lock.json‎

Lines changed: 9 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json‎

Lines changed: 42 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,44 @@
11
{
2-
"private": true,
3-
"workspaces": ["packages/*"],
4-
"repository": {
5-
"type": "git",
6-
"url": "git+https://github.com/ahmadawais/create-guten-block.git"
7-
},
8-
"author": "AhmadAwais",
9-
"bugs": {
10-
"url": "https://github.com/ahmadawais/create-guten-block/issues"
11-
},
12-
"homepage": "https://github.com/ahmadawais/create-guten-block#readme",
13-
"devDependencies": {
14-
"babel-eslint": "^8.2.1",
15-
"chalk": "^2.3.0",
16-
"eslint": "^4.16.0",
17-
"eslint-config-wordpress": "^2.0.0",
18-
"eslint-plugin-jest": "^21.6.1",
19-
"eslint-plugin-jsx-a11y": "^6.0.3",
20-
"eslint-plugin-react": "^7.5.1",
21-
"eslint-plugin-wordpress": "^0.1.0",
22-
"execa": "^0.9.0",
23-
"lerna": "^2.8.0",
24-
"ora": "^1.3.0",
25-
"shelljs": "^0.8.1",
26-
"update-notifier": "^2.3.0"
27-
},
28-
"scripts": {
29-
"create-guten-block": "node tasks/cgb.js",
30-
"demo": "node tasks/cgb.js demo",
31-
"cgb": "node packages/create-guten-block/index.js",
32-
"startCGB": "node packages/cgb-scripts/scripts/start.js",
33-
"changelog": "lerna-changelog",
34-
"updated": "lerna updated",
35-
"beforepublish": "lerna bootstrap",
36-
"publishScript":
37-
"bash tasks/publish.sh && echo 'Now update dependency packages.'",
38-
"publishNPM": "bash tasks/publish.sh --npm-client=npm",
39-
"publishAlpha":
40-
"yarn && lerna bootstrap && lerna publish --independent --npm-client=npm --canary",
41-
"lerna":
42-
"yarn && lerna updated && lerna bootstrap && lerna publish --independent --npm-client=npm"
43-
}
2+
"private": true,
3+
"workspaces": ["packages/*"],
4+
"repository": {
5+
"type": "git",
6+
"url": "git+https://github.com/ahmadawais/create-guten-block.git"
7+
},
8+
"author": "AhmadAwais",
9+
"bugs": {
10+
"url": "https://github.com/ahmadawais/create-guten-block/issues"
11+
},
12+
"homepage": "https://github.com/ahmadawais/create-guten-block#readme",
13+
"devDependencies": {
14+
"babel-eslint": "^8.2.1",
15+
"chalk": "^2.3.0",
16+
"eslint": "^4.17.0",
17+
"eslint-config-wordpress": "^2.0.0",
18+
"eslint-plugin-jest": "^21.7.0",
19+
"eslint-plugin-jsx-a11y": "^6.0.3",
20+
"eslint-plugin-react": "^7.6.1",
21+
"eslint-plugin-wordpress": "^0.1.0",
22+
"execa": "^0.9.0",
23+
"lerna": "^2.8.0",
24+
"ora": "^1.3.0",
25+
"shelljs": "^0.8.1",
26+
"update-notifier": "^2.3.0"
27+
},
28+
"scripts": {
29+
"create-guten-block": "node tasks/cgb.js",
30+
"demo": "node tasks/cgb.js demo",
31+
"cgb": "node packages/create-guten-block/index.js",
32+
"startCGB": "node packages/cgb-scripts/scripts/start.js",
33+
"changelog": "lerna-changelog",
34+
"updated": "lerna updated",
35+
"beforepublish": "lerna bootstrap",
36+
"publishScript":
37+
"bash tasks/publish.sh && echo 'Now update dependency packages.'",
38+
"publishNPM": "bash tasks/publish.sh --npm-client=npm",
39+
"publishAlpha":
40+
"yarn && lerna bootstrap && lerna publish --independent --npm-client=npm --canary",
41+
"lerna":
42+
"yarn && lerna updated && lerna bootstrap && lerna publish --independent --npm-client=npm"
43+
}
4444
}

‎packages/cgb-scripts/template/src/block/block.js‎

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,15 @@ const { registerBlockType } = wp.blocks; // Import registerBlockType() from wp.b
1919
* behavior. Once registered, the block is made editor as an option to any
2020
* editor interface where blocks are implemented.
2121
*
22+
* @link https://wordpress.org/gutenberg/handbook/block-api/
2223
* @param {string} name Block name.
2324
* @param {Object} settings Block settings.
2425
* @return {?WPBlock} The block, if it has been successfully
2526
* registered; otherwise `undefined`.
2627
*/
2728
registerBlockType( 'cgb/block-<% blockName %>', {
2829
// Block name. Block names must be string that contains a namespace prefix. Example: my-plugin/my-custom-block.
29-
title: __( '<% blockName %> - CGB Block', 'CGB' ), // Block title.
30+
title: __( '<% blockName %> - CGB Block' ), // Block title.
3031
icon: 'shield', // Block icon from Dashicons → https://developer.wordpress.org/resource/dashicons/.
3132
category: 'common', // Block category — Group blocks together based on common traits E.g. common, formatting, layout widgets, embed.
3233
keywords: [
@@ -35,7 +36,14 @@ registerBlockType( 'cgb/block-<% blockName %>', {
3536
__( 'create-guten-block' ),
3637
],
3738

38-
// The "edit" property must be a valid function.
39+
/**
40+
* The edit function describes the structure of your block in the context of the editor.
41+
* This represents what the editor will render when the block is used.
42+
*
43+
* The "edit" property must be a valid function.
44+
*
45+
* @link https://wordpress.org/gutenberg/handbook/block-api/block-edit-save/
46+
*/
3947
edit: function( props ) {
4048
// Creates a <p class='wp-block-cgb-block-<% blockName %>'></p>.
4149
return (
@@ -56,7 +64,14 @@ registerBlockType( 'cgb/block-<% blockName %>', {
5664
);
5765
},
5866

59-
// The "save" property must be specified and must be a valid function.
67+
/**
68+
* The save function defines the way in which the different attributes should be combined
69+
* into the final markup, which is then serialized by Gutenberg into post_content.
70+
*
71+
* The "save" property must be specified and must be a valid function.
72+
*
73+
* @link https://wordpress.org/gutenberg/handbook/block-api/block-edit-save/
74+
*/
6075
save: function( props ) {
6176
return (
6277
<div className={ props.className }>
Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
/**
22
* Gutenberg Blocks
33
*
4-
* All blocks related JavaScript.
5-
* You can create a new block folder in
6-
* this dir and include code for that block
7-
* here as well.
4+
* All blocks related JavaScript files should be imported here.
5+
* You can create a new block folder in this dir and include code
6+
* for that block here as well.
87
*
9-
* All blocks should be included here since
10-
* this is the file that Webpack is compiling.
8+
* All blocks should be included here since this is the file that
9+
* Webpack is compiling as the input file.
1110
*/
1211

1312
import './block/block.js';

0 commit comments

Comments
 (0)