diff --git a/docs/rules/README.md b/docs/rules/README.md index 83eda5692..b89debd60 100644 --- a/docs/rules/README.md +++ b/docs/rules/README.md @@ -282,6 +282,7 @@ For example: | [vue/match-component-file-name](./match-component-file-name.md) | require component name property to match its file name | | | [vue/max-len](./max-len.md) | enforce a maximum line length | | | [vue/no-boolean-default](./no-boolean-default.md) | disallow boolean defaults | :wrench: | +| [vue/no-duplicate-attr-inheritance](./no-duplicate-attr-inheritance.md) | enforce `inheritAttrs` to be set to `false` when using `v-bind="$attrs"` | | | [vue/no-empty-pattern](./no-empty-pattern.md) | disallow empty destructuring patterns | | | [vue/no-irregular-whitespace](./no-irregular-whitespace.md) | disallow irregular whitespace | | | [vue/no-reserved-component-names](./no-reserved-component-names.md) | disallow the use of reserved names in component definitions | | diff --git a/docs/rules/no-duplicate-attr-inheritance.md b/docs/rules/no-duplicate-attr-inheritance.md new file mode 100644 index 000000000..959124e48 --- /dev/null +++ b/docs/rules/no-duplicate-attr-inheritance.md @@ -0,0 +1,56 @@ +--- +pageClass: rule-details +sidebarDepth: 0 +title: vue/no-duplicate-attr-inheritance +description: enforce `inheritAttrs` to be set to `false` when using `v-bind="$attrs"` +--- +# vue/no-duplicate-attr-inheritance +> enforce `inheritAttrs` to be set to `false` when using `v-bind="$attrs"` + +## :book: Rule Details + +This rule aims to prevent duplicated attribute inheritance. +This rule to warn to apply `inheritAttrs: false` when it detects `v-bind="$attrs"` being used. + + + +```vue + + + ` + }, + { + filename: 'test.vue', + code: ` + + + ` + }, + { + filename: 'test.vue', + code: ` + + + ` + }, + { + filename: 'test.vue', + code: ` + + + ` + }, + { + filename: 'test.vue', + code: ` + + + ` + }, + { + filename: 'test.vue', + code: ` + + + ` + } + ], + + invalid: [ + { + filename: 'test.vue', + code: '', + errors: ['Set "inheritAttrs" to false.'] + }, + { + filename: 'test.vue', + code: ` + + + `, + errors: ['Set "inheritAttrs" to false.'] + } + ] +})