diff --git a/docs/.vuepress/components/eslint-code-block.vue b/docs/.vuepress/components/eslint-code-block.vue index 00b694825..381d9985f 100644 --- a/docs/.vuepress/components/eslint-code-block.vue +++ b/docs/.vuepress/components/eslint-code-block.vue @@ -122,15 +122,12 @@ export default { async mounted() { // Load linter. - const [ - { default: Linter }, - { default: coreRules }, - { parseForESLint } - ] = await Promise.all([ - import('eslint4b/dist/linter'), - import('eslint4b/dist/core-rules'), - import('espree').then(() => import('vue-eslint-parser')) - ]) + const [{ default: Linter }, { default: coreRules }, { parseForESLint }] = + await Promise.all([ + import('eslint4b/dist/linter'), + import('eslint4b/dist/core-rules'), + import('espree').then(() => import('vue-eslint-parser')) + ]) const linter = (this.linter = new Linter()) diff --git a/docs/rules/README.md b/docs/rules/README.md index e34e4ca2b..9717d49ae 100644 --- a/docs/rules/README.md +++ b/docs/rules/README.md @@ -157,7 +157,7 @@ Enforce all the rules in this category, as well as all higher priority rules, wi | [vue/no-multiple-slot-args](./no-multiple-slot-args.md) | disallow to pass multiple arguments to scoped slots | | | [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 | | +| [vue/this-in-template](./this-in-template.md) | disallow usage of `this` in template | :wrench: | ## Priority A: Essential (Error Prevention) for Vue.js 2.x @@ -267,7 +267,7 @@ Enforce all the rules in this category, as well as all higher priority rules, wi | [vue/no-multiple-slot-args](./no-multiple-slot-args.md) | disallow to pass multiple arguments to scoped slots | | | [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 | | +| [vue/this-in-template](./this-in-template.md) | disallow usage of `this` in template | :wrench: | ## Uncategorized diff --git a/docs/rules/attribute-hyphenation.md b/docs/rules/attribute-hyphenation.md index cc6391831..2aa8a39e5 100644 --- a/docs/rules/attribute-hyphenation.md +++ b/docs/rules/attribute-hyphenation.md @@ -40,10 +40,11 @@ This rule enforces using hyphenated attribute names on custom components in Vue } ``` -Default casing is set to `always` with `['data-', 'aria-', 'slot-scope']` set to be ignored +Default casing is set to `always`. By default the following attributes are ignored: `data-`, `aria-`, `slot-scope`, +and all the [SVG attributes](https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute) with either an upper case letter or an hyphen. - `"always"` (default) ... Use hyphenated name. -- `"never"` ... Don't use hyphenated name except `data-`, `aria-` and `slot-scope`. +- `"never"` ... Don't use hyphenated name except the ones that are ignored. - `"ignore"` ... Array of ignored names ### `"always"` @@ -66,7 +67,7 @@ It errors on upper case letters. ### `"never"` -It errors on hyphens except `data-`, `aria-` and `slot-scope`. +It errors on hyphens except on the attributes in the ignored attributes list. diff --git a/docs/rules/html-button-has-type.md b/docs/rules/html-button-has-type.md index 5974f72da..24f997e6a 100644 --- a/docs/rules/html-button-has-type.md +++ b/docs/rules/html-button-has-type.md @@ -48,13 +48,13 @@ This rule aims to warn if no type or an invalid type is used on a button type at - `button` ... `` - `true` (default) ... allow value `button`. - - `false"` ... disallow value `button`. + - `false` ... disallow value `button`. - `submit` ... `` - `true` (default) ... allow value `submit`. - - `false"` ... disallow value `submit`. + - `false` ... disallow value `submit`. - `reset` ... `` - `true` (default) ... allow value `reset`. - - `false"` ... disallow value `reset`. + - `false` ... disallow value `reset`. ## :rocket: Version diff --git a/docs/rules/no-template-target-blank.md b/docs/rules/no-template-target-blank.md index 411b1c9c2..f53289e3e 100644 --- a/docs/rules/no-template-target-blank.md +++ b/docs/rules/no-template-target-blank.md @@ -22,7 +22,7 @@ This rule disallows using `target="_blank"` attribute without `rel="noopener nor link - + ``` @@ -52,7 +52,7 @@ This rule disallows using `target="_blank"` attribute without `rel="noopener nor link - + ``` @@ -68,7 +68,7 @@ This rule disallows using `target="_blank"` attribute without `rel="noopener nor link - + ``` @@ -84,7 +84,7 @@ This rule disallows using `target="_blank"` attribute without `rel="noopener nor link - + ``` @@ -100,7 +100,7 @@ This rule disallows using `target="_blank"` attribute without `rel="noopener nor link - + ``` diff --git a/docs/rules/require-emit-validator.md b/docs/rules/require-emit-validator.md new file mode 100644 index 000000000..dd3274b2f --- /dev/null +++ b/docs/rules/require-emit-validator.md @@ -0,0 +1,65 @@ +--- +pageClass: rule-details +sidebarDepth: 0 +title: vue/require-emit-validator +description: require type definitions in emits +since: v7.10.0 +--- +# vue/require-emit-validator + +> require type definitions in emits + +- :gear: This rule is included in . + +## :book: Rule Details + +This rule enforces that a `emits` statement contains type definition. + +Declaring `emits` with types can bring better maintenance. +Even if using with TypeScript, this can provide better type inference when annotating parameters with types. + + + +```vue + +``` + + + +## :wrench: Options + +Nothing. + +## :books: Further Reading + +- [API Reference](https://v3.vuejs.org/api/options-data.html#emits) + +## :rocket: Version + +This rule was introduced in eslint-plugin-vue v7.10.0 + +## :mag: Implementation + +- [Rule source](https://github.com/vuejs/eslint-plugin-vue/blob/master/lib/rules/require-emit-validator.js) +- [Test source](https://github.com/vuejs/eslint-plugin-vue/blob/master/tests/lib/rules/require-emit-validator.js) diff --git a/docs/rules/sort-keys.md b/docs/rules/sort-keys.md index cb8836f36..b573e4eaa 100644 --- a/docs/rules/sort-keys.md +++ b/docs/rules/sort-keys.md @@ -15,7 +15,7 @@ This rule is almost the same rule as core [sort-keys] rule but it will not error ```json { - "sort-keys": ["error", "asc", { + "vue/sort-keys": ["error", "asc", { "caseSensitive": true, "ignoreChildrenOf": ["model"], "ignoreGrandchildrenOf": ["computed", "directives", "inject", "props", "watch"], diff --git a/docs/rules/this-in-template.md b/docs/rules/this-in-template.md index 7924ad3b5..f193e7e37 100644 --- a/docs/rules/this-in-template.md +++ b/docs/rules/this-in-template.md @@ -10,12 +10,13 @@ since: v3.13.0 > disallow usage of `this` in template - :gear: This rule is included in `"plugin:vue/vue3-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 This rule aims at preventing usage of `this` in Vue templates. - + ```vue