/** * @author tyankatsu * See LICENSE file in root directory for full license. */ 'use strict' // ------------------------------------------------------------------------------ // Requirements // ------------------------------------------------------------------------------ const { isVElement } = require('../utils') // ------------------------------------------------------------------------------ // Rule Definition // ------------------------------------------------------------------------------ /** * check whether has attribute `src` * @param {VElement} componentBlock */ function hasAttributeSrc(componentBlock) { const hasAttribute = componentBlock.startTag.attributes.length > 0 const hasSrc = componentBlock.startTag.attributes.filter( (attribute) => !attribute.directive && attribute.key.name === 'src' && attribute.value && attribute.value.value !== '' ).length > 0 return hasAttribute && hasSrc } /** * check whether value under the component block is only whitespaces or break lines * @param {VElement} componentBlock */ function isValueOnlyWhiteSpacesOrLineBreaks(componentBlock) { return ( componentBlock.children.length === 1 && componentBlock.children[0].type === 'VText' && !componentBlock.children[0].value.trim() ) } module.exports = { meta: { type: 'suggestion', docs: { description: 'disallow the `