Skip to content

Commit e864021

Browse files
committed
chore(docs): run eslint on docs
1 parent 8982178 commit e864021

11 files changed

Lines changed: 177 additions & 151 deletions

File tree

packages/docs/docs/guides/app-integration/run-code.mdx

Lines changed: 53 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -22,46 +22,62 @@ code generators with any of the following methods.
2222

2323
<Tabs groupId="group-1">
2424
<TabItem value="modules" label="Modules" default>
25-
```js import {javascriptGenerator} from 'blockly/javascript'; import{' '}
26-
{pythonGenerator} from 'blockly/python'; import {phpGenerator} from
27-
'blockly/php'; import {luaGenerator} from 'blockly/lua'; import{' '}
28-
{dartGenerator} from 'blockly/dart'; // Generate code for all the blocks in
29-
the workspace. const jsCode =
30-
javascriptGenerator.workspaceToCode(workspace); const pythonCode =
31-
pythonGenerator.workspaceToCode(workspace); const phpCode =
32-
phpGenerator.workspaceToCode(workspace); const luaCode =
33-
luaGenerator.workspaceToCode(workspace); const dartCode =
34-
dartGenerator.workspaceToCode(workspace); ```
25+
```js
26+
import {javascriptGenerator} from 'blockly/javascript';
27+
import {pythonGenerator} from 'blockly/python';
28+
import {phpGenerator} from 'blockly/php';
29+
import {luaGenerator} from 'blockly/lua';
30+
import {dartGenerator} from 'blockly/dart';
31+
32+
// Generate code for all the blocks in the workspace.
33+
const jsCode = javascriptGenerator.workspaceToCode(workspace);
34+
const pythonCode = pythonGenerator.workspaceToCode(workspace);
35+
const phpCode = phpGenerator.workspaceToCode(workspace);
36+
const luaCode = luaGenerator.workspaceToCode(workspace);
37+
const dartCode = dartGenerator.workspaceToCode(workspace);
38+
```
3539
</TabItem>
3640
<TabItem value="unpkg" label="Unpkg">
37-
You must include the generator after you include Blockly. ```html
38-
<script src="https://unpkg.com/blockly"></script>
39-
<script src="https://unpkg.com/blockly/javascript_compressed"></script>
40-
<script src="https://unpkg.com/blockly/python_compressed"></script>
41-
<script src="https://unpkg.com/blockly/php_compressed"></script>
42-
<script src="https://unpkg.com/blockly/lua_compressed"></script>
43-
<script src="https://unpkg.com/blockly/dart_compressed"></script>
44-
``` ```js // Generate code for all the blocks in the workspace. const jsCode
45-
= javascript.javascriptGenerator.workspaceToCode(workspace); const
46-
pythonCode = python.pythonGenerator.workspaceToCode(workspace); const
47-
phpCode = php.phpGenerator.workspaceToCode(workspace); const luaCode =
48-
lua.luaGenerator.workspaceToCode(workspace); const dartCode =
49-
dart.dartGenerator.workspaceToCode(workspace); ```
41+
You must include the generator after you include Blockly.
42+
43+
```html
44+
<script src="https://unpkg.com/blockly"></script>
45+
<script src="https://unpkg.com/blockly/javascript_compressed"></script>
46+
<script src="https://unpkg.com/blockly/python_compressed"></script>
47+
<script src="https://unpkg.com/blockly/php_compressed"></script>
48+
<script src="https://unpkg.com/blockly/lua_compressed"></script>
49+
<script src="https://unpkg.com/blockly/dart_compressed"></script>
50+
```
51+
52+
```js
53+
// Generate code for all the blocks in the workspace.
54+
const jsCode = javascript.javascriptGenerator.workspaceToCode(workspace);
55+
const pythonCode = python.pythonGenerator.workspaceToCode(workspace);
56+
const phpCode = php.phpGenerator.workspaceToCode(workspace);
57+
const luaCode = lua.luaGenerator.workspaceToCode(workspace);
58+
const dartCode = dart.dartGenerator.workspaceToCode(workspace);
59+
```
5060
</TabItem>
5161
<TabItem value="local-scripts" label="Local scripts">
52-
You must include the generator after you include Blockly. ```html
53-
<script src="blockly_compressed.js"></script>
54-
<script src="javascript_compressed.js"></script>
55-
<script src="python_compressed.js"></script>
56-
<script src="php_compressed.js"></script>
57-
<script src="lua_compressed.js"></script>
58-
<script src="dart_compressed.js"></script>
59-
``` ```js // Generate code for all the blocks in the workspace. const jsCode
60-
= javascript.javascriptGenerator.workspaceToCode(workspace); const
61-
pythonCode = python.pythonGenerator.workspaceToCode(workspace); const
62-
phpCode = php.phpGenerator.workspaceToCode(workspace); const luaCode =
63-
lua.luaGenerator.workspaceToCode(workspace); const dartCode =
64-
dart.dartGenerator.workspaceToCode(workspace); ```
62+
You must include the generator after you include Blockly.
63+
64+
```html
65+
<script src="blockly_compressed.js"></script>
66+
<script src="javascript_compressed.js"></script>
67+
<script src="python_compressed.js"></script>
68+
<script src="php_compressed.js"></script>
69+
<script src="lua_compressed.js"></script>
70+
<script src="dart_compressed.js"></script>
71+
```
72+
73+
```js
74+
// Generate code for all the blocks in the workspace.
75+
const jsCode = javascript.javascriptGenerator.workspaceToCode(workspace);
76+
const pythonCode = python.pythonGenerator.workspaceToCode(workspace);
77+
const phpCode = php.phpGenerator.workspaceToCode(workspace);
78+
const luaCode = lua.luaGenerator.workspaceToCode(workspace);
79+
const dartCode = dart.dartGenerator.workspaceToCode(workspace);
80+
```
6581
</TabItem>
6682
</Tabs>
6783
## Generate code
@@ -105,7 +121,7 @@ start or after the end of the generated code.
105121
```js
106122
let code = javascriptGenerator.workspaceToCode(workspace);
107123
// Add a preamble and a postscript to the code.
108-
const preamble = "import {MyLibrary} from '/path/to/my/library';\n";
124+
const preamble = 'import {MyLibrary} from \'/path/to/my/library\';\n'
109125
const postscript = 'MyLibrary.myKickoffFunction();\n';
110126
code = preamble + code + postscript;
111127
```

