diff --git a/lib/rules/valid-v-bind-sync.js b/lib/rules/valid-v-bind-sync.js index 48452f822..d6ab658e2 100644 --- a/lib/rules/valid-v-bind-sync.js +++ b/lib/rules/valid-v-bind-sync.js @@ -82,6 +82,22 @@ function maybeNullObjectMemberExpression(node) { return false } +function isValidIs(node) { + const { attributes } = node + const isAttribute = attributes.some((attr) => { + // check for `VAttribute` + if (attr.type === 'VAttribute') { + // check for `is` attribute + if (attr.key.type === 'VIdentifier' && attr.key.name === 'is') return true + + // check for `:is` `bind` attribute + if (attr.key.type === 'VDirectiveKey' && attr.key.argument.name === 'is') + return true + } + }) + return isAttribute +} + // ------------------------------------------------------------------------------ // Rule Definition // ------------------------------------------------------------------------------ @@ -120,7 +136,7 @@ module.exports = { const element = node.parent.parent const name = element.name - if (!isValidElement(element)) { + if (!isValidElement(element) && !isValidIs(node.parent)) { context.report({ node, loc: node.loc, diff --git a/tests/lib/rules/valid-v-bind-sync.js b/tests/lib/rules/valid-v-bind-sync.js index dfaf161ea..6ff2c462d 100644 --- a/tests/lib/rules/valid-v-bind-sync.js +++ b/tests/lib/rules/valid-v-bind-sync.js @@ -145,6 +145,48 @@ tester.run('valid-v-bind-sync', rule, { { filename: 'empty-value.vue', code: '' + }, + { + filename: 'test.vue', + code: ` + + ` + }, + { + filename: 'test.vue', + code: ` + + ` + }, + { + filename: 'test.vue', + code: ` + + ` } ], invalid: [