How to use the eslint-plugin-vue/lib/utils.hasDirective function in eslint-plugin-vue

To help you get started, we’ve selected a few eslint-plugin-vue examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github maranran / eslint-plugin-vue-a11y / lib / utils / index.js View on Github external
getElementType (node) { // return tagName
    assert(node && node.type === 'VElement');
    if (utils.hasAttribute(node, 'is')) {
      return this.getAttributeValue(node, 'is');
    } else if (utils.hasDirective(node, 'bind', 'is')) {
      return 'component';
    }
    return node.rawName;
  },
  isHiddenFromScreenReader (node) {
github maranran / eslint-plugin-vue-a11y / lib / rules / no-onchange.js View on Github external
"VAttribute[directive=true][key.name.name='on'][key.argument.name='change']" (node) {
        const element = node.parent.parent;
        const nodeType = utils.getElementType(element);

        if (applicableTypes.indexOf(nodeType) === -1) {
          return;
        }
        const hasOnBlur = VueUtils.hasDirective(element, 'on', 'blur');

        if (!hasOnBlur) {
          context.report({
            node,
            message: errorMessage,
          });
        }
      }
    }, JsxRule.create(context))