Skip to content

Commit

Permalink
Change the ruleset for categories (#1036)
Browse files Browse the repository at this point in the history
- 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.
  • Loading branch information
ota-meshi committed Mar 14, 2020
1 parent b86640a commit a72237d
Show file tree
Hide file tree
Showing 16 changed files with 29 additions and 27 deletions.
12 changes: 6 additions & 6 deletions docs/rules/README.md
Expand Up @@ -58,6 +58,7 @@ Enforce all the rules in this category, as well as all higher priority rules, wi
| [vue/return-in-computed-property](./return-in-computed-property.md) | enforce that a return statement is present in computed property | |
| [vue/use-v-on-exact](./use-v-on-exact.md) | enforce usage of `exact` modifier on `v-on` | |
| [vue/valid-template-root](./valid-template-root.md) | enforce valid template root | |
| [vue/valid-v-bind-sync](./valid-v-bind-sync.md) | enforce valid `.sync` modifier on `v-bind` directives | |
| [vue/valid-v-bind](./valid-v-bind.md) | enforce valid `v-bind` directives | |
| [vue/valid-v-cloak](./valid-v-cloak.md) | enforce valid `v-cloak` directives | |
| [vue/valid-v-else-if](./valid-v-else-if.md) | enforce valid `v-else-if` directives | |
Expand All @@ -70,6 +71,7 @@ Enforce all the rules in this category, as well as all higher priority rules, wi
| [vue/valid-v-once](./valid-v-once.md) | enforce valid `v-once` directives | |
| [vue/valid-v-pre](./valid-v-pre.md) | enforce valid `v-pre` directives | |
| [vue/valid-v-show](./valid-v-show.md) | enforce valid `v-show` directives | |
| [vue/valid-v-slot](./valid-v-slot.md) | enforce valid `v-slot` directives | |
| [vue/valid-v-text](./valid-v-text.md) | enforce valid `v-text` directives | |

## Priority B: Strongly Recommended (Improving Readability)
Expand All @@ -85,6 +87,7 @@ Enforce all the rules in this category, as well as all higher priority rules, wi
| Rule ID | Description | |
|:--------|:------------|:---|
| [vue/attribute-hyphenation](./attribute-hyphenation.md) | enforce attribute naming style on custom components in template | :wrench: |
| [vue/component-definition-name-casing](./component-definition-name-casing.md) | enforce specific casing for component definition name | :wrench: |
| [vue/html-closing-bracket-newline](./html-closing-bracket-newline.md) | require or disallow a line break before tag's closing brackets | :wrench: |
| [vue/html-closing-bracket-spacing](./html-closing-bracket-spacing.md) | require or disallow a space before tag's closing brackets | :wrench: |
| [vue/html-end-tags](./html-end-tags.md) | enforce end tag style | :wrench: |
Expand All @@ -94,7 +97,6 @@ Enforce all the rules in this category, as well as all higher priority rules, wi
| [vue/max-attributes-per-line](./max-attributes-per-line.md) | enforce the maximum number of attributes per line | :wrench: |
| [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: |
| [vue/mustache-interpolation-spacing](./mustache-interpolation-spacing.md) | enforce unified spacing in mustache interpolations | :wrench: |
| [vue/name-property-casing](./name-property-casing.md) | enforce specific casing for the name property in Vue components | :wrench: |
| [vue/no-multi-spaces](./no-multi-spaces.md) | disallow multiple spaces | :wrench: |
| [vue/no-spaces-around-equal-signs-in-attribute](./no-spaces-around-equal-signs-in-attribute.md) | disallow spaces around equal signs in attribute | :wrench: |
| [vue/no-template-shadow](./no-template-shadow.md) | disallow variable declarations from shadowing variables declared in the outer scope | |
Expand All @@ -104,6 +106,7 @@ Enforce all the rules in this category, as well as all higher priority rules, wi
| [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: |
| [vue/v-bind-style](./v-bind-style.md) | enforce `v-bind` directive style | :wrench: |
| [vue/v-on-style](./v-on-style.md) | enforce `v-on` directive style | :wrench: |
| [vue/v-slot-style](./v-slot-style.md) | enforce `v-slot` directive style | :wrench: |

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

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

## Deprecated

Expand All @@ -185,4 +184,5 @@ For example:

| Rule ID | Replaced by |
|:--------|:------------|
| [vue/name-property-casing](./name-property-casing.md) | [vue/component-definition-name-casing](./component-definition-name-casing.md) |
| [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) |
1 change: 1 addition & 0 deletions docs/rules/component-definition-name-casing.md
Expand Up @@ -7,6 +7,7 @@ description: enforce specific casing for component definition name
# vue/component-definition-name-casing
> enforce specific casing for component definition name
- :gear: This rule is included in `"plugin:vue/strongly-recommended"` and `"plugin:vue/recommended"`.
- :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.

Define a style for component definition name casing for consistency purposes.
Expand Down
2 changes: 2 additions & 0 deletions docs/rules/component-tags-order.md
Expand Up @@ -7,6 +7,8 @@ description: enforce order of component top-level elements
# vue/component-tags-order
> enforce order of component top-level elements
- :gear: This rule is included in `"plugin:vue/recommended"`.

## :book: Rule Details

This rule warns about the order of the `<script>`, `<template>` & `<style>` tags.
Expand Down
2 changes: 1 addition & 1 deletion docs/rules/name-property-casing.md
Expand Up @@ -7,7 +7,7 @@ description: enforce specific casing for the name property in Vue components
# vue/name-property-casing
> enforce specific casing for the name property in Vue components
- :gear: This rule is included in `"plugin:vue/strongly-recommended"` and `"plugin:vue/recommended"`.
- :warning: This rule was **deprecated** and replaced by [vue/component-definition-name-casing](component-definition-name-casing.md) rule.
- :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.

## :book: Rule Details
Expand Down
1 change: 1 addition & 0 deletions docs/rules/v-slot-style.md
Expand Up @@ -7,6 +7,7 @@ description: enforce `v-slot` directive style
# vue/v-slot-style
> enforce `v-slot` directive style
- :gear: This rule is included in `"plugin:vue/strongly-recommended"` and `"plugin:vue/recommended"`.
- :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.

## :book: Rule Details
Expand Down
2 changes: 2 additions & 0 deletions docs/rules/valid-v-bind-sync.md
Expand Up @@ -7,6 +7,8 @@ description: enforce valid `.sync` modifier on `v-bind` directives
# vue/valid-v-bind-sync
> enforce valid `.sync` modifier on `v-bind` directives
- :gear: This rule is included in all of `"plugin:vue/essential"`, `"plugin:vue/strongly-recommended"` and `"plugin:vue/recommended"`.

This rule checks whether every `.sync` modifier on `v-bind` directives is valid.

## :book: Rule Details
Expand Down
2 changes: 2 additions & 0 deletions docs/rules/valid-v-slot.md
Expand Up @@ -7,6 +7,8 @@ description: enforce valid `v-slot` directives
# vue/valid-v-slot
> enforce valid `v-slot` directives
- :gear: This rule is included in all of `"plugin:vue/essential"`, `"plugin:vue/strongly-recommended"` and `"plugin:vue/recommended"`.

This rule checks whether every `v-slot` directive is valid.

## :book: Rule Details
Expand Down
2 changes: 2 additions & 0 deletions lib/configs/essential.js
Expand Up @@ -26,6 +26,7 @@ module.exports = {
'vue/return-in-computed-property': 'error',
'vue/use-v-on-exact': 'error',
'vue/valid-template-root': 'error',
'vue/valid-v-bind-sync': 'error',
'vue/valid-v-bind': 'error',
'vue/valid-v-cloak': 'error',
'vue/valid-v-else-if': 'error',
Expand All @@ -38,6 +39,7 @@ module.exports = {
'vue/valid-v-once': 'error',
'vue/valid-v-pre': 'error',
'vue/valid-v-show': 'error',
'vue/valid-v-slot': 'error',
'vue/valid-v-text': 'error'
}
}
1 change: 1 addition & 0 deletions lib/configs/recommended.js
Expand Up @@ -7,6 +7,7 @@ module.exports = {
extends: require.resolve('./strongly-recommended'),
rules: {
'vue/attributes-order': 'warn',
'vue/component-tags-order': 'warn',
'vue/no-v-html': 'warn',
'vue/order-in-components': 'warn',
'vue/this-in-template': 'warn'
Expand Down
5 changes: 3 additions & 2 deletions lib/configs/strongly-recommended.js
Expand Up @@ -7,6 +7,7 @@ module.exports = {
extends: require.resolve('./essential'),
rules: {
'vue/attribute-hyphenation': 'warn',
'vue/component-definition-name-casing': 'warn',
'vue/html-closing-bracket-newline': 'warn',
'vue/html-closing-bracket-spacing': 'warn',
'vue/html-end-tags': 'warn',
Expand All @@ -16,7 +17,6 @@ module.exports = {
'vue/max-attributes-per-line': 'warn',
'vue/multiline-html-element-content-newline': 'warn',
'vue/mustache-interpolation-spacing': 'warn',
'vue/name-property-casing': 'warn',
'vue/no-multi-spaces': 'warn',
'vue/no-spaces-around-equal-signs-in-attribute': 'warn',
'vue/no-template-shadow': 'warn',
Expand All @@ -25,6 +25,7 @@ module.exports = {
'vue/require-prop-types': 'warn',
'vue/singleline-html-element-content-newline': 'warn',
'vue/v-bind-style': 'warn',
'vue/v-on-style': 'warn'
'vue/v-on-style': 'warn',
'vue/v-slot-style': 'warn'
}
}
4 changes: 1 addition & 3 deletions lib/rules/component-definition-name-casing.js
Expand Up @@ -17,9 +17,7 @@ module.exports = {
type: 'suggestion',
docs: {
description: 'enforce specific casing for component definition name',
category: undefined,
// TODO Change with major version.
// category: 'strongly-recommended',
category: 'strongly-recommended',
url: 'https://eslint.vuejs.org/rules/component-definition-name-casing.html'
},
fixable: 'code', // or "code" or "whitespace"
Expand Down
4 changes: 1 addition & 3 deletions lib/rules/component-tags-order.js
Expand Up @@ -21,9 +21,7 @@ module.exports = {
type: 'suggestion',
docs: {
description: 'enforce order of component top-level elements',
category: undefined,
// TODO Change with major version.
// category: 'recommended',
category: 'recommended',
url: 'https://eslint.vuejs.org/rules/component-tags-order.html'
},
fixable: null,
Expand Down
6 changes: 3 additions & 3 deletions lib/rules/name-property-casing.js
Expand Up @@ -18,10 +18,10 @@ module.exports = {
docs: {
description: 'enforce specific casing for the name property in Vue components',
category: 'strongly-recommended',
url: 'https://eslint.vuejs.org/rules/name-property-casing.html'
url: 'https://eslint.vuejs.org/rules/name-property-casing.html',
replacedBy: ['component-definition-name-casing']
},
// deprecated: true, // TODO Change with major version.
// replacedBy: ['component-definition-name-casing'], // TODO Change with major version.
deprecated: true,
fixable: 'code', // or "code" or "whitespace"
schema: [
{
Expand Down
4 changes: 1 addition & 3 deletions lib/rules/v-slot-style.js
Expand Up @@ -77,9 +77,7 @@ module.exports = {
type: 'suggestion',
docs: {
description: 'enforce `v-slot` directive style',
category: undefined, // strongly-recommended
// TODO Change with major version.
// category: 'strongly-recommended',
category: 'strongly-recommended',
url: 'https://eslint.vuejs.org/rules/v-slot-style.html'
},
fixable: 'code',
Expand Down
4 changes: 1 addition & 3 deletions lib/rules/valid-v-bind-sync.js
Expand Up @@ -52,9 +52,7 @@ module.exports = {
type: 'problem',
docs: {
description: 'enforce valid `.sync` modifier on `v-bind` directives',
category: undefined,
// TODO Change with major version.
// category: 'essential',
category: 'essential',
url: 'https://eslint.vuejs.org/rules/valid-v-bind-sync.html'
},
fixable: null,
Expand Down
4 changes: 1 addition & 3 deletions lib/rules/valid-v-slot.js
Expand Up @@ -142,9 +142,7 @@ module.exports = {
type: 'problem',
docs: {
description: 'enforce valid `v-slot` directives',
category: undefined, // essential
// TODO Change with major version.
// category: 'essential',
category: 'essential',
url: 'https://eslint.vuejs.org/rules/valid-v-slot.html'
},
fixable: null,
Expand Down

0 comments on commit a72237d

Please sign in to comment.