Skip to content

Commit 5c0cd71

Browse files
authored
Docs: Add hints for rules that provide suggestions (#1708)
1 parent e928e4c commit 5c0cd71

11 files changed

+37
-13
lines changed

docs/rules/README.md

+12-10
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ sidebarDepth: 0
88

99
::: tip Legend
1010
:wrench: Indicates that the rule is fixable, and using `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#fixing-problems) can automatically fix some of the reported problems.
11+
12+
:bulb: Indicates that some problems reported by the rule are manually fixable by editor [suggestions](https://eslint.org/docs/developer-guide/working-with-rules#providing-suggestions).
1113
:::
1214

1315

@@ -78,7 +80,7 @@ Enforce all the rules in this category, as well as all higher priority rules, wi
7880
| [vue/no-template-key](./no-template-key.md) | disallow `key` attribute on `<template>` | |
7981
| [vue/no-textarea-mustache](./no-textarea-mustache.md) | disallow mustaches in `<textarea>` | |
8082
| [vue/no-unused-components](./no-unused-components.md) | disallow registering components that are not used inside templates | |
81-
| [vue/no-unused-vars](./no-unused-vars.md) | disallow unused variable definitions of v-for directives or scope attributes | |
83+
| [vue/no-unused-vars](./no-unused-vars.md) | disallow unused variable definitions of v-for directives or scope attributes | :bulb: |
8284
| [vue/no-use-v-if-with-v-for](./no-use-v-if-with-v-for.md) | disallow use v-if on the same element as v-for | |
8385
| [vue/no-useless-template-attributes](./no-useless-template-attributes.md) | disallow useless attribute on `<template>` | |
8486
| [vue/no-v-for-template-key-on-child](./no-v-for-template-key-on-child.md) | disallow key of `<template v-for>` placed on child elements | |
@@ -95,7 +97,7 @@ Enforce all the rules in this category, as well as all higher priority rules, wi
9597
| [vue/use-v-on-exact](./use-v-on-exact.md) | enforce usage of `exact` modifier on `v-on` | |
9698
| [vue/valid-define-emits](./valid-define-emits.md) | enforce valid `defineEmits` compiler macro | |
9799
| [vue/valid-define-props](./valid-define-props.md) | enforce valid `defineProps` compiler macro | |
98-
| [vue/valid-next-tick](./valid-next-tick.md) | enforce valid `nextTick` function calls | :wrench: |
100+
| [vue/valid-next-tick](./valid-next-tick.md) | enforce valid `nextTick` function calls | :wrench::bulb: |
99101
| [vue/valid-template-root](./valid-template-root.md) | enforce valid template root | |
100102
| [vue/valid-v-bind](./valid-v-bind.md) | enforce valid `v-bind` directives | |
101103
| [vue/valid-v-cloak](./valid-v-cloak.md) | enforce valid `v-cloak` directives | |
@@ -144,7 +146,7 @@ Enforce all the rules in this category, as well as all higher priority rules, wi
144146
| [vue/one-component-per-file](./one-component-per-file.md) | enforce that each component should be in its own file | |
145147
| [vue/prop-name-casing](./prop-name-casing.md) | enforce specific casing for the Prop name in Vue components | |
146148
| [vue/require-default-prop](./require-default-prop.md) | require default value for props | |
147-
| [vue/require-explicit-emits](./require-explicit-emits.md) | require `emits` option with name triggered by `$emit()` | |
149+
| [vue/require-explicit-emits](./require-explicit-emits.md) | require `emits` option with name triggered by `$emit()` | :bulb: |
148150
| [vue/require-prop-types](./require-prop-types.md) | require type definitions in props | |
149151
| [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: |
150152
| [vue/v-bind-style](./v-bind-style.md) | enforce `v-bind` directive style | :wrench: |
@@ -202,7 +204,7 @@ Enforce all the rules in this category, as well as all higher priority rules, wi
202204
| [vue/no-template-key](./no-template-key.md) | disallow `key` attribute on `<template>` | |
203205
| [vue/no-textarea-mustache](./no-textarea-mustache.md) | disallow mustaches in `<textarea>` | |
204206
| [vue/no-unused-components](./no-unused-components.md) | disallow registering components that are not used inside templates | |
205-
| [vue/no-unused-vars](./no-unused-vars.md) | disallow unused variable definitions of v-for directives or scope attributes | |
207+
| [vue/no-unused-vars](./no-unused-vars.md) | disallow unused variable definitions of v-for directives or scope attributes | :bulb: |
206208
| [vue/no-use-v-if-with-v-for](./no-use-v-if-with-v-for.md) | disallow use v-if on the same element as v-for | |
207209
| [vue/no-useless-template-attributes](./no-useless-template-attributes.md) | disallow useless attribute on `<template>` | |
208210
| [vue/no-v-for-template-key](./no-v-for-template-key.md) | disallow `key` attribute on `<template v-for>` | |
@@ -214,7 +216,7 @@ Enforce all the rules in this category, as well as all higher priority rules, wi
214216
| [vue/require-valid-default-prop](./require-valid-default-prop.md) | enforce props default values to be valid | |
215217
| [vue/return-in-computed-property](./return-in-computed-property.md) | enforce that a return statement is present in computed property | |
216218
| [vue/use-v-on-exact](./use-v-on-exact.md) | enforce usage of `exact` modifier on `v-on` | |
217-
| [vue/valid-next-tick](./valid-next-tick.md) | enforce valid `nextTick` function calls | :wrench: |
219+
| [vue/valid-next-tick](./valid-next-tick.md) | enforce valid `nextTick` function calls | :wrench::bulb: |
218220
| [vue/valid-template-root](./valid-template-root.md) | enforce valid template root | |
219221
| [vue/valid-v-bind-sync](./valid-v-bind-sync.md) | enforce valid `.sync` modifier on `v-bind` directives | |
220222
| [vue/valid-v-bind](./valid-v-bind.md) | enforce valid `v-bind` directives | |
@@ -323,14 +325,14 @@ For example:
323325
| [vue/no-empty-component-block](./no-empty-component-block.md) | disallow the `<template>` `<script>` `<style>` block to be empty | |
324326
| [vue/no-invalid-model-keys](./no-invalid-model-keys.md) | require valid keys in model option | |
325327
| [vue/no-multiple-objects-in-class](./no-multiple-objects-in-class.md) | disallow to pass multiple objects into array to class | |
326-
| [vue/no-potential-component-option-typo](./no-potential-component-option-typo.md) | disallow a potential typo in your component property | |
328+
| [vue/no-potential-component-option-typo](./no-potential-component-option-typo.md) | disallow a potential typo in your component property | :bulb: |
327329
| [vue/no-reserved-component-names](./no-reserved-component-names.md) | disallow the use of reserved names in component definitions | |
328330
| [vue/no-restricted-block](./no-restricted-block.md) | disallow specific block | |
329331
| [vue/no-restricted-call-after-await](./no-restricted-call-after-await.md) | disallow asynchronously called restricted methods | |
330332
| [vue/no-restricted-class](./no-restricted-class.md) | disallow specific classes in Vue components | |
331333
| [vue/no-restricted-component-options](./no-restricted-component-options.md) | disallow specific component option | |
332-
| [vue/no-restricted-custom-event](./no-restricted-custom-event.md) | disallow specific custom event | |
333-
| [vue/no-restricted-props](./no-restricted-props.md) | disallow specific props | |
334+
| [vue/no-restricted-custom-event](./no-restricted-custom-event.md) | disallow specific custom event | :bulb: |
335+
| [vue/no-restricted-props](./no-restricted-props.md) | disallow specific props | :bulb: |
334336
| [vue/no-restricted-static-attribute](./no-restricted-static-attribute.md) | disallow specific attribute | |
335337
| [vue/no-restricted-v-bind](./no-restricted-v-bind.md) | disallow specific argument in `v-bind` | |
336338
| [vue/no-static-inline-styles](./no-static-inline-styles.md) | disallow static inline `style` attributes | |
@@ -347,8 +349,8 @@ For example:
347349
| [vue/no-v-text](./no-v-text.md) | disallow use of v-text | |
348350
| [vue/padding-line-between-blocks](./padding-line-between-blocks.md) | require or disallow padding lines between blocks | :wrench: |
349351
| [vue/require-direct-export](./require-direct-export.md) | require the component to be directly exported | |
350-
| [vue/require-emit-validator](./require-emit-validator.md) | require type definitions in emits | |
351-
| [vue/require-expose](./require-expose.md) | require declare public properties using `expose` | |
352+
| [vue/require-emit-validator](./require-emit-validator.md) | require type definitions in emits | :bulb: |
353+
| [vue/require-expose](./require-expose.md) | require declare public properties using `expose` | :bulb: |
352354
| [vue/require-name-property](./require-name-property.md) | require a name property in Vue components | |
353355
| [vue/script-indent](./script-indent.md) | enforce consistent indentation in `<script>` | :wrench: |
354356
| [vue/sort-keys](./sort-keys.md) | enforce sort-keys in a manner that is compatible with order-in-components | |

docs/rules/no-potential-component-option-typo.md

+2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ since: v7.0.0
99

1010
> disallow a potential typo in your component property
1111
12+
- :bulb: Some problems reported by this rule are manually fixable by editor [suggestions](https://eslint.org/docs/developer-guide/working-with-rules#providing-suggestions).
13+
1214
## :book: Rule Details
1315

1416
This rule disallow a potential typo in your component options

docs/rules/no-restricted-custom-event.md

+2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ since: v7.3.0
99

1010
> disallow specific custom event
1111
12+
- :bulb: Some problems reported by this rule are manually fixable by editor [suggestions](https://eslint.org/docs/developer-guide/working-with-rules#providing-suggestions).
13+
1214
## :book: Rule Details
1315

1416
This rule allows you to specify custom event that you don't want to use in your application.

docs/rules/no-restricted-props.md

+2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ since: v7.3.0
99

1010
> disallow specific props
1111
12+
- :bulb: Some problems reported by this rule are manually fixable by editor [suggestions](https://eslint.org/docs/developer-guide/working-with-rules#providing-suggestions).
13+
1214
## :book: Rule Details
1315

1416
This rule allows you to specify props that you don't want to use in your application.

docs/rules/no-unused-vars.md

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ since: v3.14.0
1010
> disallow unused variable definitions of v-for directives or scope attributes
1111
1212
- :gear: This rule is included in all of `"plugin:vue/vue3-essential"`, `"plugin:vue/essential"`, `"plugin:vue/vue3-strongly-recommended"`, `"plugin:vue/strongly-recommended"`, `"plugin:vue/vue3-recommended"` and `"plugin:vue/recommended"`.
13+
- :bulb: Some problems reported by this rule are manually fixable by editor [suggestions](https://eslint.org/docs/developer-guide/working-with-rules#providing-suggestions).
1314

1415
## :book: Rule Details
1516

docs/rules/require-emit-validator.md

+2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ since: v7.10.0
99

1010
> require type definitions in emits
1111
12+
- :bulb: Some problems reported by this rule are manually fixable by editor [suggestions](https://eslint.org/docs/developer-guide/working-with-rules#providing-suggestions).
13+
1214
## :book: Rule Details
1315

1416
This rule enforces that a `emits` statement contains type definition.

docs/rules/require-explicit-emits.md

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ since: v7.0.0
1010
> require `emits` option with name triggered by `$emit()`
1111
1212
- :gear: This rule is included in `"plugin:vue/vue3-strongly-recommended"` and `"plugin:vue/vue3-recommended"`.
13+
- :bulb: Some problems reported by this rule are manually fixable by editor [suggestions](https://eslint.org/docs/developer-guide/working-with-rules#providing-suggestions).
1314

1415
## :book: Rule Details
1516

docs/rules/require-expose.md

+2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ since: v7.14.0
99

1010
> require declare public properties using `expose`
1111
12+
- :bulb: Some problems reported by this rule are manually fixable by editor [suggestions](https://eslint.org/docs/developer-guide/working-with-rules#providing-suggestions).
13+
1214
## :book: Rule Details
1315

1416
This rule enforces the component to explicitly declare the exposed properties to the component using `expose`. You can use `expose` to control the internal properties of a component so that they cannot be referenced externally.

docs/rules/valid-next-tick.md

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ since: v7.5.0
1111
1212
- :gear: This rule is included in all of `"plugin:vue/vue3-essential"`, `"plugin:vue/essential"`, `"plugin:vue/vue3-strongly-recommended"`, `"plugin:vue/strongly-recommended"`, `"plugin:vue/vue3-recommended"` and `"plugin:vue/recommended"`.
1313
- :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.
14+
- :bulb: Some problems reported by this rule are manually fixable by editor [suggestions](https://eslint.org/docs/developer-guide/working-with-rules#providing-suggestions).
1415

1516
## :book: Rule Details
1617

tools/update-docs-rules-index.js

+6-2
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,11 @@ const uncategorizedExtensionRule = rules.filter(
2525
const deprecatedRules = rules.filter((rule) => rule.meta.deprecated)
2626

2727
function toRuleRow(rule) {
28-
const mark = `${rule.meta.fixable ? ':wrench:' : ''}${
28+
const mark = [
29+
rule.meta.fixable ? ':wrench:' : '',
30+
rule.meta.hasSuggestions ? ':bulb:' : '',
2931
rule.meta.deprecated ? ':warning:' : ''
30-
}`
32+
].join('')
3133
const link = `[${rule.ruleId}](./${rule.name}.md)`
3234
const description = rule.meta.docs.description || '(no description)'
3335

@@ -133,6 +135,8 @@ sidebarDepth: 0
133135
134136
::: tip Legend
135137
:wrench: Indicates that the rule is fixable, and using \`--fix\` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#fixing-problems) can automatically fix some of the reported problems.
138+
139+
:bulb: Indicates that some problems reported by the rule are manually fixable by editor [suggestions](https://eslint.org/docs/developer-guide/working-with-rules#providing-suggestions).
136140
:::
137141
138142
${rulesTableContent}`

tools/update-docs.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,12 @@ class DocFile {
141141
}
142142
if (meta.fixable) {
143143
notes.push(
144-
`- :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.`
144+
'- :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.'
145+
)
146+
}
147+
if (meta.hasSuggestions) {
148+
notes.push(
149+
'- :bulb: Some problems reported by this rule are manually fixable by editor [suggestions](https://eslint.org/docs/developer-guide/working-with-rules#providing-suggestions).'
145150
)
146151
}
147152

0 commit comments

Comments
 (0)