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 1.4.1 to 1.4.2

5

CHANGELOG.md

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

1.4.2 / 2016-06-10
==================
- [new] Integrate with latest `jsx-ast-utils` to use `propName` function. More support for namespaced names on attributes and elements.
1.4.1 / 2016-06-10

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

24

lib/rules/aria-props.js

@@ -11,13 +11,6 @@ 'use strict';

var _jsxAstUtils = require('jsx-ast-utils');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* @fileoverview Enforce all aria-* properties are valid.
* @author Ethan Cohen
*/
// ----------------------------------------------------------------------------
// Rule Definition
// ----------------------------------------------------------------------------
var errorMessage = function errorMessage(name) {

@@ -35,9 +28,16 @@ var dictionary = Object.keys(_ARIA2.default).map(function (aria) {

return message;
};
}; /**
* @fileoverview Enforce all aria-* properties are valid.
* @author Ethan Cohen
*/
// ----------------------------------------------------------------------------
// Rule Definition
// ----------------------------------------------------------------------------
module.exports = function (context) {
return {
JSXAttribute: function JSXAttribute(attribute) {
var name = attribute.name.name;
var normalizedName = name.toUpperCase();
var name = (0, _jsxAstUtils.propName)(attribute);
var normalizedName = name ? name.toUpperCase() : '';

@@ -44,0 +44,0 @@ // `aria` needs to be prefix of property.

@@ -63,4 +63,4 @@ 'use strict';

JSXAttribute: function JSXAttribute(attribute) {
var name = attribute.name.name;
var normalizedName = name.toUpperCase();
var name = (0, _jsxAstUtils.propName)(attribute);
var normalizedName = name ? name.toUpperCase() : '';

@@ -67,0 +67,0 @@ // Not a valid aria-* state or property.

@@ -25,3 +25,5 @@ 'use strict';

JSXAttribute: function JSXAttribute(attribute) {
var normalizedName = attribute.name.name.toUpperCase();
var name = (0, _jsxAstUtils.propName)(attribute);
var normalizedName = name ? name.toUpperCase() : '';
if (normalizedName !== 'ROLE') {

@@ -28,0 +30,0 @@ return;

@@ -46,6 +46,9 @@ 'use strict';

if (invalidAttributes.indexOf(prop.name.name.toUpperCase()) > -1) {
var name = (0, _jsxAstUtils.propName)(prop);
var normalizedName = name ? name.toUpperCase() : '';
if (invalidAttributes.indexOf(normalizedName) > -1) {
context.report({
node: node,
message: errorMessage(prop.name.name)
message: errorMessage(name)
});

@@ -52,0 +55,0 @@ }

@@ -28,3 +28,5 @@ 'use strict';

JSXAttribute: function JSXAttribute(attribute) {
var normalizedName = attribute.name.name.toUpperCase();
var name = (0, _jsxAstUtils.propName)(attribute);
var normalizedName = name ? name.toUpperCase() : '';
if (normalizedName !== 'ROLE') {

@@ -31,0 +33,0 @@ return;

@@ -64,6 +64,9 @@ 'use strict';

if (invalidAriaPropsForRole.indexOf(prop.name.name.toUpperCase()) > -1) {
var name = (0, _jsxAstUtils.propName)(prop);
var normalizedName = name ? name.toUpperCase() : '';
if (invalidAriaPropsForRole.indexOf(normalizedName) > -1) {
context.report({
node: node,
message: errorMessage(prop.name.name, roleValue, type, isImplicit)
message: errorMessage(name, roleValue, type, isImplicit)
});

@@ -70,0 +73,0 @@ }

@@ -17,4 +17,4 @@ 'use strict';

JSXAttribute: function JSXAttribute(attribute) {
var name = attribute.name.name;
var normalizedName = name.toUpperCase();
var name = (0, _jsxAstUtils.propName)(attribute);
var normalizedName = name ? name.toUpperCase() : '';

@@ -21,0 +21,0 @@ // Check if tabIndex is the attribute

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

@@ -5,0 +5,0 @@ "keywords": [

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

import getSuggestion from '../util/getSuggestion';
import { propName } from 'jsx-ast-utils';

@@ -28,4 +29,4 @@ const errorMessage = name => {

JSXAttribute: attribute => {
const name = attribute.name.name;
const normalizedName = name.toUpperCase();
const name = propName(attribute);
const normalizedName = name ? name.toUpperCase() : '';

@@ -32,0 +33,0 @@ // `aria` needs to be prefix of property.

@@ -11,3 +11,3 @@ /**

import ariaAttributes from '../util/attributes/ARIA';
import { getLiteralPropValue } from 'jsx-ast-utils';
import { getLiteralPropValue, propName } from 'jsx-ast-utils';

@@ -56,4 +56,4 @@ const errorMessage = (name, type, permittedValues) => {

JSXAttribute: attribute => {
const name = attribute.name.name;
const normalizedName = name.toUpperCase();
const name = propName(attribute);
const normalizedName = name ? name.toUpperCase() : '';

@@ -60,0 +60,0 @@ // Not a valid aria-* state or property.

@@ -11,3 +11,3 @@ /**

import roles from '../util/attributes/role';
import { getLiteralPropValue } from 'jsx-ast-utils';
import { getLiteralPropValue, propName } from 'jsx-ast-utils';

@@ -18,3 +18,5 @@ const errorMessage = 'Elements with ARIA roles must use a valid, non-abstract ARIA role.';

JSXAttribute: attribute => {
const normalizedName = attribute.name.name.toUpperCase();
const name = propName(attribute);
const normalizedName = name ? name.toUpperCase() : '';
if (normalizedName !== 'ROLE') {

@@ -21,0 +23,0 @@ return;

@@ -13,3 +13,3 @@ /**

import ARIA from '../util/attributes/ARIA';
import { elementType } from 'jsx-ast-utils';
import { elementType, propName } from 'jsx-ast-utils';

@@ -38,6 +38,9 @@ const errorMessage = invalidProp =>

if (invalidAttributes.indexOf(prop.name.name.toUpperCase()) > -1) {
const name = propName(prop);
const normalizedName = name ? name.toUpperCase() : '';
if (invalidAttributes.indexOf(normalizedName) > -1) {
context.report({
node,
message: errorMessage(prop.name.name),
message: errorMessage(name),
});

@@ -44,0 +47,0 @@ }

@@ -12,3 +12,3 @@ /**

import validRoleTypes from '../util/attributes/role';
import { getProp, getLiteralPropValue } from 'jsx-ast-utils';
import { getProp, getLiteralPropValue, propName } from 'jsx-ast-utils';

@@ -22,3 +22,5 @@

JSXAttribute: attribute => {
const normalizedName = attribute.name.name.toUpperCase();
const name = propName(attribute);
const normalizedName = name ? name.toUpperCase() : '';
if (normalizedName !== 'ROLE') {

@@ -25,0 +27,0 @@ return;

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

import getImplicitRole from '../util/getImplicitRole';
import { getProp, getLiteralPropValue, elementType } from 'jsx-ast-utils';
import { getProp, getLiteralPropValue, elementType, propName } from 'jsx-ast-utils';

@@ -51,6 +51,9 @@ const errorMessage = (attr, role, tag, isImplicit) => {

if (invalidAriaPropsForRole.indexOf(prop.name.name.toUpperCase()) > -1) {
const name = propName(prop);
const normalizedName = name ? name.toUpperCase() : '';
if (invalidAriaPropsForRole.indexOf(normalizedName) > -1) {
context.report({
node,
message: errorMessage(prop.name.name, roleValue, type, isImplicit),
message: errorMessage(name, roleValue, type, isImplicit),
});

@@ -57,0 +60,0 @@ }

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

import { getLiteralPropValue } from 'jsx-ast-utils';
import { getLiteralPropValue, propName } from 'jsx-ast-utils';

@@ -17,4 +17,4 @@ const errorMessage = 'Avoid positive integer values for tabIndex.';

JSXAttribute: attribute => {
const name = attribute.name.name;
const normalizedName = name.toUpperCase();
const name = propName(attribute);
const normalizedName = name ? name.toUpperCase() : '';

@@ -21,0 +21,0 @@ // Check if tabIndex is the attribute

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