Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
create (context) {
return VueUtils.defineTemplateBodyVisitor(context, {
"VElement" (node) {
const options = context.options[0] || {};
const componentOptions = options.components || [];
const typesToValidate = ['label'].concat(componentOptions);
const nodeType = utils.getElementType(node);
// Only check 'label' elements and custom types.
if (typesToValidate.indexOf(nodeType) === -1) {
return;
}
const required = options.required || { every: ['nesting', 'id'] };
const allowChildren = options.allowChildren || false;
if (!isValid(node, required, allowChildren)) {
context.report({
node,
message: errorMessage,
create (context) {
return VueUtils.defineTemplateBodyVisitor(context, {
"VAttribute" (node) {
const name = utils.getAttributeName(node);
if (name) {
const normalizedName = name.toLowerCase();
if (normalizedName.indexOf('aria-') !== 0) {
return;
}
const isValid = [...aria.keys()].indexOf(normalizedName) > -1;
if (isValid) {
return
}
context.report({
node,
message: `${name}: This attribute is an invalid ARIA attribute.`
});
}
remove(unusedVuexProperties, property => {
return argName === property.name;
});
}),
utils.executeOnRootTemplateEnd(() => {
if (unusedVuexProperties.length) {
utils.reportUnusedVuexProperties(context, unusedVuexProperties);
}
})
);
return Object.assign(
{},
initialize,
eslintPluginVueUtils.defineTemplateBodyVisitor(context, templateVisitor, scriptVisitor)
);
};
if (arg.type == 'Literal') {
usedStringNodes.push(arg);
}
});
}
},
},
utils.executeOnRootTemplateEnd(() => {
utils.reportUseOfUndefinedTranslation(context, definitionNodes, usedStringNodes);
})
);
return Object.assign(
{},
initialize,
eslintPluginVueUtils.defineTemplateBodyVisitor(context, templateVisitor, scriptVisitor)
);
};
if (get(arg, ['value'])) {
usedStrings.push(arg.value);
}
});
}
},
},
utils.executeOnRootTemplateEnd(() => {
utils.reportUnusedTranslations(context, definitionNodes, usedStrings);
})
);
return Object.assign(
{},
initialize,
eslintPluginVueUtils.defineTemplateBodyVisitor(context, templateVisitor, scriptVisitor)
);
};
create (context) {
return VueUtils.defineTemplateBodyVisitor(context, {
"VStartTag" (node) {
const element = node.parent;
const type = utils.getElementType(element);
if (!isMediaType(context, type)) {
return;
}
const mutedProp = utils.getAttribute(element, 'muted');
const mutedValue = mutedProp && utils.getAttributeValue(mutedProp);
if (mutedProp && mutedValue.toString() === 'true') {
return
}
const trackChildren = element.children.filter((child) => {
if (child.type !== 'VElement') {
return false;
}
return isTrackType(context, utils.getElementType(child));
create (context) {
return VueUtils.defineTemplateBodyVisitor(context, {
"VAttribute" (node) {
const options = context.options[0] || {};
const ignoreNonDOM = !!options.ignoreNonDOM;
if (ignoreNonDOM) {
const type = utils.getElementType(node.parent.parent);
if (!dom.get(type)) {
return;
}
}
const isRole = utils.isAttribute(node, 'role')
if (!isRole) { return; }
const value = utils.getAttributeValue(node);
if (value === null || typeof value !== 'string') {
return;
}
remove(unusedProperties, property => {
return argName === property.name;
});
}),
utils.executeOnRootTemplateEnd(() => {
if (unusedProperties.length) {
utils.reportUnusedProperties(context, unusedProperties);
}
})
);
return Object.assign(
{},
initialize,
eslintPluginVueUtils.defineTemplateBodyVisitor(context, templateVisitor, scriptVisitor)
);
};
create (context) {
return VueUtils.defineTemplateBodyVisitor(context, {
"VElement" (node) {
const typeCheck = headings.concat(context.options[0]);
const nodeType = utils.getElementType(node);
if (typeCheck.indexOf(nodeType) === -1) {
return;
} else if (utils.hasAccessibleChild(node)) {
return;
}
context.report({
node,
message: errorMessage,
});
}
}, altRule.create(context))
}
remove(unusedProperties, property => {
return referencesNames.includes(property.name);
});
},
},
utils.executeOnRootTemplateEnd(() => {
if (unusedProperties.length) {
utils.reportUnusedProperties(context, unusedProperties, disabledLines);
}
})
);
return Object.assign(
{},
initialize,
eslintPluginVueUtils.defineTemplateBodyVisitor(context, templateVisitor, scriptVisitor)
);
};