Skip to content

Commit

Permalink
Lint docs (#1821)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
FloEdelmann committed Mar 19, 2022
1 parent 8f09420 commit 0924d62
Show file tree
Hide file tree
Showing 44 changed files with 170 additions and 111 deletions.
23 changes: 23 additions & 0 deletions .markdownlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
line-length: false
single-title: false
no-inline-html:
allowed_elements:
- badge
- eslint-code-block
- sup

# enforce consistency
code-block-style:
style: fenced
code-fence-style:
style: backtick
emphasis-style:
style: asterisk
heading-style:
style: atx
hr-style:
style: ---
strong-style:
style: asterisk
ul-style:
style: dash
1 change: 1 addition & 0 deletions .markdownlintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
1 change: 0 additions & 1 deletion docs/rules/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ sidebarDepth: 0
: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).
:::


## Base Rules (Enabling Correct ESLint Parsing)

Enforce all the rules in this category, as well as all higher priority rules, with:
Expand Down
10 changes: 5 additions & 5 deletions docs/rules/custom-event-name-casing.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,11 @@ export default {

</eslint-code-block>

## :couple: Related Rules

- [vue/v-on-event-hyphenation](./v-on-event-hyphenation.md)
- [vue/prop-name-casing](./prop-name-casing.md)

## :books: Further Reading

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

## :couple: Related Rules

- [vue/v-on-event-hyphenation](./v-on-event-hyphenation.md)
- [vue/prop-name-casing](./prop-name-casing.md)

## :rocket: Version

This rule was introduced in eslint-plugin-vue v7.0.0
Expand Down
8 changes: 4 additions & 4 deletions docs/rules/html-closing-bracket-newline.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,11 @@ This rule aims to warn the right angle brackets which are at the location other
```

- `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.
- `"never"` (default) ... disallow line breaks before the closing bracket.
- `"always"` ... require one line break before the closing bracket.
- `"never"` (default) ... disallow line breaks before the closing bracket.
- `"always"` ... require one line break before the closing bracket.
- `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.
- `"never"` ... disallow line breaks before the closing bracket.
- `"always"` (default) ... require one line break before the closing bracket.
- `"never"` ... disallow line breaks before the closing bracket.
- `"always"` (default) ... require one line break before the closing bracket.

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

Expand Down
12 changes: 6 additions & 6 deletions docs/rules/html-closing-bracket-spacing.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,14 @@ This rule aims to enforce consistent spacing style before closing brackets `>` o
```

- `startTag` (`"always" | "never"`) ... Setting for the `>` of start tags (e.g. `<div>`). Default is `"never"`.
- `"always"` ... requires one or more spaces.
- `"never"` ... disallows spaces.
- `"always"` ... requires one or more spaces.
- `"never"` ... disallows spaces.
- `endTag` (`"always" | "never"`) ... Setting for the `>` of end tags (e.g. `</div>`). Default is `"never"`.
- `"always"` ... requires one or more spaces.
- `"never"` ... disallows spaces.
- `"always"` ... requires one or more spaces.
- `"never"` ... disallows spaces.
- `selfClosingTag` (`"always" | "never"`) ... Setting for the `/>` of self-closing tags (e.g. `<div/>`). Default is `"always"`.
- `"always"` ... requires one or more spaces.
- `"never"` ... disallows spaces.
- `"always"` ... requires one or more spaces.
- `"never"` ... disallows spaces.

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

Expand Down
23 changes: 11 additions & 12 deletions docs/rules/html-comment-content-newline.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,21 +56,21 @@ This rule will enforce consistency of line break after the `<!--` and before the
```

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

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

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

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

### `"always"`

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

</eslint-code-block>


### `{"singleline": "ignore", "multiline": "always"}`

<eslint-code-block fix :rules="{'vue/html-comment-content-newline': ['error', { 'singleline': 'ignore', 'multiline': 'always' }]}">
Expand Down
15 changes: 7 additions & 8 deletions docs/rules/html-comment-content-spacing.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,17 +48,16 @@ Whitespace after the `<!--` and before the `-->` makes it easier to read text in
```

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

- `"always"` (default) ... there must be at least one whitespace at after the `<!--` and before the `-->`.
- `"never"` ... there should be no whitespace at after the `<!--` and before the `-->`.

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

```json
"vue/html-comment-content-spacing": ["error", "always", { "exceptions": ["*"] }]
```
```json
"vue/html-comment-content-spacing": ["error", "always", { "exceptions": ["*"] }]
```

### `"always"`

Expand Down
1 change: 0 additions & 1 deletion docs/rules/max-len.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ var foo = ['line', 'length', 'is', '50', '......']

</eslint-code-block>


### `"template": 120`

<eslint-code-block :rules="{'vue/max-len': ['error', {template: 120}]}">
Expand Down
2 changes: 1 addition & 1 deletion docs/rules/new-line-between-multi-line-property.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export default {

</eslint-code-block>

## :wrench: Option
## :wrench: Options

```json
{
Expand Down
1 change: 1 addition & 0 deletions docs/rules/next-tick-style.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ export default {
</eslint-code-block>

## :wrench: Options

Default is set to `promise`.

```json
Expand Down
1 change: 0 additions & 1 deletion docs/rules/no-bare-strings-in-template.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ In order to be able to internationalize your application, you will need to avoid

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).


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

```vue
Expand Down
3 changes: 2 additions & 1 deletion docs/rules/no-boolean-default.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ since: v7.0.0

The rule prevents Boolean props from having a default value.


## :book: Rule Details

The rule is to enforce the HTML standard of always defaulting boolean attributes to false.

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

## :wrench: Options

- `'no-default'` (default) allows a prop definition object, but enforces that the `default` property not be defined.
- `'default-false'` enforces that the default can be set but must be set to `false`.

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/no-custom-modifiers-on-v-model.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ since: v7.0.0
- :gear: This rule is included in all of `"plugin:vue/essential"`, `"plugin:vue/strongly-recommended"` and `"plugin:vue/recommended"`.

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

## :book: Rule Details

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/no-empty-component-block.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ since: v7.0.0
This rule disallows the `<template>` `<script>` `<style>` block to be empty.

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

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

Expand Down
1 change: 0 additions & 1 deletion docs/rules/no-invalid-model-keys.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ export default {

</eslint-code-block>


## :rocket: Version

This rule was introduced in eslint-plugin-vue v7.9.0
Expand Down
8 changes: 4 additions & 4 deletions docs/rules/no-parsing-error.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ This rule reports syntax errors in `<template>`. For example:
- Syntax errors of scripts in directives.
- Syntax errors of scripts in mustaches.
- Syntax errors of HTML.
- Invalid end tags.
- Attributes in end tags.
- ...
- See also: [WHATWG HTML spec](https://html.spec.whatwg.org/multipage/parsing.html#parse-errors)
- Invalid end tags.
- Attributes in end tags.
- ...
- See also: [WHATWG HTML spec](https://html.spec.whatwg.org/multipage/parsing.html#parse-errors)

## :book: Rule Details

Expand Down
4 changes: 2 additions & 2 deletions docs/rules/no-potential-component-option-typo.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ since: v7.0.0

This rule disallow a potential typo in your component options

**Here is the config**
### Here is the config

```json
{
Expand Down Expand Up @@ -59,7 +59,7 @@ export default {

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

```json
{
Expand Down
1 change: 1 addition & 0 deletions docs/rules/no-restricted-class.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ export default {
}
</script>
```

:::

## :rocket: Version
Expand Down
1 change: 0 additions & 1 deletion docs/rules/no-restricted-custom-event.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ export default {

</eslint-code-block>


Alternatively, the rule also accepts objects.

```json
Expand Down
1 change: 0 additions & 1 deletion docs/rules/no-restricted-syntax.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ since: v5.2.0
This rule is the same rule as core [no-restricted-syntax] rule but it applies to the expressions in `<template>`.


## :wrench: Options

Please see [no-restricted-syntax] for detailed options.
Expand Down
2 changes: 1 addition & 1 deletion docs/rules/no-spaces-around-equal-signs-in-attribute.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ HTML5 allows spaces around equal signs. But space-less is easier to read, and gr

## :books: Further Reading

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

## :rocket: Version

Expand Down
1 change: 1 addition & 0 deletions docs/rules/no-textarea-mustache.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ This rule reports mustaches in `<textarea>`.

</eslint-code-block>

<!-- markdownlint-disable-next-line no-inline-html -->
<div v-pre>

::: warning Note
Expand Down
2 changes: 1 addition & 1 deletion docs/rules/no-this-in-before-route-enter.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ since: v7.11.0
## :book: Rule Details

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.
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.

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

Expand Down
4 changes: 2 additions & 2 deletions docs/rules/no-unregistered-components.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ since: v7.0.0
This rule reports components that haven't been registered and are being used in the template.

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

Expand Down
5 changes: 3 additions & 2 deletions docs/rules/no-use-v-if-with-v-for.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ since: v4.6.0
This rule is aimed at preventing the use of `v-for` directives together with `v-if` directives on the same element.

There are two common cases where this can be tempting:
* 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`).
* 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`).

- 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`).
- 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`).

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

Expand Down
1 change: 0 additions & 1 deletion docs/rules/no-v-model-argument.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ This rule reports `v-model` directives in the following cases:

</eslint-code-block>


## :wrench: Options

Nothing.
Expand Down
1 change: 0 additions & 1 deletion docs/rules/order-in-components.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ export default {

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


## :books: Further Reading

- [Style guide - Component/instance options order](https://vuejs.org/style-guide/rules-recommended.html#component-instance-options-order)
Expand Down
1 change: 0 additions & 1 deletion docs/rules/padding-line-between-blocks.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,6 @@ export default {}
[padding-line-between-statements]: https://eslint.org/docs/rules/padding-line-between-statements
[lines-between-class-members]: https://eslint.org/docs/rules/lines-between-class-members


## :rocket: Version

This rule was introduced in eslint-plugin-vue v6.2.0
Expand Down
4 changes: 2 additions & 2 deletions docs/rules/prefer-true-attribute-shorthand.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export default {
<MyComponent bool bool-or-string string-or-bool />
```

```
```plain
bool: true (boolean)
boolOrString: true (boolean)
stringOrBool: "" (string)
Expand All @@ -66,7 +66,7 @@ stringOrBool: "" (string)
<MyComponent :bool="true" :bool-or-string="true" :string-or-bool="true" />
```

```
```plain
bool: true (boolean)
boolOrString: true (boolean)
stringOrBool: true (boolean)
Expand Down

0 comments on commit 0924d62

Please sign in to comment.