Skip to content

Commit f52e52e

Browse files
committed
Docs: update docs about deprecated rules
1 parent 0e2008a commit f52e52e

File tree

2 files changed

+79
-38
lines changed

2 files changed

+79
-38
lines changed

README.md

Lines changed: 55 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ module.exports = {
3939
],
4040
rules: {
4141
// override/add rules' settings here
42-
'vue/no-invalid-v-if': 'error'
42+
'vue/valid-v-if': 'error'
4343
}
4444
}
4545
```
@@ -58,27 +58,41 @@ No rules are enabled by `plugin:vue/base` config. The `plugin:vue/recommended` c
5858

5959
The `--fix` option on the command line automatically fixes problems reported by rules which have a wrench :wrench: below.
6060

61-
Deprecated rules witch should be used with caution and only enabled when you know what you are doing have a warning :warning: icon.
62-
6361
<!--RULES_TABLE_START-->
6462

65-
### Stylistic Issues
63+
### Possible Errors
6664

6765
| | Rule ID | Description |
6866
|:---|:--------|:------------|
69-
| :wrench: | [attribute-hyphenation](./docs/rules/attribute-hyphenation.md) | Define a style for the props casing in templates. |
70-
| | [html-quotes](./docs/rules/html-quotes.md) | enforce quotes style of HTML attributes. |
71-
| :wrench: | [name-property-casing](./docs/rules/name-property-casing.md) | Requires specific casing for the name property in Vue components |
72-
| :wrench: | [v-bind-style](./docs/rules/v-bind-style.md) | enforce `v-bind` directive style. |
73-
| :wrench: | [v-on-style](./docs/rules/v-on-style.md) | enforce `v-on` directive style. |
67+
| | [no-dupe-keys](./docs/rules/no-dupe-keys.md) | Prevents duplication of field names. |
68+
| :white_check_mark: | [no-parsing-error](./docs/rules/no-parsing-error.md) | disallow parsing errors in `<template>`. |
69+
| | [no-reservered-keys](./docs/rules/no-reservered-keys.md) | Prevent overwrite reserved keys. |
70+
| | [no-shared-component-data](./docs/rules/no-shared-component-data.md) | Enforces component's data property to be a function. |
71+
| | [no-template-key](./docs/rules/no-template-key.md) | disallow `key` attribute on `<template>`. |
72+
| | [require-render-return](./docs/rules/require-render-return.md) | Enforces render function to always return value. |
73+
| | [require-valid-default-prop](./docs/rules/require-valid-default-prop.md) | Enforces props default values to be valid. |
74+
| | [return-in-computed-property](./docs/rules/return-in-computed-property.md) | Enforces that a return statement is present in computed property. |
75+
| :white_check_mark: | [valid-template-root](./docs/rules/valid-template-root.md) | enforce valid template root. |
76+
| :white_check_mark: | [valid-v-bind](./docs/rules/valid-v-bind.md) | enforce valid `v-bind` directives. |
77+
| :white_check_mark: | [valid-v-cloak](./docs/rules/valid-v-cloak.md) | enforce valid `v-cloak` directives. |
78+
| :white_check_mark: | [valid-v-else-if](./docs/rules/valid-v-else-if.md) | enforce valid `v-else-if` directives. |
79+
| :white_check_mark: | [valid-v-else](./docs/rules/valid-v-else.md) | enforce valid `v-else` directives. |
80+
| :white_check_mark: | [valid-v-for](./docs/rules/valid-v-for.md) | enforce valid `v-for` directives. |
81+
| :white_check_mark: | [valid-v-html](./docs/rules/valid-v-html.md) | enforce valid `v-html` directives. |
82+
| :white_check_mark: | [valid-v-if](./docs/rules/valid-v-if.md) | enforce valid `v-if` directives. |
83+
| :white_check_mark: | [valid-v-model](./docs/rules/valid-v-model.md) | enforce valid `v-model` directives. |
84+
| :white_check_mark: | [valid-v-on](./docs/rules/valid-v-on.md) | enforce valid `v-on` directives. |
85+
| :white_check_mark: | [valid-v-once](./docs/rules/valid-v-once.md) | enforce valid `v-once` directives. |
86+
| :white_check_mark: | [valid-v-pre](./docs/rules/valid-v-pre.md) | enforce valid `v-pre` directives. |
87+
| :white_check_mark: | [valid-v-show](./docs/rules/valid-v-show.md) | enforce valid `v-show` directives. |
88+
| :white_check_mark: | [valid-v-text](./docs/rules/valid-v-text.md) | enforce valid `v-text` directives. |
7489

7590

7691
### Best Practices
7792

7893
| | Rule ID | Description |
7994
|:---|:--------|:------------|
8095
| :wrench: | [html-end-tags](./docs/rules/html-end-tags.md) | enforce end tag style. |
81-
| :wrench::warning: | [html-no-self-closing](./docs/rules/html-no-self-closing.md) | disallow self-closing elements. - (deprecated) |
8296
| | [no-async-in-computed-properties](./docs/rules/no-async-in-computed-properties.md) | Check if there are no asynchronous actions inside computed properties. |
8397
| :white_check_mark: | [no-confusing-v-for-v-if](./docs/rules/no-confusing-v-for-v-if.md) | disallow confusing `v-for` and `v-if` on the same element. |
8498
| | [no-duplicate-attributes](./docs/rules/no-duplicate-attributes.md) | disallow duplicate attributes. |
@@ -90,38 +104,45 @@ Deprecated rules witch should be used with caution and only enabled when you kno
90104
| :white_check_mark: | [require-v-for-key](./docs/rules/require-v-for-key.md) | require `v-bind:key` with `v-for` directives. |
91105

92106

93-
### Variables
107+
### Stylistic Issues
94108

95109
| | Rule ID | Description |
96110
|:---|:--------|:------------|
97-
| :white_check_mark: | [jsx-uses-vars](./docs/rules/jsx-uses-vars.md) | Prevent variables used in JSX to be marked as unused |
111+
| :wrench: | [attribute-hyphenation](./docs/rules/attribute-hyphenation.md) | Define a style for the props casing in templates. |
112+
| | [html-quotes](./docs/rules/html-quotes.md) | enforce quotes style of HTML attributes. |
113+
| :wrench: | [name-property-casing](./docs/rules/name-property-casing.md) | Requires specific casing for the name property in Vue components |
114+
| :wrench: | [v-bind-style](./docs/rules/v-bind-style.md) | enforce `v-bind` directive style. |
115+
| :wrench: | [v-on-style](./docs/rules/v-on-style.md) | enforce `v-on` directive style. |
98116

99117

100-
### Possible Errors
118+
### Variables
101119

102120
| | Rule ID | Description |
103121
|:---|:--------|:------------|
104-
| | [no-dupe-keys](./docs/rules/no-dupe-keys.md) | Prevents duplication of field names. |
105-
| :white_check_mark: | [no-invalid-template-root](./docs/rules/no-invalid-template-root.md) | disallow invalid template root. |
106-
| :white_check_mark: | [no-invalid-v-bind](./docs/rules/no-invalid-v-bind.md) | disallow invalid `v-bind` directives. |
107-
| :white_check_mark: | [no-invalid-v-cloak](./docs/rules/no-invalid-v-cloak.md) | disallow invalid `v-cloak` directives. |
108-
| :white_check_mark: | [no-invalid-v-else-if](./docs/rules/no-invalid-v-else-if.md) | disallow invalid `v-else-if` directives. |
109-
| :white_check_mark: | [no-invalid-v-else](./docs/rules/no-invalid-v-else.md) | disallow invalid `v-else` directives. |
110-
| :white_check_mark: | [no-invalid-v-for](./docs/rules/no-invalid-v-for.md) | disallow invalid `v-for` directives. |
111-
| :white_check_mark: | [no-invalid-v-html](./docs/rules/no-invalid-v-html.md) | disallow invalid `v-html` directives. |
112-
| :white_check_mark: | [no-invalid-v-if](./docs/rules/no-invalid-v-if.md) | disallow invalid `v-if` directives. |
113-
| :white_check_mark: | [no-invalid-v-model](./docs/rules/no-invalid-v-model.md) | disallow invalid `v-model` directives. |
114-
| :white_check_mark: | [no-invalid-v-on](./docs/rules/no-invalid-v-on.md) | disallow invalid `v-on` directives. |
115-
| :white_check_mark: | [no-invalid-v-once](./docs/rules/no-invalid-v-once.md) | disallow invalid `v-once` directives. |
116-
| :white_check_mark: | [no-invalid-v-pre](./docs/rules/no-invalid-v-pre.md) | disallow invalid `v-pre` directives. |
117-
| :white_check_mark: | [no-invalid-v-show](./docs/rules/no-invalid-v-show.md) | disallow invalid `v-show` directives. |
118-
| :white_check_mark: | [no-invalid-v-text](./docs/rules/no-invalid-v-text.md) | disallow invalid `v-text` directives. |
119-
| :white_check_mark: | [no-parsing-error](./docs/rules/no-parsing-error.md) | disallow parsing errors in `<template>`. |
120-
| | [no-reservered-keys](./docs/rules/no-reservered-keys.md) | Prevent overwrite reserved keys. |
121-
| | [no-shared-component-data](./docs/rules/no-shared-component-data.md) | Enforces component's data property to be a function. |
122-
| | [no-template-key](./docs/rules/no-template-key.md) | disallow `key` attribute on `<template>`. |
123-
| | [require-render-return](./docs/rules/require-render-return.md) | Enforces render function to always return value. |
124-
| | [return-in-computed-property](./docs/rules/return-in-computed-property.md) | Enforces that a return statement is present in computed property. |
122+
| :white_check_mark: | [jsx-uses-vars](./docs/rules/jsx-uses-vars.md) | Prevent variables used in JSX to be marked as unused |
123+
124+
### Deprecated
125+
126+
> - :warning: We are going to remove deprecated rules in future. Please migrate to its replaced rules.
127+
> - :innocent: We don't fix bugs which are in deprecated rules since we don't have enough resource.
128+
129+
| Rule ID | Replaced by |
130+
|:--------|:------------|
131+
| [html-no-self-closing](./rules/html-no-self-closing.md) | (no replacement) |
132+
| [no-invalid-template-root](./rules/no-invalid-template-root.md) | [valid-template-root](./rules/valid-template-root.md) |
133+
| [no-invalid-v-bind](./rules/no-invalid-v-bind.md) | [valid-v-bind](./rules/valid-v-bind.md) |
134+
| [no-invalid-v-cloak](./rules/no-invalid-v-cloak.md) | [valid-v-cloak](./rules/valid-v-cloak.md) |
135+
| [no-invalid-v-else-if](./rules/no-invalid-v-else-if.md) | [valid-v-else-if](./rules/valid-v-else-if.md) |
136+
| [no-invalid-v-else](./rules/no-invalid-v-else.md) | [valid-v-else](./rules/valid-v-else.md) |
137+
| [no-invalid-v-for](./rules/no-invalid-v-for.md) | [valid-v-for](./rules/valid-v-for.md) |
138+
| [no-invalid-v-html](./rules/no-invalid-v-html.md) | [valid-v-html](./rules/valid-v-html.md) |
139+
| [no-invalid-v-if](./rules/no-invalid-v-if.md) | [valid-v-if](./rules/valid-v-if.md) |
140+
| [no-invalid-v-model](./rules/no-invalid-v-model.md) | [valid-v-model](./rules/valid-v-model.md) |
141+
| [no-invalid-v-on](./rules/no-invalid-v-on.md) | [valid-v-on](./rules/valid-v-on.md) |
142+
| [no-invalid-v-once](./rules/no-invalid-v-once.md) | [valid-v-once](./rules/valid-v-once.md) |
143+
| [no-invalid-v-pre](./rules/no-invalid-v-pre.md) | [valid-v-pre](./rules/valid-v-pre.md) |
144+
| [no-invalid-v-show](./rules/no-invalid-v-show.md) | [valid-v-show](./rules/valid-v-show.md) |
145+
| [no-invalid-v-text](./rules/no-invalid-v-text.md) | [valid-v-text](./rules/valid-v-text.md) |
125146

126147
<!--RULES_TABLE_END-->
127148

tools/update-rules.js

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ const categories = rules
4141
arr.push(category)
4242
}
4343
return arr
44-
}, [])
44+
}, ['Possible Errors', 'Best Practices', 'Stylistic Issues'])
4545

4646
const rulesTableContent = categories.map(category => `
4747
### ${category}
@@ -50,18 +50,38 @@ const rulesTableContent = categories.map(category => `
5050
|:---|:--------|:------------|
5151
${
5252
rules
53-
.filter(entry => entry[1].meta.docs.category === category)
53+
.filter(entry => entry[1].meta.docs.category === category && !entry[1].meta.deprecated)
5454
.map(entry => {
5555
const name = entry[0]
5656
const meta = entry[1].meta
5757
const mark = `${meta.docs.recommended ? STAR : ''}${meta.fixable ? PEN : ''}${meta.deprecated ? WARN : ''}`
5858
const link = `[${name}](./docs/rules/${name}.md)`
59-
const description = (meta.docs.description || '(no description)') + (meta.deprecated ? ' - (deprecated)' : '')
59+
const description = meta.docs.description || '(no description)'
6060
return `| ${mark} | ${link} | ${description} |`
6161
})
6262
.join('\n')
6363
}
64-
`).join('\n')
64+
`).join('\n') + `
65+
### Deprecated
66+
67+
> - :warning: We are going to remove deprecated rules in future. Please migrate to its replaced rules.
68+
> - :innocent: We don't fix bugs which are in deprecated rules since we don't have enough resource.
69+
70+
| Rule ID | Replaced by |
71+
|:--------|:------------|
72+
${
73+
rules
74+
.filter(entry => entry[1].meta.deprecated)
75+
.map(entry => {
76+
const name = entry[0]
77+
const meta = entry[1].meta
78+
const link = `[${name}](./rules/${name}.md)`
79+
const replacedBy = (meta.docs.replacedBy || []).map(id => `[${id}](./rules/${id}.md)`).join(', ') || '(no replacement)'
80+
return `| ${link} | ${replacedBy} |`
81+
})
82+
.join('\n')
83+
}
84+
`
6585

6686
const recommendedRules = rules.reduce((obj, entry) => {
6787
const name = `vue/${entry[0]}`

0 commit comments

Comments
 (0)