Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const VueUtils = require('eslint-plugin-vue/lib/utils')
const utils = require('../utils')
const JsxRule = require('eslint-plugin-jsx-a11y/lib/rules/label-has-for.js')
const errorMessage = 'Form label must have associated control';
const enumValues = ['nesting', 'id'];
const schema = {
type: 'object',
properties: {
components: arraySchema,
required: {
oneOf: [
{ type: 'string', enum: enumValues },
generateObjSchema({ some: enumArraySchema(enumValues) }, ['some']),
generateObjSchema({ every: enumArraySchema(enumValues) }, ['every']),
],
},
allowChildren: { type: 'boolean' },
},
};
const validateNesting = node => node.children.some(child => child.type === 'VElement');
const validateId = (node) => {
const htmlForAttr = utils.getAttribute(node, 'for');
return htmlForAttr && utils.hasAttributeValue(htmlForAttr);
};
const validate = (node, required, allowChildren) => {
if (allowChildren === true) {
return utils.hasAccessibleChild(node);
}
const VueUtils = require('eslint-plugin-vue/lib/utils');
const utils = require('../utils');
const altRule = require('eslint-plugin-jsx-a11y/lib/rules/no-distracting-elements.js');
const { generateObjSchema, enumArraySchema } = require('eslint-plugin-jsx-a11y/lib/util/schemas.js');
const errorMessage = element =>
`Do not use <${element}> elements as they can create visual accessibility issues and are deprecated.`;
const DEFAULT_ELEMENTS = [
'marquee',
'blink',
];
const schema = generateObjSchema({
elements: enumArraySchema(DEFAULT_ELEMENTS),
});
module.exports = {
meta: {
docs: {
url: 'https://github.com/maranran/eslint-plugin-vue-a11y/blob/master/docs/rules/no-distracting-elements.md'
},
schema: [schema],
},
create (context) {
return VueUtils.defineTemplateBodyVisitor(context, {
"VElement" (node) {
const options = context.options[0] || {};
const elementOptions = options.elements || DEFAULT_ELEMENTS;
const type = utils.getElementType(node);
const { generateObjSchema, arraySchema, enumArraySchema } = require('eslint-plugin-jsx-a11y/lib/util/schemas.js');
const VueUtils = require('eslint-plugin-vue/lib/utils')
const utils = require('../utils')
const JsxRule = require('eslint-plugin-jsx-a11y/lib/rules/label-has-for.js')
const errorMessage = 'Form label must have associated control';
const enumValues = ['nesting', 'id'];
const schema = {
type: 'object',
properties: {
components: arraySchema,
required: {
oneOf: [
{ type: 'string', enum: enumValues },
generateObjSchema({ some: enumArraySchema(enumValues) }, ['some']),
generateObjSchema({ every: enumArraySchema(enumValues) }, ['every']),
],
},
allowChildren: { type: 'boolean' },
},
};
const validateNesting = node => node.children.some(child => child.type === 'VElement');
const validateId = (node) => {
const htmlForAttr = utils.getAttribute(node, 'for');
return htmlForAttr && utils.hasAttributeValue(htmlForAttr);
};
const validate = (node, required, allowChildren) => {
if (allowChildren === true) {
return utils.hasAccessibleChild(node);