Skip to content

Chore: Add adjustCodeBlocks() process to update-docs.js #709

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 30, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions docs/rules/attribute-hyphenation.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ description: enforce attribute naming style on custom components in template
This rule enforces using hyphenated attribute names on custom components in Vue templates.

<eslint-code-block fix :rules="{'vue/attribute-hyphenation': ['error', 'always']}">
```

```vue
<template>
<!-- ✔ GOOD -->
<MyComponent my-prop="prop" />
Expand All @@ -24,6 +25,7 @@ This rule enforces using hyphenated attribute names on custom components in Vue
<MyComponent myProp="prop" />
</template>
```

</eslint-code-block>

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

<eslint-code-block fix :rules="{'vue/attribute-hyphenation': ['error', 'always']}">
```

```vue
<template>
<!-- ✔ GOOD -->
<MyComponent my-prop="prop" />
Expand All @@ -55,13 +58,15 @@ It errors on upper case letters.
<MyComponent myProp="prop" />
</template>
```

</eslint-code-block>

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

<eslint-code-block fix :rules="{'vue/attribute-hyphenation': ['error', 'never']}">
```

```vue
<template>
<!-- ✔ GOOD -->
<MyComponent myProp="prop" />
Expand All @@ -73,13 +78,15 @@ It errors on hyphens except `data-`, `aria-` and `slot-scope`.
<MyComponent my-prop="prop" />
</template>
```

</eslint-code-block>

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

<eslint-code-block fix :rules="{'vue/attribute-hyphenation': ['error', 'never', { ignore: ['custom-prop']}]}">
```

```vue
<template>
<!-- ✔ GOOD -->
<MyComponent myProp="prop" />
Expand All @@ -92,6 +99,7 @@ Don't use hyphenated name but allow custom attributes
<MyComponent my-prop="prop" />
</template>
```

</eslint-code-block>

## :mag: Implementation
Expand Down
12 changes: 9 additions & 3 deletions docs/rules/attributes-order.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ This rule aims to enforce ordering of component attributes. The default order is
### the default order

<eslint-code-block fix :rules="{'vue/attributes-order': ['error']}">
```

```vue
<template>
<!-- ✓ GOOD -->
<div
Expand Down Expand Up @@ -85,6 +86,7 @@ This rule aims to enforce ordering of component attributes. The default order is
</div>
</template>
```

</eslint-code-block>

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

<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']}]}">
```

```vue
<template>
<!-- ✓ GOOD -->
<div
Expand All @@ -131,12 +134,14 @@ This rule aims to enforce ordering of component attributes. The default order is
</div>
</template>
```

</eslint-code-block>

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

<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']}]}">
```

```vue
<template>
<!-- ✓ GOOD -->
<div
Expand All @@ -153,6 +158,7 @@ This rule aims to enforce ordering of component attributes. The default order is
</div>
</template>
```

</eslint-code-block>

## :books: Further reading
Expand Down
2 changes: 2 additions & 0 deletions docs/rules/comment-directive.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,15 @@ ESLint doesn't provide any API to enhance `eslint-disable` functionality and ESL
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.

<eslint-code-block :rules="{'vue/comment-directive': ['error'], 'vue/max-attributes-per-line': ['error']}">

```vue
<template>
<!-- eslint-disable-next-line vue/max-attributes-per-line -->
<div a="1" b="2" c="3" d="4">
</div>
</template>
```

</eslint-code-block>

## :books: Further reading
Expand Down
12 changes: 9 additions & 3 deletions docs/rules/component-name-in-template-casing.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ This rule aims to warn the tag names other than the configured casing in Vue.js
### `"PascalCase"`

<eslint-code-block fix :rules="{'vue/component-name-in-template-casing': ['error']}">
```

```vue
<template>
<!-- ✓ GOOD -->
<TheComponent />
Expand All @@ -44,12 +45,14 @@ This rule aims to warn the tag names other than the configured casing in Vue.js
<The-component />
</template>
```

</eslint-code-block>

### `"kebab-case"`

<eslint-code-block fix :rules="{'vue/component-name-in-template-casing': ['error', 'kebab-case']}">
```

```vue
<template>
<!-- ✓ GOOD -->
<the-component />
Expand All @@ -61,13 +64,15 @@ This rule aims to warn the tag names other than the configured casing in Vue.js
<The-component />
</template>
```

</eslint-code-block>


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

<eslint-code-block fix :rules="{'vue/component-name-in-template-casing': ['error', 'PascalCase', {ignores: ['custom-element']}]}">
```

```vue
<template>
<!-- ✓ GOOD -->
<TheComponent/>
Expand All @@ -77,6 +82,7 @@ This rule aims to warn the tag names other than the configured casing in Vue.js
<magic-element></magic-element>
</template>
```

</eslint-code-block>

## :books: Further reading
Expand Down
8 changes: 6 additions & 2 deletions docs/rules/html-closing-bracket-newline.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ This rule enforces a line break (or no line break) before tag's closing brackets
This rule aims to warn the right angle brackets which are at the location other than the configured location.

<eslint-code-block fix :rules="{'vue/html-closing-bracket-newline': ['error']}">
```

```vue
<template>
<!-- ✓ GOOD -->
<div id="foo" class="bar">
Expand All @@ -48,6 +49,7 @@ This rule aims to warn the right angle brackets which are at the location other
class="bar">
</template>
```

</eslint-code-block>

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

<eslint-code-block fix :rules="{'vue/html-closing-bracket-newline': ['error', { 'multiline': 'never' }]}">
```

```vue
<template>
<!-- ✓ GOOD -->
<div
Expand All @@ -87,6 +90,7 @@ Plus, you can use [`vue/html-indent`](./html-indent.md) rule to enforce indent-l
>
</template>
```

</eslint-code-block>

## :mag: Implementation
Expand Down
8 changes: 6 additions & 2 deletions docs/rules/html-closing-bracket-spacing.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ description: require or disallow a space before tag's closing brackets
This rule aims to enforce consistent spacing style before closing brackets `>` of tags.

<eslint-code-block fix :rules="{'vue/html-closing-bracket-spacing': ['error']}">
```

```vue
<template>
<!-- ✓ GOOD -->
<div>
Expand All @@ -36,6 +37,7 @@ This rule aims to enforce consistent spacing style before closing brackets `>` o
<div foo="bar"/>
</template>
```

</eslint-code-block>

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

<eslint-code-block fix :rules="{'vue/html-closing-bracket-spacing': ['error', {startTag: 'always', endTag: 'always', selfClosingTag: 'always' }]}">
```

```vue
<template>
<!-- ✓ GOOD -->
<div >
Expand All @@ -75,6 +78,7 @@ This rule aims to enforce consistent spacing style before closing brackets `>` o
<div foo="bar" />
</template>
```

</eslint-code-block>

## :couple: Related rules
Expand Down
4 changes: 3 additions & 1 deletion docs/rules/html-end-tags.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ description: enforce end tag style
This rule aims to disallow lacking end tags.

<eslint-code-block fix :rules="{'vue/html-end-tags': ['error']}">
```

```vue
<template>
<!-- ✓ GOOD -->
<div></div>
Expand All @@ -29,6 +30,7 @@ This rule aims to disallow lacking end tags.
<p>
</template>
```

</eslint-code-block>

## :wrench: Options
Expand Down
24 changes: 18 additions & 6 deletions docs/rules/html-indent.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ This rule enforces a consistent indentation style in `<template>`. The default s
- In the expressions, this rule supports ECMAScript 2017 syntaxes. It ignores unknown AST nodes, but it might be confused by non-standard syntaxes.

<eslint-code-block fix :rules="{'vue/html-indent': ['error']}">
```

```vue
<template>
<!-- ✓ GOOD -->
<div class="foo">
Expand Down Expand Up @@ -55,6 +56,7 @@ This rule enforces a consistent indentation style in `<template>`. The default s
</div>
</template>
```

</eslint-code-block>

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

<eslint-code-block fix :rules="{'vue/html-indent': ['error', 2, {attribute: 1, closeBracket: 1}]}">
```

```vue
<template>
<!-- ✓ GOOD -->
<div
Expand All @@ -96,12 +99,14 @@ This rule enforces a consistent indentation style in `<template>`. The default s
</div>
</template>
```

</eslint-code-block>

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

<eslint-code-block fix :rules="{'vue/html-indent': ['error', 2, {attribute: 2, closeBracket: 1}]}">
```

```vue
<template>
<!-- ✓ GOOD -->
<div
Expand All @@ -116,12 +121,14 @@ This rule enforces a consistent indentation style in `<template>`. The default s
</div>
</template>
```

</eslint-code-block>

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

<eslint-code-block fix :rules="{'vue/html-indent': ['error', 2, {ignores: ['VAttribute']}]}">
```

```vue
<template>
<!-- ✓ GOOD -->
<div
Expand All @@ -130,12 +137,14 @@ This rule enforces a consistent indentation style in `<template>`. The default s
/>
</template>
```

</eslint-code-block>

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

<eslint-code-block fix :rules="{'vue/html-indent': ['error', 2, {alignAttributesVertically: false}]}">
```

```vue
<template>
<!-- ✓ GOOD -->
<div id=""
Expand All @@ -150,12 +159,14 @@ This rule enforces a consistent indentation style in `<template>`. The default s
/>
</template>
```

</eslint-code-block>

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

<eslint-code-block fix :rules="{'vue/html-indent': ['error', 2, {baseIndent: 0}]}">
```

```vue
<template>
<!-- ✓ GOOD -->
<div>
Expand All @@ -172,6 +183,7 @@ This rule enforces a consistent indentation style in `<template>`. The default s
</div>
</template>
```

</eslint-code-block>

## :mag: Implementation
Expand Down
Loading