Skip to content

Commit a72237d

Browse files
authored
Change the ruleset for categories (#1036)
- Change `plugin:vue/essential` config - Add `vue/valid-v-bind-sync` rule - Add `vue/valid-v-slot` rule - Change `plugin:vue/strongly-recommended` config - Add `vue/component-definition-name-casing` rule - Add `vue/v-slot-style` rule - Remove `vue/name-property-casing` rule - Change `plugin:vue/recommended` config - Add `vue/component-tags-order` rule - To deprecate `vue/name-property-casing` rule.
1 parent b86640a commit a72237d

16 files changed

+29
-27
lines changed

Diff for: docs/rules/README.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ Enforce all the rules in this category, as well as all higher priority rules, wi
5858
| [vue/return-in-computed-property](./return-in-computed-property.md) | enforce that a return statement is present in computed property | |
5959
| [vue/use-v-on-exact](./use-v-on-exact.md) | enforce usage of `exact` modifier on `v-on` | |
6060
| [vue/valid-template-root](./valid-template-root.md) | enforce valid template root | |
61+
| [vue/valid-v-bind-sync](./valid-v-bind-sync.md) | enforce valid `.sync` modifier on `v-bind` directives | |
6162
| [vue/valid-v-bind](./valid-v-bind.md) | enforce valid `v-bind` directives | |
6263
| [vue/valid-v-cloak](./valid-v-cloak.md) | enforce valid `v-cloak` directives | |
6364
| [vue/valid-v-else-if](./valid-v-else-if.md) | enforce valid `v-else-if` directives | |
@@ -70,6 +71,7 @@ Enforce all the rules in this category, as well as all higher priority rules, wi
7071
| [vue/valid-v-once](./valid-v-once.md) | enforce valid `v-once` directives | |
7172
| [vue/valid-v-pre](./valid-v-pre.md) | enforce valid `v-pre` directives | |
7273
| [vue/valid-v-show](./valid-v-show.md) | enforce valid `v-show` directives | |
74+
| [vue/valid-v-slot](./valid-v-slot.md) | enforce valid `v-slot` directives | |
7375
| [vue/valid-v-text](./valid-v-text.md) | enforce valid `v-text` directives | |
7476

7577
## Priority B: Strongly Recommended (Improving Readability)
@@ -85,6 +87,7 @@ Enforce all the rules in this category, as well as all higher priority rules, wi
8587
| Rule ID | Description | |
8688
|:--------|:------------|:---|
8789
| [vue/attribute-hyphenation](./attribute-hyphenation.md) | enforce attribute naming style on custom components in template | :wrench: |
90+
| [vue/component-definition-name-casing](./component-definition-name-casing.md) | enforce specific casing for component definition name | :wrench: |
8891
| [vue/html-closing-bracket-newline](./html-closing-bracket-newline.md) | require or disallow a line break before tag's closing brackets | :wrench: |
8992
| [vue/html-closing-bracket-spacing](./html-closing-bracket-spacing.md) | require or disallow a space before tag's closing brackets | :wrench: |
9093
| [vue/html-end-tags](./html-end-tags.md) | enforce end tag style | :wrench: |
@@ -94,7 +97,6 @@ Enforce all the rules in this category, as well as all higher priority rules, wi
9497
| [vue/max-attributes-per-line](./max-attributes-per-line.md) | enforce the maximum number of attributes per line | :wrench: |
9598
| [vue/multiline-html-element-content-newline](./multiline-html-element-content-newline.md) | require a line break before and after the contents of a multiline element | :wrench: |
9699
| [vue/mustache-interpolation-spacing](./mustache-interpolation-spacing.md) | enforce unified spacing in mustache interpolations | :wrench: |
97-
| [vue/name-property-casing](./name-property-casing.md) | enforce specific casing for the name property in Vue components | :wrench: |
98100
| [vue/no-multi-spaces](./no-multi-spaces.md) | disallow multiple spaces | :wrench: |
99101
| [vue/no-spaces-around-equal-signs-in-attribute](./no-spaces-around-equal-signs-in-attribute.md) | disallow spaces around equal signs in attribute | :wrench: |
100102
| [vue/no-template-shadow](./no-template-shadow.md) | disallow variable declarations from shadowing variables declared in the outer scope | |
@@ -104,6 +106,7 @@ Enforce all the rules in this category, as well as all higher priority rules, wi
104106
| [vue/singleline-html-element-content-newline](./singleline-html-element-content-newline.md) | require a line break before and after the contents of a singleline element | :wrench: |
105107
| [vue/v-bind-style](./v-bind-style.md) | enforce `v-bind` directive style | :wrench: |
106108
| [vue/v-on-style](./v-on-style.md) | enforce `v-on` directive style | :wrench: |
109+
| [vue/v-slot-style](./v-slot-style.md) | enforce `v-slot` directive style | :wrench: |
107110

108111
## Priority C: Recommended (Minimizing Arbitrary Choices and Cognitive Overhead)
109112

@@ -118,6 +121,7 @@ Enforce all the rules in this category, as well as all higher priority rules, wi
118121
| Rule ID | Description | |
119122
|:--------|:------------|:---|
120123
| [vue/attributes-order](./attributes-order.md) | enforce order of attributes | :wrench: |
124+
| [vue/component-tags-order](./component-tags-order.md) | enforce order of component top-level elements | |
121125
| [vue/no-v-html](./no-v-html.md) | disallow use of v-html to prevent XSS attack | |
122126
| [vue/order-in-components](./order-in-components.md) | enforce order of properties in components | :wrench: |
123127
| [vue/this-in-template](./this-in-template.md) | disallow usage of `this` in template | |
@@ -145,9 +149,7 @@ For example:
145149
| [vue/brace-style](./brace-style.md) | enforce consistent brace style for blocks | :wrench: |
146150
| [vue/camelcase](./camelcase.md) | enforce camelcase naming convention | |
147151
| [vue/comma-dangle](./comma-dangle.md) | require or disallow trailing commas | :wrench: |
148-
| [vue/component-definition-name-casing](./component-definition-name-casing.md) | enforce specific casing for component definition name | :wrench: |
149152
| [vue/component-name-in-template-casing](./component-name-in-template-casing.md) | enforce specific casing for the component naming style in template | :wrench: |
150-
| [vue/component-tags-order](./component-tags-order.md) | enforce order of component top-level elements | |
151153
| [vue/dot-location](./dot-location.md) | enforce consistent newlines before and after dots | :wrench: |
152154
| [vue/eqeqeq](./eqeqeq.md) | require the use of `===` and `!==` | :wrench: |
153155
| [vue/key-spacing](./key-spacing.md) | enforce consistent spacing between keys and values in object literal properties | :wrench: |
@@ -174,9 +176,6 @@ For example:
174176
| [vue/space-unary-ops](./space-unary-ops.md) | enforce consistent spacing before or after unary operators | :wrench: |
175177
| [vue/static-class-names-order](./static-class-names-order.md) | enforce static class names order | :wrench: |
176178
| [vue/v-on-function-call](./v-on-function-call.md) | enforce or forbid parentheses after method calls without arguments in `v-on` directives | :wrench: |
177-
| [vue/v-slot-style](./v-slot-style.md) | enforce `v-slot` directive style | :wrench: |
178-
| [vue/valid-v-bind-sync](./valid-v-bind-sync.md) | enforce valid `.sync` modifier on `v-bind` directives | |
179-
| [vue/valid-v-slot](./valid-v-slot.md) | enforce valid `v-slot` directives | |
180179

181180
## Deprecated
182181

@@ -185,4 +184,5 @@ For example:
185184

186185
| Rule ID | Replaced by |
187186
|:--------|:------------|
187+
| [vue/name-property-casing](./name-property-casing.md) | [vue/component-definition-name-casing](./component-definition-name-casing.md) |
188188
| [vue/no-confusing-v-for-v-if](./no-confusing-v-for-v-if.md) | [vue/no-use-v-if-with-v-for](./no-use-v-if-with-v-for.md) |

Diff for: docs/rules/component-definition-name-casing.md

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ description: enforce specific casing for component definition name
77
# vue/component-definition-name-casing
88
> enforce specific casing for component definition name
99
10+
- :gear: This rule is included in `"plugin:vue/strongly-recommended"` and `"plugin:vue/recommended"`.
1011
- :wrench: The `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#fixing-problems) can automatically fix some of the problems reported by this rule.
1112

1213
Define a style for component definition name casing for consistency purposes.

Diff for: docs/rules/component-tags-order.md

+2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ description: enforce order of component top-level elements
77
# vue/component-tags-order
88
> enforce order of component top-level elements
99
10+
- :gear: This rule is included in `"plugin:vue/recommended"`.
11+
1012
## :book: Rule Details
1113

1214
This rule warns about the order of the `<script>`, `<template>` & `<style>` tags.

Diff for: docs/rules/name-property-casing.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ description: enforce specific casing for the name property in Vue components
77
# vue/name-property-casing
88
> enforce specific casing for the name property in Vue components
99
10-
- :gear: This rule is included in `"plugin:vue/strongly-recommended"` and `"plugin:vue/recommended"`.
10+
- :warning: This rule was **deprecated** and replaced by [vue/component-definition-name-casing](component-definition-name-casing.md) rule.
1111
- :wrench: The `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#fixing-problems) can automatically fix some of the problems reported by this rule.
1212

1313
## :book: Rule Details

Diff for: docs/rules/v-slot-style.md

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ description: enforce `v-slot` directive style
77
# vue/v-slot-style
88
> enforce `v-slot` directive style
99
10+
- :gear: This rule is included in `"plugin:vue/strongly-recommended"` and `"plugin:vue/recommended"`.
1011
- :wrench: The `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#fixing-problems) can automatically fix some of the problems reported by this rule.
1112

1213
## :book: Rule Details

Diff for: docs/rules/valid-v-bind-sync.md

+2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ description: enforce valid `.sync` modifier on `v-bind` directives
77
# vue/valid-v-bind-sync
88
> enforce valid `.sync` modifier on `v-bind` directives
99
10+
- :gear: This rule is included in all of `"plugin:vue/essential"`, `"plugin:vue/strongly-recommended"` and `"plugin:vue/recommended"`.
11+
1012
This rule checks whether every `.sync` modifier on `v-bind` directives is valid.
1113

1214
## :book: Rule Details

Diff for: docs/rules/valid-v-slot.md

+2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ description: enforce valid `v-slot` directives
77
# vue/valid-v-slot
88
> enforce valid `v-slot` directives
99
10+
- :gear: This rule is included in all of `"plugin:vue/essential"`, `"plugin:vue/strongly-recommended"` and `"plugin:vue/recommended"`.
11+
1012
This rule checks whether every `v-slot` directive is valid.
1113

1214
## :book: Rule Details

Diff for: lib/configs/essential.js

+2
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ module.exports = {
2626
'vue/return-in-computed-property': 'error',
2727
'vue/use-v-on-exact': 'error',
2828
'vue/valid-template-root': 'error',
29+
'vue/valid-v-bind-sync': 'error',
2930
'vue/valid-v-bind': 'error',
3031
'vue/valid-v-cloak': 'error',
3132
'vue/valid-v-else-if': 'error',
@@ -38,6 +39,7 @@ module.exports = {
3839
'vue/valid-v-once': 'error',
3940
'vue/valid-v-pre': 'error',
4041
'vue/valid-v-show': 'error',
42+
'vue/valid-v-slot': 'error',
4143
'vue/valid-v-text': 'error'
4244
}
4345
}

Diff for: lib/configs/recommended.js

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ module.exports = {
77
extends: require.resolve('./strongly-recommended'),
88
rules: {
99
'vue/attributes-order': 'warn',
10+
'vue/component-tags-order': 'warn',
1011
'vue/no-v-html': 'warn',
1112
'vue/order-in-components': 'warn',
1213
'vue/this-in-template': 'warn'

Diff for: lib/configs/strongly-recommended.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ module.exports = {
77
extends: require.resolve('./essential'),
88
rules: {
99
'vue/attribute-hyphenation': 'warn',
10+
'vue/component-definition-name-casing': 'warn',
1011
'vue/html-closing-bracket-newline': 'warn',
1112
'vue/html-closing-bracket-spacing': 'warn',
1213
'vue/html-end-tags': 'warn',
@@ -16,7 +17,6 @@ module.exports = {
1617
'vue/max-attributes-per-line': 'warn',
1718
'vue/multiline-html-element-content-newline': 'warn',
1819
'vue/mustache-interpolation-spacing': 'warn',
19-
'vue/name-property-casing': 'warn',
2020
'vue/no-multi-spaces': 'warn',
2121
'vue/no-spaces-around-equal-signs-in-attribute': 'warn',
2222
'vue/no-template-shadow': 'warn',
@@ -25,6 +25,7 @@ module.exports = {
2525
'vue/require-prop-types': 'warn',
2626
'vue/singleline-html-element-content-newline': 'warn',
2727
'vue/v-bind-style': 'warn',
28-
'vue/v-on-style': 'warn'
28+
'vue/v-on-style': 'warn',
29+
'vue/v-slot-style': 'warn'
2930
}
3031
}

Diff for: lib/rules/component-definition-name-casing.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,7 @@ module.exports = {
1717
type: 'suggestion',
1818
docs: {
1919
description: 'enforce specific casing for component definition name',
20-
category: undefined,
21-
// TODO Change with major version.
22-
// category: 'strongly-recommended',
20+
category: 'strongly-recommended',
2321
url: 'https://eslint.vuejs.org/rules/component-definition-name-casing.html'
2422
},
2523
fixable: 'code', // or "code" or "whitespace"

Diff for: lib/rules/component-tags-order.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,7 @@ module.exports = {
2121
type: 'suggestion',
2222
docs: {
2323
description: 'enforce order of component top-level elements',
24-
category: undefined,
25-
// TODO Change with major version.
26-
// category: 'recommended',
24+
category: 'recommended',
2725
url: 'https://eslint.vuejs.org/rules/component-tags-order.html'
2826
},
2927
fixable: null,

Diff for: lib/rules/name-property-casing.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ module.exports = {
1818
docs: {
1919
description: 'enforce specific casing for the name property in Vue components',
2020
category: 'strongly-recommended',
21-
url: 'https://eslint.vuejs.org/rules/name-property-casing.html'
21+
url: 'https://eslint.vuejs.org/rules/name-property-casing.html',
22+
replacedBy: ['component-definition-name-casing']
2223
},
23-
// deprecated: true, // TODO Change with major version.
24-
// replacedBy: ['component-definition-name-casing'], // TODO Change with major version.
24+
deprecated: true,
2525
fixable: 'code', // or "code" or "whitespace"
2626
schema: [
2727
{

Diff for: lib/rules/v-slot-style.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,7 @@ module.exports = {
7777
type: 'suggestion',
7878
docs: {
7979
description: 'enforce `v-slot` directive style',
80-
category: undefined, // strongly-recommended
81-
// TODO Change with major version.
82-
// category: 'strongly-recommended',
80+
category: 'strongly-recommended',
8381
url: 'https://eslint.vuejs.org/rules/v-slot-style.html'
8482
},
8583
fixable: 'code',

Diff for: lib/rules/valid-v-bind-sync.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,7 @@ module.exports = {
5252
type: 'problem',
5353
docs: {
5454
description: 'enforce valid `.sync` modifier on `v-bind` directives',
55-
category: undefined,
56-
// TODO Change with major version.
57-
// category: 'essential',
55+
category: 'essential',
5856
url: 'https://eslint.vuejs.org/rules/valid-v-bind-sync.html'
5957
},
6058
fixable: null,

Diff for: lib/rules/valid-v-slot.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -142,9 +142,7 @@ module.exports = {
142142
type: 'problem',
143143
docs: {
144144
description: 'enforce valid `v-slot` directives',
145-
category: undefined, // essential
146-
// TODO Change with major version.
147-
// category: 'essential',
145+
category: 'essential',
148146
url: 'https://eslint.vuejs.org/rules/valid-v-slot.html'
149147
},
150148
fixable: null,

0 commit comments

Comments
 (0)