Skip to content

Commit 01a13b1

Browse files
ota-meshimysticatea
authored andcommitted
Chore: add adjustCodeBlocks() process to update-docs.js (#709)
* Update attribute-hyphenation.md * Add `adjustCodeBlocks()` process to `update-docs.js`
1 parent b1346cd commit 01a13b1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+295
-61
lines changed

docs/rules/attribute-hyphenation.md

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ description: enforce attribute naming style on custom components in template
1515
This rule enforces using hyphenated attribute names on custom components in Vue templates.
1616

1717
<eslint-code-block fix :rules="{'vue/attribute-hyphenation': ['error', 'always']}">
18-
```
18+
19+
```vue
1920
<template>
2021
<!-- ✔ GOOD -->
2122
<MyComponent my-prop="prop" />
@@ -24,6 +25,7 @@ This rule enforces using hyphenated attribute names on custom components in Vue
2425
<MyComponent myProp="prop" />
2526
</template>
2627
```
28+
2729
</eslint-code-block>
2830

2931
## :wrench: Options
@@ -46,7 +48,8 @@ Default casing is set to `always` with `['data-', 'aria-', 'slot-scope']` set to
4648
It errors on upper case letters.
4749

4850
<eslint-code-block fix :rules="{'vue/attribute-hyphenation': ['error', 'always']}">
49-
```
51+
52+
```vue
5053
<template>
5154
<!-- ✔ GOOD -->
5255
<MyComponent my-prop="prop" />
@@ -55,13 +58,15 @@ It errors on upper case letters.
5558
<MyComponent myProp="prop" />
5659
</template>
5760
```
61+
5862
</eslint-code-block>
5963

6064
### `"never"`
6165
It errors on hyphens except `data-`, `aria-` and `slot-scope`.
6266

6367
<eslint-code-block fix :rules="{'vue/attribute-hyphenation': ['error', 'never']}">
64-
```
68+
69+
```vue
6570
<template>
6671
<!-- ✔ GOOD -->
6772
<MyComponent myProp="prop" />
@@ -73,13 +78,15 @@ It errors on hyphens except `data-`, `aria-` and `slot-scope`.
7378
<MyComponent my-prop="prop" />
7479
</template>
7580
```
81+
7682
</eslint-code-block>
7783

7884
### `"never", { "ignore": ["custom-prop"] }`
7985
Don't use hyphenated name but allow custom attributes
8086

8187
<eslint-code-block fix :rules="{'vue/attribute-hyphenation': ['error', 'never', { ignore: ['custom-prop']}]}">
82-
```
88+
89+
```vue
8390
<template>
8491
<!-- ✔ GOOD -->
8592
<MyComponent myProp="prop" />
@@ -92,6 +99,7 @@ Don't use hyphenated name but allow custom attributes
9299
<MyComponent my-prop="prop" />
93100
</template>
94101
```
102+
95103
</eslint-code-block>
96104

97105
## :mag: Implementation

docs/rules/attributes-order.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ This rule aims to enforce ordering of component attributes. The default order is
4040
### the default order
4141

4242
<eslint-code-block fix :rules="{'vue/attributes-order': ['error']}">
43-
```
43+
44+
```vue
4445
<template>
4546
<!-- ✓ GOOD -->
4647
<div
@@ -85,6 +86,7 @@ This rule aims to enforce ordering of component attributes. The default order is
8586
</div>
8687
</template>
8788
```
89+
8890
</eslint-code-block>
8991

9092
## :wrench: Options
@@ -113,7 +115,8 @@ This rule aims to enforce ordering of component attributes. The default order is
113115
#### `['LIST_RENDERING', 'CONDITIONALS', 'RENDER_MODIFIERS', 'GLOBAL', 'UNIQUE', 'TWO_WAY_BINDING', 'DEFINITION', 'OTHER_DIRECTIVES', 'OTHER_ATTR', 'EVENTS', 'CONTENT']`
114116

115117
<eslint-code-block fix :rules="{'vue/attributes-order': ['error', {order: ['LIST_RENDERING', 'CONDITIONALS', 'RENDER_MODIFIERS', 'GLOBAL', 'UNIQUE', 'TWO_WAY_BINDING', 'DEFINITION', 'OTHER_DIRECTIVES', 'OTHER_ATTR', 'EVENTS', 'CONTENT']}]}">
116-
```
118+
119+
```vue
117120
<template>
118121
<!-- ✓ GOOD -->
119122
<div
@@ -131,12 +134,14 @@ This rule aims to enforce ordering of component attributes. The default order is
131134
</div>
132135
</template>
133136
```
137+
134138
</eslint-code-block>
135139

136140
#### `[['LIST_RENDERING', 'CONDITIONALS', 'RENDER_MODIFIERS'], ['DEFINITION', 'GLOBAL', 'UNIQUE'], 'TWO_WAY_BINDING', 'OTHER_DIRECTIVES', 'OTHER_ATTR', 'EVENTS', 'CONTENT']`
137141

138142
<eslint-code-block fix :rules="{'vue/attributes-order': ['error', {order: [['LIST_RENDERING', 'CONDITIONALS', 'RENDER_MODIFIERS'], ['DEFINITION', 'GLOBAL', 'UNIQUE'], 'TWO_WAY_BINDING', 'OTHER_DIRECTIVES', 'OTHER_ATTR', 'EVENTS', 'CONTENT']}]}">
139-
```
143+
144+
```vue
140145
<template>
141146
<!-- ✓ GOOD -->
142147
<div
@@ -153,6 +158,7 @@ This rule aims to enforce ordering of component attributes. The default order is
153158
</div>
154159
</template>
155160
```
161+
156162
</eslint-code-block>
157163

158164
## :books: Further reading

docs/rules/comment-directive.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,15 @@ ESLint doesn't provide any API to enhance `eslint-disable` functionality and ESL
3030
This rule sends all `eslint-disable`-like comments as errors to the post-process of the `.vue` file processor, then the post-process removes all `vue/comment-directive` errors and the reported errors in disabled areas.
3131

3232
<eslint-code-block :rules="{'vue/comment-directive': ['error'], 'vue/max-attributes-per-line': ['error']}">
33+
3334
```vue
3435
<template>
3536
<!-- eslint-disable-next-line vue/max-attributes-per-line -->
3637
<div a="1" b="2" c="3" d="4">
3738
</div>
3839
</template>
3940
```
41+
4042
</eslint-code-block>
4143

4244
## :books: Further reading

docs/rules/component-name-in-template-casing.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ This rule aims to warn the tag names other than the configured casing in Vue.js
3333
### `"PascalCase"`
3434

3535
<eslint-code-block fix :rules="{'vue/component-name-in-template-casing': ['error']}">
36-
```
36+
37+
```vue
3738
<template>
3839
<!-- ✓ GOOD -->
3940
<TheComponent />
@@ -44,12 +45,14 @@ This rule aims to warn the tag names other than the configured casing in Vue.js
4445
<The-component />
4546
</template>
4647
```
48+
4749
</eslint-code-block>
4850

4951
### `"kebab-case"`
5052

5153
<eslint-code-block fix :rules="{'vue/component-name-in-template-casing': ['error', 'kebab-case']}">
52-
```
54+
55+
```vue
5356
<template>
5457
<!-- ✓ GOOD -->
5558
<the-component />
@@ -61,13 +64,15 @@ This rule aims to warn the tag names other than the configured casing in Vue.js
6164
<The-component />
6265
</template>
6366
```
67+
6468
</eslint-code-block>
6569

6670

6771
### `"PascalCase", { ignores: ["custom-element"] }`
6872

6973
<eslint-code-block fix :rules="{'vue/component-name-in-template-casing': ['error', 'PascalCase', {ignores: ['custom-element']}]}">
70-
```
74+
75+
```vue
7176
<template>
7277
<!-- ✓ GOOD -->
7378
<TheComponent/>
@@ -77,6 +82,7 @@ This rule aims to warn the tag names other than the configured casing in Vue.js
7782
<magic-element></magic-element>
7883
</template>
7984
```
85+
8086
</eslint-code-block>
8187

8288
## :books: Further reading

docs/rules/html-closing-bracket-newline.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ This rule enforces a line break (or no line break) before tag's closing brackets
3131
This rule aims to warn the right angle brackets which are at the location other than the configured location.
3232

3333
<eslint-code-block fix :rules="{'vue/html-closing-bracket-newline': ['error']}">
34-
```
34+
35+
```vue
3536
<template>
3637
<!-- ✓ GOOD -->
3738
<div id="foo" class="bar">
@@ -48,6 +49,7 @@ This rule aims to warn the right angle brackets which are at the location other
4849
class="bar">
4950
</template>
5051
```
52+
5153
</eslint-code-block>
5254

5355
## :wrench: Options
@@ -73,7 +75,8 @@ Plus, you can use [`vue/html-indent`](./html-indent.md) rule to enforce indent-l
7375
### `"multiline": "never"`
7476

7577
<eslint-code-block fix :rules="{'vue/html-closing-bracket-newline': ['error', { 'multiline': 'never' }]}">
76-
```
78+
79+
```vue
7780
<template>
7881
<!-- ✓ GOOD -->
7982
<div
@@ -87,6 +90,7 @@ Plus, you can use [`vue/html-indent`](./html-indent.md) rule to enforce indent-l
8790
>
8891
</template>
8992
```
93+
9094
</eslint-code-block>
9195

9296
## :mag: Implementation

docs/rules/html-closing-bracket-spacing.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ description: require or disallow a space before tag's closing brackets
1515
This rule aims to enforce consistent spacing style before closing brackets `>` of tags.
1616

1717
<eslint-code-block fix :rules="{'vue/html-closing-bracket-spacing': ['error']}">
18-
```
18+
19+
```vue
1920
<template>
2021
<!-- ✓ GOOD -->
2122
<div>
@@ -36,6 +37,7 @@ This rule aims to enforce consistent spacing style before closing brackets `>` o
3637
<div foo="bar"/>
3738
</template>
3839
```
40+
3941
</eslint-code-block>
4042

4143
## :wrench: Options
@@ -63,7 +65,8 @@ This rule aims to enforce consistent spacing style before closing brackets `>` o
6365
### `"startTag": "always", "endTag": "always", "selfClosingTag": "always"`
6466

6567
<eslint-code-block fix :rules="{'vue/html-closing-bracket-spacing': ['error', {startTag: 'always', endTag: 'always', selfClosingTag: 'always' }]}">
66-
```
68+
69+
```vue
6770
<template>
6871
<!-- ✓ GOOD -->
6972
<div >
@@ -75,6 +78,7 @@ This rule aims to enforce consistent spacing style before closing brackets `>` o
7578
<div foo="bar" />
7679
</template>
7780
```
81+
7882
</eslint-code-block>
7983

8084
## :couple: Related rules

docs/rules/html-end-tags.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ description: enforce end tag style
1515
This rule aims to disallow lacking end tags.
1616

1717
<eslint-code-block fix :rules="{'vue/html-end-tags': ['error']}">
18-
```
18+
19+
```vue
1920
<template>
2021
<!-- ✓ GOOD -->
2122
<div></div>
@@ -29,6 +30,7 @@ This rule aims to disallow lacking end tags.
2930
<p>
3031
</template>
3132
```
33+
3234
</eslint-code-block>
3335

3436
## :wrench: Options

docs/rules/html-indent.md

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ This rule enforces a consistent indentation style in `<template>`. The default s
1818
- In the expressions, this rule supports ECMAScript 2017 syntaxes. It ignores unknown AST nodes, but it might be confused by non-standard syntaxes.
1919

2020
<eslint-code-block fix :rules="{'vue/html-indent': ['error']}">
21-
```
21+
22+
```vue
2223
<template>
2324
<!-- ✓ GOOD -->
2425
<div class="foo">
@@ -55,6 +56,7 @@ This rule enforces a consistent indentation style in `<template>`. The default s
5556
</div>
5657
</template>
5758
```
59+
5860
</eslint-code-block>
5961

6062
## :wrench: Options
@@ -81,7 +83,8 @@ This rule enforces a consistent indentation style in `<template>`. The default s
8183
### `2, {"attribute": 1, "closeBracket": 1}`
8284

8385
<eslint-code-block fix :rules="{'vue/html-indent': ['error', 2, {attribute: 1, closeBracket: 1}]}">
84-
```
86+
87+
```vue
8588
<template>
8689
<!-- ✓ GOOD -->
8790
<div
@@ -96,12 +99,14 @@ This rule enforces a consistent indentation style in `<template>`. The default s
9699
</div>
97100
</template>
98101
```
102+
99103
</eslint-code-block>
100104

101105
### `2, {"attribute": 2, "closeBracket": 1}`
102106

103107
<eslint-code-block fix :rules="{'vue/html-indent': ['error', 2, {attribute: 2, closeBracket: 1}]}">
104-
```
108+
109+
```vue
105110
<template>
106111
<!-- ✓ GOOD -->
107112
<div
@@ -116,12 +121,14 @@ This rule enforces a consistent indentation style in `<template>`. The default s
116121
</div>
117122
</template>
118123
```
124+
119125
</eslint-code-block>
120126

121127
### `2, {"ignores": ["VAttribute"]}`
122128

123129
<eslint-code-block fix :rules="{'vue/html-indent': ['error', 2, {ignores: ['VAttribute']}]}">
124-
```
130+
131+
```vue
125132
<template>
126133
<!-- ✓ GOOD -->
127134
<div
@@ -130,12 +137,14 @@ This rule enforces a consistent indentation style in `<template>`. The default s
130137
/>
131138
</template>
132139
```
140+
133141
</eslint-code-block>
134142

135143
### `2, {"alignAttributesVertically": false}`
136144

137145
<eslint-code-block fix :rules="{'vue/html-indent': ['error', 2, {alignAttributesVertically: false}]}">
138-
```
146+
147+
```vue
139148
<template>
140149
<!-- ✓ GOOD -->
141150
<div id=""
@@ -150,12 +159,14 @@ This rule enforces a consistent indentation style in `<template>`. The default s
150159
/>
151160
</template>
152161
```
162+
153163
</eslint-code-block>
154164

155165
### `2, {"baseIndent": 0}`
156166

157167
<eslint-code-block fix :rules="{'vue/html-indent': ['error', 2, {baseIndent: 0}]}">
158-
```
168+
169+
```vue
159170
<template>
160171
<!-- ✓ GOOD -->
161172
<div>
@@ -172,6 +183,7 @@ This rule enforces a consistent indentation style in `<template>`. The default s
172183
</div>
173184
</template>
174185
```
186+
175187
</eslint-code-block>
176188

177189
## :mag: Implementation

0 commit comments

Comments
 (0)