Socket
Socket
Sign inDemoInstall

eslint-plugin-jsx-a11y

Package Overview
Dependencies
Maintainers
2
Versions
82
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-plugin-jsx-a11y - npm Package Compare versions

Comparing version 2.2.1 to 2.2.2

5

CHANGELOG.md

@@ -0,1 +1,6 @@

2.2.2 / 2016-09-12
==================
- [fix] `x-has-content` rules now pass with children prop set.
2.2.1 / 2016-08-31

@@ -2,0 +7,0 @@ ==================

2

lib/rules/anchor-has-content.js

@@ -64,3 +64,3 @@ 'use strict';

}
}) || (0, _jsxAstUtils.hasProp)(node.attributes, 'dangerouslySetInnerHTML');
}) || (0, _jsxAstUtils.hasAnyProp)(node.attributes, ['dangerouslySetInnerHTML', 'children']);

@@ -67,0 +67,0 @@ if (isAccessible) {

@@ -65,3 +65,3 @@ 'use strict';

}
}) || (0, _jsxAstUtils.hasProp)(node.attributes, 'dangerouslySetInnerHTML');
}) || (0, _jsxAstUtils.hasAnyProp)(node.attributes, ['dangerouslySetInnerHTML', 'children']);

@@ -68,0 +68,0 @@ if (isAccessible) {

{
"name": "eslint-plugin-jsx-a11y",
"version": "2.2.1",
"version": "2.2.2",
"description": "A static analysis linter of jsx and their accessibility with screen readers.",

@@ -35,3 +35,3 @@ "keywords": [

"eslint": "^3.0.0",
"eslint-config-airbnb-base": "^5.0.0",
"eslint-config-airbnb-base": "^7.0.0",
"eslint-plugin-import": "^1.8.1",

@@ -38,0 +38,0 @@ "istanbul": "^1.0.0-alpha.2",

@@ -10,3 +10,3 @@ /**

import { elementType, hasProp } from 'jsx-ast-utils';
import { elementType, hasAnyProp } from 'jsx-ast-utils';
import isHiddenFromScreenReader from '../util/isHiddenFromScreenReader';

@@ -44,3 +44,3 @@

create: context => ({
JSXOpeningElement: node => {
JSXOpeningElement: (node) => {
const typeCheck = anchors.concat(context.options[0]);

@@ -53,3 +53,3 @@ const nodeType = elementType(node);

}
const isAccessible = node.parent.children.some(child => {
const isAccessible = node.parent.children.some((child) => {
switch (child.type) {

@@ -71,3 +71,3 @@ case 'Literal':

}
}) || hasProp(node.attributes, 'dangerouslySetInnerHTML');
}) || hasAnyProp(node.attributes, ['dangerouslySetInnerHTML', 'children']);

@@ -74,0 +74,0 @@

@@ -14,3 +14,3 @@ /**

const errorMessage = name => {
const errorMessage = (name) => {
const dictionary = Object.keys(ariaAttributes).map(aria => aria.toLowerCase());

@@ -37,3 +37,3 @@ const suggestions = getSuggestion(name, dictionary);

create: context => ({
JSXAttribute: attribute => {
JSXAttribute: (attribute) => {
const name = propName(attribute);

@@ -40,0 +40,0 @@ const normalizedName = name ? name.toUpperCase() : '';

@@ -63,3 +63,3 @@ /**

create: context => ({
JSXAttribute: attribute => {
JSXAttribute: (attribute) => {
const name = propName(attribute);

@@ -66,0 +66,0 @@ const normalizedName = name ? name.toUpperCase() : '';

@@ -25,3 +25,3 @@ /**

create: context => ({
JSXAttribute: attribute => {
JSXAttribute: (attribute) => {
const name = propName(attribute);

@@ -28,0 +28,0 @@ const normalizedName = name ? name.toUpperCase() : '';

@@ -29,3 +29,3 @@ /**

create: context => ({
JSXOpeningElement: node => {
JSXOpeningElement: (node) => {
const nodeType = elementType(node);

@@ -44,3 +44,3 @@ const nodeAttrs = DOM[nodeType] || {};

node.attributes.forEach(prop => {
node.attributes.forEach((prop) => {
if (prop.type === 'JSXSpreadAttribute') {

@@ -47,0 +47,0 @@ return;

@@ -27,3 +27,3 @@ /**

create: context => ({
JSXOpeningElement: node => {
JSXOpeningElement: (node) => {
const props = node.attributes;

@@ -30,0 +30,0 @@ if (getProp(props, 'onclick') === undefined) {

@@ -10,3 +10,3 @@ /**

import { elementType, hasProp } from 'jsx-ast-utils';
import { elementType, hasAnyProp } from 'jsx-ast-utils';
import isHiddenFromScreenReader from '../util/isHiddenFromScreenReader';

@@ -48,3 +48,3 @@

create: context => ({
JSXOpeningElement: node => {
JSXOpeningElement: (node) => {
const typeCheck = headings.concat(context.options[0]);

@@ -58,3 +58,3 @@ const nodeType = elementType(node);

const isAccessible = node.parent.children.some(child => {
const isAccessible = node.parent.children.some((child) => {
switch (child.type) {

@@ -76,3 +76,3 @@ case 'Literal':

}
}) || hasProp(node.attributes, 'dangerouslySetInnerHTML');
}) || hasAnyProp(node.attributes, ['dangerouslySetInnerHTML', 'children']);

@@ -79,0 +79,0 @@

@@ -37,3 +37,3 @@ /**

create: context => ({
JSXOpeningElement: node => {
JSXOpeningElement: (node) => {
const typeCheck = ['a'].concat(context.options[0]);

@@ -40,0 +40,0 @@ const nodeType = elementType(node);

@@ -24,3 +24,3 @@ /**

create: context => ({
JSXOpeningElement: node => {
JSXOpeningElement: (node) => {
const type = elementType(node);

@@ -27,0 +27,0 @@

@@ -34,3 +34,3 @@ /**

create: context => ({
JSXOpeningElement: node => {
JSXOpeningElement: (node) => {
const typeCheck = ['img'].concat(context.options[0]);

@@ -37,0 +37,0 @@ const nodeType = elementType(node);

@@ -45,3 +45,3 @@ /**

create: context => ({
JSXOpeningElement: node => {
JSXOpeningElement: (node) => {
let REDUNDANT_WORDS_EXTENDED;

@@ -48,0 +48,0 @@

@@ -37,3 +37,3 @@ /**

create: context => ({
JSXOpeningElement: node => {
JSXOpeningElement: (node) => {
const typeCheck = ['label'].concat(context.options[0]);

@@ -40,0 +40,0 @@ const nodeType = elementType(node);

@@ -26,3 +26,3 @@ /**

create: context => ({
JSXAttribute: node => {
JSXAttribute: (node) => {
const name = propName(node);

@@ -29,0 +29,0 @@ if (name && name.toUpperCase() !== 'LANG') {

@@ -27,3 +27,3 @@ /**

create: context => ({
JSXOpeningElement: node => {
JSXOpeningElement: (node) => {
const attributes = node.attributes;

@@ -30,0 +30,0 @@

@@ -26,3 +26,3 @@ /**

create: context => ({
JSXOpeningElement: node => {
JSXOpeningElement: (node) => {
const accessKey = getProp(node.attributes, 'accesskey');

@@ -29,0 +29,0 @@ const accessKeyValue = getPropValue(accessKey);

@@ -25,3 +25,3 @@ /**

create: context => ({
JSXOpeningElement: node => {
JSXOpeningElement: (node) => {
const isMarquee = elementType(node) === 'marquee';

@@ -28,0 +28,0 @@

@@ -31,3 +31,3 @@ /**

create: context => ({
JSXOpeningElement: node => {
JSXOpeningElement: (node) => {
const nodeType = elementType(node);

@@ -34,0 +34,0 @@

@@ -27,3 +27,3 @@ /**

create: context => ({
JSXOpeningElement: node => {
JSXOpeningElement: (node) => {
const props = node.attributes;

@@ -30,0 +30,0 @@ const type = elementType(node);

@@ -29,3 +29,3 @@ /**

create: context => ({
JSXOpeningElement: node => {
JSXOpeningElement: (node) => {
const { attributes } = node;

@@ -32,0 +32,0 @@ if (getProp(attributes, 'onClick') === undefined) {

@@ -28,3 +28,3 @@ /**

create: context => ({
JSXOpeningElement: node => {
JSXOpeningElement: (node) => {
const attributes = node.attributes;

@@ -31,0 +31,0 @@ if (getProp(attributes, 'onclick') === undefined) {

@@ -28,3 +28,3 @@ /**

create: context => ({
JSXAttribute: attribute => {
JSXAttribute: (attribute) => {
const name = propName(attribute);

@@ -50,3 +50,3 @@ const normalizedName = name ? name.toUpperCase() : '';

validRoles.forEach(role => {
validRoles.forEach((role) => {
const { requiredProps } = validRoleTypes[role];

@@ -53,0 +53,0 @@

@@ -35,3 +35,3 @@ /**

create: context => ({
JSXOpeningElement: node => {
JSXOpeningElement: (node) => {
// If role is not explicitly defined, then try and get its implicit role.

@@ -55,3 +55,3 @@ const type = elementType(node);

node.attributes.forEach(prop => {
node.attributes.forEach((prop) => {
if (prop.type === 'JSXSpreadAttribute') {

@@ -58,0 +58,0 @@ return;

@@ -25,3 +25,3 @@ /**

create: context => ({
JSXAttribute: node => {
JSXAttribute: (node) => {
const name = propName(node);

@@ -28,0 +28,0 @@ if (name && name.toUpperCase() !== 'SCOPE') {

@@ -24,3 +24,3 @@ /**

create: context => ({
JSXAttribute: attribute => {
JSXAttribute: (attribute) => {
const name = propName(attribute);

@@ -27,0 +27,0 @@ const normalizedName = name ? name.toUpperCase() : '';

@@ -7,3 +7,3 @@ import { getProp, getPropValue, getLiteralPropValue } from 'jsx-ast-utils';

const interactiveMap = {
a: attributes => {
a: (attributes) => {
const href = getPropValue(getProp(attributes, 'href'));

@@ -16,3 +16,3 @@ const tabIndex = getTabIndex(getProp(attributes, 'tabIndex'));

button: () => true,
input: attributes => {
input: (attributes) => {
const typeAttr = getLiteralPropValue(getProp(attributes, 'type'));

@@ -19,0 +19,0 @@ return typeAttr ? typeAttr.toUpperCase() !== 'HIDDEN' : true;

@@ -12,3 +12,3 @@ /* eslint-env mocha */

describe('all rule files should be exported by the plugin', () => {
rules.forEach(ruleName => {
rules.forEach((ruleName) => {
it(`should export ${ruleName}`, () => {

@@ -15,0 +15,0 @@ assert.equal(

@@ -40,2 +40,3 @@ /**

{ code: '<a dangerouslySetInnerHTML={{ __html: "foo" }} />', parserOptions },
{ code: '<a children={children} />', parserOptions },
],

@@ -42,0 +43,0 @@ invalid: [

@@ -28,3 +28,3 @@ /**

const errorMessage = name => {
const errorMessage = (name) => {
const dictionary = Object.keys(ariaAttributes).map(aria => aria.toLowerCase());

@@ -31,0 +31,0 @@ const suggestions = getSuggestion(name, dictionary);

@@ -27,3 +27,3 @@ /**

const errorMessage = name => {
const errorMessage = (name) => {
const { type, values: permittedValues } = ariaAttributes[name.toUpperCase()];

@@ -30,0 +30,0 @@

@@ -42,3 +42,3 @@ /**

const validTests = createTests(validRoles);
const invalidTests = createTests(invalidRoles).map(test => {
const invalidTests = createTests(invalidRoles).map((test) => {
const invalidTest = assign({}, test);

@@ -45,0 +45,0 @@ invalidTest.errors = [errorMessage];

@@ -35,3 +35,3 @@ /**

// Generate valid test cases
const roleValidityTests = Object.keys(DOM).map(element => {
const roleValidityTests = Object.keys(DOM).map((element) => {
const isReserved = DOM[element].reserved || false;

@@ -46,3 +46,3 @@ const role = isReserved ? '' : 'role';

const ariaValidityTests = Object.keys(DOM).map(element => {
const ariaValidityTests = Object.keys(DOM).map((element) => {
const isReserved = DOM[element].reserved || false;

@@ -49,0 +49,0 @@ const aria = isReserved ? '' : 'aria-hidden';

@@ -45,2 +45,3 @@ /**

{ code: '<h1 dangerouslySetInnerHTML={{ __html: "foo" }} />', parserOptions },
{ code: '<h1 children={children} />', parserOptions },
],

@@ -47,0 +48,0 @@ invalid: [

@@ -28,3 +28,3 @@ /**

const errorMessage = role => {
const errorMessage = (role) => {
const requiredProps = validRoleTypes[role.toUpperCase()].requiredProps.toString().toLowerCase();

@@ -41,3 +41,3 @@

// Create basic test cases using all valid role types.
const basicValidityTests = Object.keys(validRoleTypes).map(role => {
const basicValidityTests = Object.keys(validRoleTypes).map((role) => {
const { requiredProps } = validRoleTypes[role];

@@ -44,0 +44,0 @@ const propChain = requiredProps.join(' ').toLowerCase();

@@ -34,3 +34,3 @@ /* eslint-env mocha */

const dictionary = ['there', 'their', 'foo', 'bar'];
const expected = ['their', 'there'];
const expected = ['there', 'their'];
const actual = getSuggestion(word, dictionary);

@@ -37,0 +37,0 @@

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc