8000 Enable fixing eslint-code-block only one fixable rules · vuejs/eslint-plugin-vue@dfb7e4e · GitHub
[go: up one dir, main page]

Skip to content

Commit dfb7e4e

Browse files
committed
Enable fixing eslint-code-block only one fixable rules
1 parent 81c106c commit dfb7e4e

25 files changed

+70
-55
lines changed

docs/.vuepress/components/eslint-code-block.vue

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
:preprocess="preprocess"
1111
:postprocess="postprocess"
1212
dark
13-
fix
13+
:fix="fix"
1414
/>
1515
</template>
1616

@@ -24,6 +24,10 @@ export default {
2424
components: { EslintEditor },
2525
2626
props: {
27+
fix: {
28+
type: Boolean,
29+
default: false
30+
},
2731
rules: {
2832
type: Object,
2933
default () {

docs/rules/attribute-hyphenation.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Default casing is set to `always` with `['data-', 'aria-', 'slot-scope']` set to
1818
### `["error", "always"]` - Use hyphenated name.
1919
It errors on upper case letters.
2020

21-
<eslint-code-block :rules="{'vue/attribute-hyphenation': ['error', 'always']}">
21+
<eslint-code-block fix :rules="{'vue/attribute-hyphenation': ['error', 'always']}">
2222
```
2323
<template>
2424
<!-- ✔ GOOD -->
@@ -33,7 +33,7 @@ It errors on upper case letters.
3333
### `["error", "never"]` - Don't use hyphenated name.
3434
It errors on hyphens except `data-`, `aria-` and `slot-scope`.
3535

36-
<eslint-code-block :rules="{'vue/attribute-hyphenation': ['error', 'never']}">
36+
<eslint-code-block fix :rules="{'vue/attribute-hyphenation': ['error', 'never']}">
3737
```
3838
<template>
3939
<!-- ✔ GOOD -->
@@ -50,7 +50,7 @@ It errors on hyphens except `data-`, `aria-` and `slot-scope`.
5050

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

53-
<eslint-code-block :rules="{'vue/attribute-hyphenation': ['error', 'never', {'ignore': ['custom-prop']}]}">
53+
<eslint-code-block fix :rules="{'vue/attribute-hyphenation': ['error', 'never', {'ignore': ['custom-prop']}]}">
5454
```
5555
<template>
5656
<!-- ✔ GOOD -->

docs/rules/attributes-order.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ This rule aims to enforce ordering of component attributes. The default order is
3232

3333
### the default order
3434

35-
<eslint-code-block :rules="{'vue/attributes-order': ['error']}">
35+
<eslint-code-block fix :rules="{'vue/attributes-order': ['error']}">
3636
```
3737
<template>
3838
<!-- ✓ GOOD -->
@@ -105,7 +105,7 @@ This rule aims to enforce ordering of component attributes. The default order is
105105

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

108-
<eslint-code-block :rules="{'vue/attributes-order': ['error', {order: ['LIST_RENDERING', 'CONDITIONALS', 'RENDER_MODIFIERS', 'GLOBAL', 'UNIQUE', 'TWO_WAY_BINDING', 'DEFINITION', 'OTHER_DIRECTIVES', 'OTHER_ATTR', 'EVENTS', 'CONTENT']}]}">
108+
<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']}]}">
109109
```
110110
<template>
111111
<!-- ✓ GOOD -->
@@ -128,7 +128,7 @@ This rule aims to enforce ordering of component attributes. The default order is
128128

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

131-
<eslint-code-block :rules="{'vue/attributes-order': ['error', {order: [['LIST_RENDERING', 'CONDITIONALS', 'RENDER_MODIFIERS'], ['DEFINITION', 'GLOBAL', 'UNIQUE'], 'TWO_WAY_BINDING', 'OTHER_DIRECTIVES', 'OTHER_ATTR', 'EVENTS', 'CONTENT']}]}">
131+
<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']}]}">
132132
```
133133
<template>
134134
<!-- ✓ GOOD -->

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ This rule aims to warn the tag names other than the configured casing in Vue.js
2424

2525
### `"PascalCase"`
2626

27-
<eslint-code-block :rules="{'vue/component-name-in-template-casing': ['error']}">
27+
<eslint-code-block fix :rules="{'vue/component-name-in-template-casing': ['error']}">
2828
```
2929
<template>
3030
<!-- ✓ GOOD -->
@@ -40,7 +40,7 @@ This rule aims to warn the tag names other than the configured casing in Vue.js
4040

4141
### `"kebab-case"`
4242

43-
<eslint-code-block :rules="{'vue/component-name-in-template-casing': ['error', 'kebab-case']}">
43+
<eslint-code-block fix :rules="{'vue/component-name-in-template-casing': ['error', 'kebab-case']}">
4444
```
4545
<template>
4646
<!-- ✓ GOOD -->
@@ -58,7 +58,7 @@ This rule aims to warn the tag names other than the configured casing in Vue.js
5858

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

61-
<eslint-code-block :rules="{'vue/component-name-in-template-casing': ['error', 'PascalCase', {ignores: ['custom-element']}]}">
61+
<eslint-code-block fix :rules="{'vue/component-name-in-template-casing': ['error', 'PascalCase', {ignores: ['custom-element']}]}">
6262
```
6363
<template>
6464
<!-- ✓ GOOD -->

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ This rule enforces a line break (or no line break) before tag's closing brackets
2323

2424
This rule aims to warn the right angle brackets which are at the location other than the configured location.
2525

26-
<eslint-code-block :rules="{'vue/html-closing-bracket-newline': ['error']}">
26+
<eslint-code-block fix :rules="{'vue/html-closing-bracket-newline': ['error']}">
2727
```
2828
<template>
2929
<!-- ✓ GOOD -->
@@ -65,7 +65,7 @@ Plus, you can use [`vue/html-indent`](./html-indent.md) rule to enforce indent-l
6565

6666
### `"multiline": "never"`
6767

68-
<eslint-code-block :rules="{'vue/html-closing-bracket-newline': ['error', { 'multiline': 'never' }]}">
68+
<eslint-code-block fix :rules="{'vue/html-closing-bracket-newline': ['error', { 'multiline': 'never' }]}">
6969
```
7070
<template>
7171
<!-- ✓ GOOD -->

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
This rule aims to enforce consistent spacing style before closing brackets `>` of tags.
99

10-
<eslint-code-block :rules="{'vue/html-closing-bracket-spacing': ['error']}">
10+
<eslint-code-block fix :rules="{'vue/html-closing-bracket-spacing': ['error']}">
1111
```
1212
<template>
1313
<!-- ✓ GOOD -->
@@ -55,7 +55,7 @@ This rule aims to enforce consistent spacing style before closing brackets `>` o
5555

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

58-
<eslint-code-block :rules="{'vue/html-closing-bracket-spacing': ['error', {startTag: 'always', endTag: 'always', selfClosingTag: 'always' }]}">
58+
<eslint-code-block fix :rules="{'vue/html-closing-bracket-spacing': ['error', {startTag: 'always', endTag: 'always', selfClosingTag: 'always' }]}">
5959
```
6060
<template>
6161
<!-- ✓ GOOD -->

docs/rules/html-end-tags.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
This rule aims to disallow lacking end tags.
99

10-
<eslint-code-block :rules="{'vue/html-end-tags': ['error']}">
10+
<eslint-code-block fix :rules="{'vue/html-end-tags': ['error']}">
1111
```
1212
<template>
1313
<!-- ✓ GOOD -->

docs/rules/html-indent.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ This rule enforces a consistent indentation style in `<template>`. The default s
1010
- This rule checks all tags, also all expressions in directives and mustaches.
1111
- In the expressions, this rule supports ECMAScript 2017 syntaxes. It ignores unknown AST nodes, but it might be confused by non-standard syntaxes.
1212

13-
<eslint-code-block :rules="{'vue/html-indent': ['error']}">
13+
<eslint-code-block fix :rules="{'vue/html-indent': ['error']}">
1414
```
1515
<template>
1616
<!-- ✓ GOOD -->
@@ -71,7 +71,7 @@ This rule enforces a consistent indentation style in `<template>`. The default s
7171

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

74-
<eslint-code-block :rules="{'vue/html-indent': ['error', 2, {attribute: 1, closeBracket: 1}]}">
74+
<eslint-code-block fix :rules="{'vue/html-indent': ['error', 2, {attribute: 1, F438 closeBracket: 1}]}">
7575
```
7676
<template>
7777
<!-- ✓ GOOD -->
@@ -91,7 +91,7 @@ This rule enforces a consistent indentation style in `<template>`. The default s
9191

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

94-
<eslint-code-block :rules="{'vue/html-indent': ['error', 2, {attribute: 2, closeBracket: 1}]}">
94+
<eslint-code-block fix :rules="{'vue/html-indent': ['error', 2, {attribute: 2, closeBracket: 1}]}">
9595
```
9696
<template>
9797
<!-- ✓ GOOD -->
@@ -111,7 +111,7 @@ This rule enforces a consistent indentation style in `<template>`. The default s
111111

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

114-
<eslint-code-block :rules="{'vue/html-indent': ['error', 2, {ignores: ['VAttribute']}]}">
114+
<eslint-code-block fix :rules="{'vue/html-indent': ['error', 2, {ignores: ['VAttribute']}]}">
115115
```
116116
<template>
117117
<!-- ✓ GOOD -->
@@ -125,7 +125,7 @@ This rule enforces a consistent indentation style in `<template>`. The default s
125125

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

128-
<eslint-code-block :rules="{'vue/html-indent': ['error', 2, {alignAttributesVertically: false}]}">
128+
<eslint-code-block fix :rules="{'vue/html-indent': ['error', 2, {alignAttributesVertically: false}]}">
129129
```
130130
<template>
131131
<!-- ✓ GOOD -->

docs/rules/html-quotes.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ This rule enforces the quotes style of HTML attributes.
1515

1616
This rule reports the quotes of attributes if it is different to configured quotes.
1717

18-
<eslint-code-block :rules="{'vue/html-quotes': ['error']}">
18+
<eslint-code-block fix :rules="{'vue/html-quotes': ['error']}">
1919
```
2020
<template>
2121
<!-- ✓ GOOD -->
@@ -43,7 +43,7 @@ Default is set to `double`.
4343

4444
### `"single"`
4545

46-
<eslint-code-block :rules="{'vue/html-quotes': ['error', 'single']}">
46+
<eslint-code-block fix :rules="{'vue/html-quotes': ['error', 'single']}">
4747
```
4848
<template>
4949
<!-- ✓ GOOD -->

docs/rules/html-self-closing.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ This rule helps you to make consistent on the self-closing style.
1515

1616
This rule aims to enforce the self-closing sign as the configured style.
1717

18-
<eslint-code-block :rules="{'vue/html-self-closing': ['error']}">
18+
<eslint-code-block fix :rules="{'vue/html-self-closing': ['error']}">
1919
```
2020
<template>
2121
<!-- ✓ GOOD -->
@@ -63,7 +63,7 @@ Every option can be set to one of the following values:
6363

6464
### `html: {normal: "never", void: "always"}`
6565

66-
<eslint-code-block :rules="{'vue/html-self-closing': ['error', {html: {normal: 'never', void: 'always'}}]}">
66+
<eslint-code-block fix :rules="{'vue/html-self-closing': ['error', {html: {normal: 'never', void: 'always'}}]}">
6767
```
6868
<template>
6969
<!-- ✓ GOOD -->

docs/rules/max-attributes-per-line.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ An attribute is considered to be in a new line when there is a line break betwee
1313

1414
There is a configurable number of attributes that are acceptable in one-line case (default 1), as well as how many attributes are acceptable per line in multi-line case (default 1).
1515

16-
<eslint-code-block :rules="{'vue/max-attributes-per-line': ['error']}">
16+
<eslint-code-block fix :rules="{'vue/max-attributes-per-line': ['error']}">
1717
```
1818
<template>
1919
<!-- ✓ GOOD -->
@@ -61,7 +61,7 @@ There is a configurable number of attributes that are acceptable in one-line cas
6161

6262
### `"singleline": 3`
6363

64-
<eslint-code-block :rules="{'vue/max-attributes-per-line': ['error', {singleline: 3}]}">
64+
<eslint-code-block fix :rules="{'vue/max-attributes-per-line': ['error', {singleline: 3}]}">
6565
```
6666
<template>
6767
<!-- ✓ GOOD -->
@@ -75,7 +75,7 @@ There is a configurable number of attributes that are acceptable in one-line cas
7575

7676
### `multiline: 2`
7777

78-
<eslint-code-block :rules="{'vue/max-attributes-per-line': ['error', {multiline: 2}]}">
78+
<eslint-code-block fix :rules="{'vue/max-attributes-per-line': ['error', {multiline: 2}]}">
7979
```
8080
<template>
8181
<!-- ✓ GOOD -->
@@ -95,7 +95,7 @@ There is a configurable number of attributes that are acceptable in one-line cas
9595

9696
### `multiline: 1, allowFirstLine: true`
9797

98-
<eslint-code-block :rules="{'vue/max-attributes-per-line': ['error', {multiline: { allowFirstLine: true }}]}">
98+
<eslint-code-block fix :rules="{'vue/max-attributes-per-line': ['error', {multiline: { allowFirstLine: true }}]}">
9999
```
100100
<template>
101101
<!-- ✓ GOOD -->

docs/rules/multiline-html-element-content-newline.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
This rule enforces a line break before and after the contents of a multiline element.
88

9-
<eslint-code-block :rules="{'vue/multiline-html-element-content-newline': ['error']}">
9+
<eslint-code-block fix :rules="{'vue/multiline-html-element-content-newline': ['error']}">
1010
```vue
1111
<template>
1212
<!-- ✓ GOOD -->
@@ -77,7 +77,7 @@ This rule enforces a line break before and after the contents of a multiline ele
7777

7878
### `"ignores": ["VueComponent", "pre", "textarea"]`
7979

80-
<eslint-code-block :rules="{'vue/multiline-html-element-content-newline': ['error', { ignores: ['VueComponent', 'pre', 'textarea'] }]}">
80+
<eslint-code-block fix :rules="{'vue/multiline-html-element-content-newline': ['error', { ignores: ['VueComponent', 'pre', 'textarea'] }]}">
8181
```vue
8282
<template>
8383
<!-- ✓ GOOD -->

docs/rules/mustache-interpolation-spacing.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ This rule aims at enforcing unified spacing in mustache interpolations.
2020

2121
### `"always"`
2222

23-
<eslint-code-block :rules="{'vue/mustache-interpolation-spacing': ['error']}">
23+
<eslint-code-block fix :rules="{'vue/mustache-interpolation-spacing': ['error']}">
2424
```
2525
<template>
2626
<!-- ✓ GOOD -->
@@ -35,7 +35,7 @@ This rule aims at enforcing unified spacing in mustache interpolations.
3535

3636
### `"never"`
3737

38-
<eslint-code-block :rules="{'vue/mustache-interpolation-spacing': ['error', 'never']}">
38+
<eslint-code-block fix :rules="{'vue/mustache-interpolation-spacing': ['error', 'never']}">
3939
```
4040
<template>
4141
<!-- ✓ GOOD -->

docs/rules/name-property-casing.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ This rule aims at enforcing the style for the `name` property casing for consist
2020

2121
### `"PascalCase"`
2222

23-
<eslint-code-block :rules="{'vue/name-property-casing': ['error']}">
23+
<eslint-code-block fix :rules="{'vue/name-property-casing': ['error']}">
2424
```
2525
<script>
2626
/* ✓ GOOD */
@@ -31,7 +31,7 @@ This rule aims at enforcing the style for the `name` property casing for consist
3131
```
3232
</eslint-code-block>
3333

34-
<eslint-code-block :rules="{'vue/name-property-casing': ['error']}">
34+
<eslint-code-block fix :rules="{'vue/name-property-casing': ['error']}">
3535
```
3636
<script>
3737
/* ✗ BAD */
@@ -44,7 +44,7 @@ This rule aims at enforcing the style for the `name` property casing for consist
4444

4545
### `"kebab-case"`
4646

47-
<eslint-code-block :rules="{'vue/name-property-casing': ['error', 'kebab-case']}">
47+
<eslint-code-block fix :rules="{'vue/name-property-casing': ['error', 'kebab-case']}">
4848
```
4949
<script>
5050
/* ✓ GOOD */
@@ -55,7 +55,7 @@ This rule aims at enforcing the style for the `name` property casing for consist
5555
```
5656
</eslint-code-block>
5757

58-
<eslint-code-block :rules="{'vue/name-property-casing': ['error', 'kebab-case']}">
58+
<eslint-code-block fix :rules="{'vue/name-property-casing': ['error', 'kebab-case']}">
5959
```
6060
<script>
6161
/* ✗ BAD */

docs/rules/no-multi-spaces.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
This rule aims at removing multiple spaces in tags, which are not used for indentation.
99

10-
<eslint-code-block :rules="{'vue/no-multi-spaces': ['error']}">
10+
<eslint-code-block fix :rules="{'vue/no-multi-spaces': ['error']}">
1111
```
1212
<template>
1313
<!-- ✓ GOOD -->
@@ -36,7 +36,7 @@ This rule aims at removing multiple spaces in tags, which are not used for inden
3636

3737
### `"ignoreProperties": true`
3838

39-
<eslint-code-block :rules="{'vue/no-multi-spaces': ['error', { 'ignoreProperties': true }]}">
39+
<eslint-code-block fix :rules="{'vue/no-multi-spaces': ['error', { 'ignoreProperties': true }]}">
4040
```vue
4141
<template>
4242
<!-- ✓ GOOD -->

docs/rules/no-shared-component-data.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ When using the data property on a component (i.e. anywhere except on `new Vue`),
99

1010
When the value of `data` is an object, it’s shared across all instances of a component.
1111

12-
<eslint-code-block :rules="{'vue/no-shared-component-data': ['error']}">
12+
<eslint-code-block fix :rules="{'vue/no-shared-component-data': ['error']}">
1313
```
1414
<script>
1515
/* ✓ GOOD */
@@ -32,7 +32,7 @@ export default {
3232
```
3333
</eslint-code-block>
3434

35-
<eslint-code-block :rules="{'vue/no-shared-component-data': ['error']}">
35+
<eslint-code-block fix :rules="{'vue/no-shared-component-data': ['error']}">
3636
```
3737
<script>
3838
/* ✗ BAD */

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
This rule disallow spaces around equal signs in attribute.
88

9-
<eslint-code-block :rules="{'vue/no-spaces-around-equal-signs-in-attribute': ['error']}">
9+
<eslint-code-block fix :rules="{'vue/no-spaces-around-equal-signs-in-attribute': ['error']}">
1010
```
1111
<template>
1212
<!-- ✗ BAD -->

docs/rules/order-in-components.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
This rule makes sure you keep declared order of properties in components.
99
Recommended order of properties can be [found here](https://vuejs.org/v2/style-guide/#Component-instance-options-order-recommended).
1010

11-
<eslint-code-block :rules="{'vue/order-in-components': ['error']}">
11+
<eslint-code-block fix :rules="{'vue/order-in-components': ['error']}">
1212
```
1313
<script>
1414
/* ✓ GOOD */
@@ -27,7 +27,7 @@ export default {
2727
```
2828
</eslint-code-block>
2929

30-
<eslint-code-block :rules="{'vue/order-in-components': ['error']}">
30+
<eslint-code-block fix :rules="{'vue/order-in-components': ['error']}">
3131
```
3232
<script>
3333
/* ✗ BAD */

0 commit comments

Comments
 (0)
0