packages/docs/docs/guides/configure/web/appearance/css.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ lead to unpredictable results.
175175
If you understand SVG styling properties and the CSS cascade, you can
176176
[skip](#css-rules) this section.
177177

178-
### SVG styling properties versus CSS properties {#svg-style}
178+
### SVG styling properties versus CSS properties \{#svg-style\}
179179

180180
SVG elements are styled with [SVG styling
181181
properties](https://developer.mozilla.org/en-US/docs/Web/SVG/Reference/Attribute#presentation_attributes).
@@ -233,7 +233,7 @@ more than one rule applies to a given property and element. The following
233233
simplified cascade covers the parts of the cascade most commonly used by Blockly
234234
and may help you resolve the question, "Why doesn't my CSS work?"
235235

236-
#### Simplified cascade {#simplified}
236+
#### Simplified cascade \{#simplified\}
237237

238238
To determine which rule applies to a particular element and property, follow
239239
these steps and stop when only one rule remains:

packages/docs/docs/guides/configure/web/configuration_struct.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ configuration options in a call to `new Blockly.Options(options)` -- the
3333
`WorkspaceSvg` constructor cannot accept your configuration options object
3434
directly.
3535

36-
## Configuration options{#the-options-dictionary}
36+
## Configuration options \{#the-options-dictionary\}
3737

3838
The configuration object implements
3939
[`Blockly.BlocklyOptions`](/reference/blockly.blocklyoptions_interface)

packages/docs/docs/guides/configure/web/customization.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ Blockly.registry.register(
8181
);
8282
```
8383

84-
### Inject your replacement class {#injecting-subclasses}
84+
### Inject your replacement class \{#injecting-subclasses\}
8585

8686
You can also inject replacement classes using the `plugins` [configuration
8787
option](/guides/configure/web/configuration_struct#the-options-dictionary).

packages/docs/docs/guides/configure/web/translations.mdx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ want to support and whether you plan to support more locales in the future.
7171
1. [Load the Blockly localization table](#load-blockly) for the locale.
7272
1. [Load your localization table](#load-custom) for the locale.
7373

74-
## Define and use localization tokens {#define}
74+
## Define and use localization tokens \{#define\}
7575

7676
When supporting multiple locales, you need to define and use localization tokens
7777
for all of your custom text.
@@ -220,7 +220,7 @@ references in JavaScript:
220220
displayText: () => '%{BKY_MY_CONTEXT_MENU_ITEM}';
221221
```
222222

223-
## Choose a locale {#choose}
223+
## Choose a locale \{#choose\}
224224

225225
How to choose a locale is application-specific and outside the scope of Blockly.
226226
For example, your application might always use the same locale, determine the
@@ -233,7 +233,7 @@ the workspace: Blockly does not update the existing toolbox or blocks to use the
233233
new locale automatically. To preserve the user's work (if any), save the state
234234
before you re-create the workspace and re-load it after.
235235

236-
## Load a Blockly localization table {#load-blockly}
236+
## Load a Blockly localization table \{#load-blockly\}
237237

238238
Blockly provides localization tables for all of its own text, such as the text
239239
on built-in blocks. Unless you are using the `en` locale, which is loaded by
@@ -288,7 +288,7 @@ load the table from the `msg` directory. For example:
288288

289289
The localization table is loaded automatically.
290290

291-
## Load your own localization table {#load-custom}
291+
## Load your own localization table \{#load-custom\}
292292

293293
If you define your own localization tables, you need to load the table for your
294294
chosen locale.
@@ -343,7 +343,7 @@ registration](/guides/create-custom-blocks/fields/customizing-fields/creating#js
343343
[Translating](/guides/contribute/core/translating) in the section on
344344
contributing to Blockly.
345345
346-
## Appendix: Where token references are allowed {#where}
346+
## Appendix: Where token references are allowed \{#where\}
347347
348348
You can use [token references](#use-localization-tokens-in-json) in the
349349
following JSON keys:

packages/docs/docs/guides/contribute/samples/block_libraries.mdx

Lines changed: 49 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import CompareBlock from '@site/src/components/CompareBlock';
1414
/>
1515
</Head>
1616

17+
1718
# Publish block libraries
1819

1920
Plugins that provide libraries of block definitions are a great way to share
@@ -22,27 +23,28 @@ versatile and useful as possible, we've developed these guidelines.
2223

2324
## Guidelines
2425

25-
- Make it **easy** for users to install all of your blocks, and make it
26-
**possible** for users to install only certain blocks or pieces of blocks
27-
they choose.
28-
- Make it easy to install everything: You can do this by providing a
29-
function that installs every piece a single block definition requires
30-
(such as mutators, extensions, mixins, fields, etc.). You can also
31-
provide a function that will install all of the blocks offered by your
32-
plugin at once.
33-
- Make it possible to choose specific parts: You should export all of the
34-
pieces of a block definition separately, so that it is possible for a
35-
user to import only the pieces they need in order to create their own
36-
similar custom block.
37-
- Avoid using side effects in your plugin.
38-
- Blocks, fields, extensions, and other pieces shouldn't be installed as a
39-
side effect of loading your plugin. Users should maintain control over
40-
which things are installed and when. This allows users to import the
41-
pieces they need without worrying that pieces they don't will be
42-
installed.
43-
- Use the JSON field registry instead of instantiating new fields directly.
44-
- <CompareBlock variant="worse">
45-
Not Recommended - Instantiating a new field directly:
26+
- Make it **easy** for users to install all of your blocks, and make it
27+
**possible** for users to install only certain blocks or pieces of blocks
28+
they choose.
29+
- Make it easy to install everything: You can do this by providing a
30+
function that installs every piece a single block definition requires
31+
(such as mutators, extensions, mixins, fields, etc.). You can also
32+
provide a function that will install all of the blocks offered by your
33+
plugin at once.
34+
- Make it possible to choose specific parts: You should export all of the
35+
pieces of a block definition separately, so that it is possible for a
36+
user to import only the pieces they need in order to create their own
37+
similar custom block.
38+
- Avoid using side effects in your plugin.
39+
- Blocks, fields, extensions, and other pieces shouldn't be installed as a
40+
side effect of loading your plugin. Users should maintain control over
41+
which things are installed and when. This allows users to import the
42+
pieces they need without worrying that pieces they don't will be
43+
installed.
44+
- Use the JSON field registry instead of instantiating new fields directly.
45+
46+
- <CompareBlock variant="worse">
47+
Not Recommended - Instantiating a new field directly:
4648

4749
```js
4850
const myCustomBlock = {
@@ -52,11 +54,10 @@ Not Recommended - Instantiating a new field directly:
5254
}
5355
}
5456
```
57+
</CompareBlock>
5558

56-
</CompareBlock>
57-
58-
- <CompareBlock variant="better">
59-
Recommended - JSON field registry:
59+
- <CompareBlock variant="better">
60+
Recommended - JSON field registry:
6061

6162
```js
6263
export const myCustomBlock = {
@@ -69,36 +70,34 @@ Recommended - JSON field registry:
6970
}
7071
}
7172
```
73+
</CompareBlock>
7274

73-
</CompareBlock>
74-
75-
- Using the field registry makes it easier for a user to replace the
76-
implementation of the field used in your block without having to change
75+
- Using the field registry makes it easier for a user to replace the
76+
implementation of the field used in your block without having to change
7777
the block definition.
78-
79-
- Don't make assumptions about what the user has already installed.
80-
- If your plugin requires a custom field or another plugin, register those
78+
- Don't make assumptions about what the user has already installed.
79+
- If your plugin requires a custom field or another plugin, register those
8180
fields yourself in your provided `install` function.
82-
- Soon, Blockly will provide tools that let you register
83-
already-registered items without error. Until then, you may want to
84-
check what has already been registered before registering an extension,
81+
- Soon, Blockly will provide tools that let you register
82+
already-registered items without error. Until then, you may want to
83+
check what has already been registered before registering an extension,
8584
mutator, mixin, or field yourself.
86-
- Be clear about any prerequisites or dependencies that are required by
87-
your plugin or block definitions.
88-
- Consider providing generator functions for each of the blocks you provide.
89-
- Providing generator functions that work out of the box makes it easier
90-
for users to use your blocks without having to understand their
91-
structure and design. If they have to write their own generator
92-
functions, this may lead to redundant work being done by each user.
93-
- JavaScript is the most commonly used language in Blockly, so if you only
85+
- Be clear about any prerequisites or dependencies that are required by
86+
your plugin or block definitions.
87+
- Consider providing generator functions for each of the blocks you provide.
88+
- Providing generator functions that work out of the box makes it easier
89+
for users to use your blocks without having to understand their
90+
structure and design. If they have to write their own generator
91+
functions, this may lead to redundant work being done by each user.
92+
- JavaScript is the most commonly used language in Blockly, so if you only
9493
pick one language to provide, we recommend JavaScript, unless your blocks
95-
are built for a specific language such as implementing a Python library.
96-
- Consider posting 'help wanted' issues for languages for which you are
97-
unable to implement generator functions, and accept pull requests for
98-
these if a user contributes them.
99-
- If you provide an install function for your block, you can accept an
100-
optional `generators` parameter. If a user passes a generator instance
101-
that you support, you can automatically install the block-code generator
94+
are built for a specific language such as implementing a Python library.
95+
- Consider posting 'help wanted' issues for languages for which you are
96+
unable to implement generator functions, and accept pull requests for
97+
these if a user contributes them.
98+
- If you provide an install function for your block, you can accept an
99+
optional `generators` parameter. If a user passes a generator instance
100+
that you support, you can automatically install the block-code generator
102101
function and do related work such as adding reserved words:
103102

104103
```js

packages/docs/docs/guides/create-custom-blocks/fields/customizing-fields/creating.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -860,7 +860,7 @@ set to `true`. This is not the case by default for backwards compatibility
860860
reasons.
861861
:::
862862

863-
## Customizing with CSS{#css}
863+
## Customizing with CSS \{#css\}
864864

865865
You can customize your field with CSS. In the [`initView`
866866
method](#on-block-display), add a custom class to your field's `fieldGroup_`,

0 commit comments

Comments
 (0)