From 4599cbb97868ea6f3785e13558cafb1aa5fc5e1c Mon Sep 17 00:00:00 2001 From: Toru Nagashima Date: Mon, 11 Feb 2019 20:24:10 +0900 Subject: [PATCH 1/3] New: valid-v-slot rule (fixes #802) --- docs/rules/valid-v-slot.md | 112 ++++++++++++ lib/rules/valid-v-slot.js | 252 +++++++++++++++++++++++++++ tests/lib/rules/valid-v-slot.js | 297 ++++++++++++++++++++++++++++++++ 3 files changed, 661 insertions(+) create mode 100644 docs/rules/valid-v-slot.md create mode 100644 lib/rules/valid-v-slot.js create mode 100644 tests/lib/rules/valid-v-slot.js diff --git a/docs/rules/valid-v-slot.md b/docs/rules/valid-v-slot.md new file mode 100644 index 000000000..565471550 --- /dev/null +++ b/docs/rules/valid-v-slot.md @@ -0,0 +1,112 @@ +--- +pageClass: rule-details +sidebarDepth: 0 +title: vue/valid-v-slot +description: enforce valid `v-slot` directives +--- +# vue/valid-v-slot +> enforce valid `v-slot` directives + +This rule checks whether every `v-slot` directive is valid. + +## :book: Rule Details + +This rule reports `v-slot` directives in the following cases: + +- The directive is not owned by a custom element. E.g. `
` +- The directive is a named slot and is on a custom element directly. E.g. `` +- The directive is the default slot, is on a custom element directly, and there are other named slots. E.g. `` +- The element which has the directive has another `v-slot` directive. E.g. `` +- The element which has the directive has another `v-slot` directive that is distributed to the same slot. E.g. `` +- The directive has a dynamic argument which uses the scope properties that the directive defined. E.g. `` +- The directive has any modifier. E.g. `` +- The directive is the default slot, is on a custom element directly, and has no value. E.g. `` + + + +```vue +