Skip to content

Commit 0924d62

Browse files
authored
Lint docs (#1821)
* Add rule docs headings checker * Fix typo in rule docs heading * Standardize heading order in rule docs * Add markdownlint * Use `dash` style for all unordered lists `ul-style` MarkdownLint rule * Standardize unordered list indentation `ul-indent` MarkdownLint rule * Remove trailing spaces `no-trailing-spaces` MarkdownLint rule * Collapse consecutive empty lines `no-multiple-blanks` MarkdownLint rule * Add empty line after headings `blanks-around-headings` MarkdownLint rule * Add empty lines after code blocks `blanks-around-fences` MarkdownLint rule * Add empty lines before lists `blanks-around-lists` MarkdownLint rule * Add link title `no-bare-urls` MarkdownLint rule * Convert bold paragraph to heading `no-emphasis-as-heading` MarkdownLint rule * Fix trailing space in inline code `no-space-in-code` MarkdownLint rule * Add language to code blocks `fenced-code-language` MarkdownLint rule * Disable `no-inline-html` MarkdownLint rule in one place * Fix wrong link syntax
1 parent 8f09420 commit 0924d62

Some content is hidden

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

44 files changed

+170
-111
lines changed

Diff for: .markdownlint.yml

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
line-length: false
2+
single-title: false
3+
no-inline-html:
4+
allowed_elements:
5+
- badge
6+
- eslint-code-block
7+
- sup
8+
9+
# enforce consistency
10+
code-block-style:
11+
style: fenced
12+
code-fence-style:
13+
style: backtick
14+
emphasis-style:
15+
style: asterisk
16+
heading-style:
17+
style: atx
18+
hr-style:
19+
style: ---
20+
strong-style:
21+
style: asterisk
22+
ul-style:
23+
style: dash

Diff for: .markdownlintignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node_modules

Diff for: docs/rules/README.md

-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ sidebarDepth: 0
1212
:bulb: Indicates that some problems reported by the rule are manually fixable by editor [suggestions](https://eslint.org/docs/developer-guide/working-with-rules#providing-suggestions).
1313
:::
1414

15-
1615
## Base Rules (Enabling Correct ESLint Parsing)
1716

1817
Enforce all the rules in this category, as well as all higher priority rules, with:

Diff for: docs/rules/custom-event-name-casing.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,11 @@ export default {
163163

164164
</eslint-code-block>
165165

166+
## :couple: Related Rules
167+
168+
- [vue/v-on-event-hyphenation](./v-on-event-hyphenation.md)
169+
- [vue/prop-name-casing](./prop-name-casing.md)
170+
166171
## :books: Further Reading
167172

168173
- [Guide - Custom Events]
@@ -171,11 +176,6 @@ export default {
171176
[Guide - Custom Events]: https://vuejs.org/guide/components/events.html
172177
[Guide (for v2) - Custom Events]: https://v2.vuejs.org/v2/guide/components-custom-events.html
173178

174-
## :couple: Related Rules
175-
176-
- [vue/v-on-event-hyphenation](./v-on-event-hyphenation.md)
177-
- [vue/prop-name-casing](./prop-name-casing.md)
178-
179179
## :rocket: Version
180180

181181
This rule was introduced in eslint-plugin-vue v7.0.0

Diff for: docs/rules/html-closing-bracket-newline.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,11 @@ This rule aims to warn the right angle brackets which are at the location other
6666
```
6767

6868
- `singleline` ... the configuration for single-line elements. It's a single-line element if the element does not have attributes or the last attribute is on the same line as the opening bracket.
69-
- `"never"` (default) ... disallow line breaks before the closing bracket.
70-
- `"always"` ... require one line break before the closing bracket.
69+
- `"never"` (default) ... disallow line breaks before the closing bracket.
70+
- `"always"` ... require one line break before the closing bracket.
7171
- `multiline` ... the configuration for multiline elements. It's a multiline element if the last attribute is not on the same line of the opening bracket.
72-
- `"never"` ... disallow line breaks before the closing bracket.
73-
- `"always"` (default) ... require one line break before the closing bracket.
72+
- `"never"` ... disallow line breaks before the closing bracket.
73+
- `"always"` (default) ... require one line break before the closing bracket.
7474

7575
Plus, you can use [`vue/html-indent`](./html-indent.md) rule to enforce indent-level of the closing brackets.
7676

Diff for: docs/rules/html-closing-bracket-spacing.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,14 @@ This rule aims to enforce consistent spacing style before closing brackets `>` o
5555
```
5656

5757
- `startTag` (`"always" | "never"`) ... Setting for the `>` of start tags (e.g. `<div>`). Default is `"never"`.
58-
- `"always"` ... requires one or more spaces.
59-
- `"never"` ... disallows spaces.
58+
- `"always"` ... requires one or more spaces.
59+
- `"never"` ... disallows spaces.
6060
- `endTag` (`"always" | "never"`) ... Setting for the `>` of end tags (e.g. `</div>`). Default is `"never"`.
61-
- `"always"` ... requires one or more spaces.
62-
- `"never"` ... disallows spaces.
61+
- `"always"` ... requires one or more spaces.
62+
- `"never"` ... disallows spaces.
6363
- `selfClosingTag` (`"always" | "never"`) ... Setting for the `/>` of self-closing tags (e.g. `<div/>`). Default is `"always"`.
64-
- `"always"` ... requires one or more spaces.
65-
- `"never"` ... disallows spaces.
64+
- `"always"` ... requires one or more spaces.
65+
- `"never"` ... disallows spaces.
6666

6767
### `"startTag": "always", "endTag": "always", "selfClosingTag": "always"`
6868

Diff for: docs/rules/html-comment-content-newline.md

+11-12
Original file line numberDiff line numberDiff line change
@@ -56,21 +56,21 @@ This rule will enforce consistency of line break after the `<!--` and before the
5656
```
5757

5858
- The first option is either an object with `"singleline"` and `"multiline"` keys.
59-
- `singleline` ... the configuration for single-line comments.
60-
- `"never"` (default) ... disallow line breaks after the `<!--` and before the `-->`.
61-
- `"always"` ... require one line break after the `<!--` and before the `-->`.
62-
- `multiline` ... the configuration for multiline comments.
63-
- `"never"` ... disallow line breaks after the `<!--` and before the `-->`.
64-
- `"always"` (default) ... require one line break after the `<!--` and before the `-->`.
59+
- `singleline` ... the configuration for single-line comments.
60+
- `"never"` (default) ... disallow line breaks after the `<!--` and before the `-->`.
61+
- `"always"` ... require one line break after the `<!--` and before the `-->`.
62+
- `multiline` ... the configuration for multiline comments.
63+
- `"never"` ... disallow line breaks after the `<!--` and before the `-->`.
64+
- `"always"` (default) ... require one line break after the `<!--` and before the `-->`.
6565

66-
You can also set the same value for both `singleline` and `multiline` by specifies a string.
66+
You can also set the same value for both `singleline` and `multiline` by specifies a string.
6767

6868
- This rule can also take a 2nd option, an object with the following key: `"exceptions"`.
69-
- The `"exceptions"` value is an array of string patterns which are considered exceptions to the rule.
69+
- The `"exceptions"` value is an array of string patterns which are considered exceptions to the rule.
7070

71-
```json
72-
"vue/html-comment-content-newline": ["error", { ... }, { "exceptions": ["*"] }]
73-
```
71+
```json
72+
"vue/html-comment-content-newline": ["error", { ... }, { "exceptions": ["*"] }]
73+
```
7474

7575
### `"always"`
7676

@@ -162,7 +162,6 @@ This rule will enforce consistency of line break after the `<!--` and before the
162162

163163
</eslint-code-block>
164164

165-
166165
### `{"singleline": "ignore", "multiline": "always"}`
167166

168167
<eslint-code-block fix :rules="{'vue/html-comment-content-newline': ['error', { 'singleline': 'ignore', 'multiline': 'always' }]}">

Diff for: docs/rules/html-comment-content-spacing.md

+7-8
Original file line numberDiff line numberDiff line change
@@ -48,17 +48,16 @@ Whitespace after the `<!--` and before the `-->` makes it easier to read text in
4848
```
4949

5050
- The first is a string which be either `"always"` or `"never"`. The default is `"always"`.
51-
- `"always"` (default) ... there must be at least one whitespace at after the `<!--` and before the `-->`.
52-
- `"never"` ... there should be no whitespace at after the `<!--` and before the `-->`.
53-
51+
- `"always"` (default) ... there must be at least one whitespace at after the `<!--` and before the `-->`.
52+
- `"never"` ... there should be no whitespace at after the `<!--` and before the `-->`.
5453

5554
- This rule can also take a 2nd option, an object with the following key: `"exceptions"`.
56-
- The `"exceptions"` value is an array of string patterns which are considered exceptions to the rule.
57-
Please note that exceptions are ignored if the first argument is `"never"`.
55+
- The `"exceptions"` value is an array of string patterns which are considered exceptions to the rule.
56+
Please note that exceptions are ignored if the first argument is `"never"`.
5857

59-
```json
60-
"vue/html-comment-content-spacing": ["error", "always", { "exceptions": ["*"] }]
61-
```
58+
```json
59+
"vue/html-comment-content-spacing": ["error", "always", { "exceptions": ["*"] }]
60+
```
6261

6362
### `"always"`
6463

Diff for: docs/rules/max-len.md

-1
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,6 @@ var foo = ['line', 'length', 'is', '50', '......']
112112

113113
</eslint-code-block>
114114

115-
116115
### `"template": 120`
117116

118117
<eslint-code-block :rules="{'vue/max-len': ['error', {template: 120}]}">

Diff for: docs/rules/new-line-between-multi-line-property.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ export default {
7575

7676
</eslint-code-block>
7777

78-
## :wrench: Option
78+
## :wrench: Options
7979

8080
```json
8181
{

Diff for: docs/rules/next-tick-style.md

+1
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ export default {
4646
</eslint-code-block>
4747

4848
## :wrench: Options
49+
4950
Default is set to `promise`.
5051

5152
```json

Diff for: docs/rules/no-bare-strings-in-template.md

-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ In order to be able to internationalize your application, you will need to avoid
1616

1717
This rule was inspired by [no-bare-strings rule in ember-template-lint](https://github.com/ember-template-lint/ember-template-lint/blob/master/docs/rule/no-bare-strings.md).
1818

19-
2019
<eslint-code-block :rules="{'vue/no-bare-strings-in-template': ['error']}">
2120

2221
```vue

Diff for: docs/rules/no-boolean-default.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ since: v7.0.0
1313

1414
The rule prevents Boolean props from having a default value.
1515

16-
1716
## :book: Rule Details
17+
1818
The rule is to enforce the HTML standard of always defaulting boolean attributes to false.
1919

2020
<eslint-code-block fix :rules="{'vue/no-boolean-default': ['error']}">
@@ -38,6 +38,7 @@ export default {
3838
</eslint-code-block>
3939

4040
## :wrench: Options
41+
4142
- `'no-default'` (default) allows a prop definition object, but enforces that the `default` property not be defined.
4243
- `'default-false'` enforces that the default can be set but must be set to `false`.
4344

Diff for: docs/rules/no-custom-modifiers-on-v-model.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ since: v7.0.0
1111
1212
- :gear: This rule is included in all of `"plugin:vue/essential"`, `"plugin:vue/strongly-recommended"` and `"plugin:vue/recommended"`.
1313

14-
This rule checks whether `v-model `used on the component do not have custom modifiers.
14+
This rule checks whether `v-model` used on the component do not have custom modifiers.
1515

1616
## :book: Rule Details
1717

Diff for: docs/rules/no-empty-component-block.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ since: v7.0.0
1414
This rule disallows the `<template>` `<script>` `<style>` block to be empty.
1515

1616
This rule also checks block what has attribute `src`.
17-
See: https://vue-loader.vuejs.org/spec.html#src-imports
17+
See [Vue Single-File Component (SFC) Spec](https://vue-loader.vuejs.org/spec.html#src-imports).
1818

1919
<eslint-code-block :rules="{'vue/no-empty-component-block': ['error']}">
2020

Diff for: docs/rules/no-invalid-model-keys.md

-1
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,6 @@ export default {
108108

109109
</eslint-code-block>
110110

111-
112111
## :rocket: Version
113112

114113
This rule was introduced in eslint-plugin-vue v7.9.0

Diff for: docs/rules/no-parsing-error.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ This rule reports syntax errors in `<template>`. For example:
1616
- Syntax errors of scripts in directives.
1717
- Syntax errors of scripts in mustaches.
1818
- Syntax errors of HTML.
19-
- Invalid end tags.
20-
- Attributes in end tags.
21-
- ...
22-
- See also: [WHATWG HTML spec](https://html.spec.whatwg.org/multipage/parsing.html#parse-errors)
19+
- Invalid end tags.
20+
- Attributes in end tags.
21+
- ...
22+
- See also: [WHATWG HTML spec](https://html.spec.whatwg.org/multipage/parsing.html#parse-errors)
2323

2424
## :book: Rule Details
2525

Diff for: docs/rules/no-potential-component-option-typo.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ since: v7.0.0
1515

1616
This rule disallow a potential typo in your component options
1717

18-
**Here is the config**
18+
### Here is the config
1919

2020
```json
2121
{
@@ -59,7 +59,7 @@ export default {
5959

6060
> we use edit distance to compare two string similarity, threshold is an option to control upper bound of edit distance to report
6161
62-
**Here is the another example about config option `threshold`**
62+
### Here is the another example about config option `threshold`
6363

6464
```json
6565
{

Diff for: docs/rules/no-restricted-class.md

+1
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ export default {
7070
}
7171
</script>
7272
```
73+
7374
:::
7475

7576
## :rocket: Version

Diff for: docs/rules/no-restricted-custom-event.md

-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ export default {
5353

5454
</eslint-code-block>
5555

56-
5756
Alternatively, the rule also accepts objects.
5857

5958
```json

Diff for: docs/rules/no-restricted-syntax.md

-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ since: v5.2.0
1111
1212
This rule is the same rule as core [no-restricted-syntax] rule but it applies to the expressions in `<template>`.
1313

14-
1514
## :wrench: Options
1615

1716
Please see [no-restricted-syntax] for detailed options.

Diff for: docs/rules/no-spaces-around-equal-signs-in-attribute.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ HTML5 allows spaces around equal signs. But space-less is easier to read, and gr
4343

4444
## :books: Further Reading
4545

46-
* [HTML5 Style Guide - W3Schools *Spaces and Equal Signs*](https://www.w3schools.com/html/html5_syntax.asp)
46+
- [HTML5 Style Guide - W3Schools *Spaces and Equal Signs*](https://www.w3schools.com/html/html5_syntax.asp)
4747

4848
## :rocket: Version
4949

Diff for: docs/rules/no-textarea-mustache.md

+1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ This rule reports mustaches in `<textarea>`.
2929

3030
</eslint-code-block>
3131

32+
<!-- markdownlint-disable-next-line no-inline-html -->
3233
<div v-pre>
3334

3435
::: warning Note

Diff for: docs/rules/no-this-in-before-route-enter.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ since: v7.11.0
1111
1212
## :book: Rule Details
1313

14-
Because lack of `this` in the `beforeRouteEnter` [(docs)](https://router.vuejs.org/guide/advanced/navigation-guards.html#in-component-guards). This behavior isn't obvious, so it's pretty easy to make a `TypeError`. Especially during some refactor.
14+
Because lack of `this` in the `beforeRouteEnter` [(docs)](https://router.vuejs.org/guide/advanced/navigation-guards.html#in-component-guards). This behavior isn't obvious, so it's pretty easy to make a `TypeError`. Especially during some refactor.
1515

1616
<eslint-code-block :rules="{'vue/no-this-in-before-route-enter': ['error']}">
1717

Diff for: docs/rules/no-unregistered-components.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ since: v7.0.0
1616
This rule reports components that haven't been registered and are being used in the template.
1717

1818
::: warning Note
19-
This rule cannot check globally registered components and components registered in mixins
20-
unless you add them as part of the ignored patterns. `component`, `suspense` and `teleport`
19+
This rule cannot check globally registered components and components registered in mixins
20+
unless you add them as part of the ignored patterns. `component`, `suspense` and `teleport`
2121
are ignored by default.
2222
:::
2323

Diff for: docs/rules/no-use-v-if-with-v-for.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@ since: v4.6.0
1616
This rule is aimed at preventing the use of `v-for` directives together with `v-if` directives on the same element.
1717

1818
There are two common cases where this can be tempting:
19-
* To filter items in a list (e.g. `v-for="user in users" v-if="user.isActive"`). In these cases, replace `users` with a new computed property that returns your filtered list (e.g. `activeUsers`).
20-
* To avoid rendering a list if it should be hidden (e.g. `v-for="user in users" v-if="shouldShowUsers"`). In these cases, move the `v-if` to a container element (e.g. `ul`, `ol`).
19+
20+
- To filter items in a list (e.g. `v-for="user in users" v-if="user.isActive"`). In these cases, replace `users` with a new computed property that returns your filtered list (e.g. `activeUsers`).
21+
- To avoid rendering a list if it should be hidden (e.g. `v-for="user in users" v-if="shouldShowUsers"`). In these cases, move the `v-if` to a container element (e.g. `ul`, `ol`).
2122

2223
<eslint-code-block :rules="{'vue/no-use-v-if-with-v-for': ['error']}">
2324

Diff for: docs/rules/no-v-model-argument.md

-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ This rule reports `v-model` directives in the following cases:
3434

3535
</eslint-code-block>
3636

37-
3837
## :wrench: Options
3938

4039
Nothing.

Diff for: docs/rules/order-in-components.md

-1
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,6 @@ export default {
110110

111111
If an element is an array of strings, it means any of those can be placed there unordered. Default is above.
112112

113-
114113
## :books: Further Reading
115114

116115
- [Style guide - Component/instance options order](https://vuejs.org/style-guide/rules-recommended.html#component-instance-options-order)

Diff for: docs/rules/padding-line-between-blocks.md

-1
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,6 @@ export default {}
134134
[padding-line-between-statements]: https://eslint.org/docs/rules/padding-line-between-statements
135135
[lines-between-class-members]: https://eslint.org/docs/rules/lines-between-class-members
136136

137-
138137
## :rocket: Version
139138

140139
This rule was introduced in eslint-plugin-vue v6.2.0

Diff for: docs/rules/prefer-true-attribute-shorthand.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ export default {
5454
<MyComponent bool bool-or-string string-or-bool />
5555
```
5656

57-
```
57+
```plain
5858
bool: true (boolean)
5959
boolOrString: true (boolean)
6060
stringOrBool: "" (string)
@@ -66,7 +66,7 @@ stringOrBool: "" (string)
6666
<MyComponent :bool="true" :bool-or-string="true" :string-or-bool="true" />
6767
```
6868

69-
```
69+
```plain
7070
bool: true (boolean)
7171
boolOrString: true (boolean)
7272
stringOrBool: true (boolean)

0 commit comments

Comments
 (0)