Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

eslint-plugin-jsx-a11y

Package Overview
Dependencies
Maintainers
1
Versions
84
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 0.4.1 to 0.4.2

lib/util/getNodeType.js

6

lib/rules/img-uses-alt.js

@@ -15,2 +15,6 @@ /**

var _getNodeType = require('../util/getNodeType');
var _getNodeType2 = _interopRequireDefault(_getNodeType);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -26,3 +30,3 @@

var typeCheck = ['img'].concat(context.options[0]);
var nodeType = node.name.name;
var nodeType = (0, _getNodeType2.default)(node);

@@ -29,0 +33,0 @@ // Only check 'img' elements and custom types.

@@ -15,2 +15,6 @@ /**

var _getNodeType = require('../util/getNodeType');
var _getNodeType2 = _interopRequireDefault(_getNodeType);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -24,3 +28,3 @@

var typeCheck = ['label'].concat(context.options[0]);
var nodeType = node.name.name;
var nodeType = (0, _getNodeType2.default)(node);

@@ -27,0 +31,0 @@ // Only check 'label' elements and custom types.

@@ -15,2 +15,6 @@ /**

var _getNodeType = require('../util/getNodeType');
var _getNodeType2 = _interopRequireDefault(_getNodeType);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -24,3 +28,3 @@

var typeCheck = ['a'].concat(context.options[0]);
var nodeType = node.name.name;
var nodeType = (0, _getNodeType2.default)(node);

@@ -27,0 +31,0 @@ // Only check 'a' elements and custom types.

@@ -20,2 +20,6 @@ /**

var _getNodeType = require('../util/getNodeType');
var _getNodeType2 = _interopRequireDefault(_getNodeType);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -38,3 +42,3 @@

var isVisible = (0, _isHiddenFromScreenReader2.default)(attributes) === false;
var isNonInteractive = (0, _isInteractiveElement2.default)(node.name.name, attributes) === false;
var isNonInteractive = (0, _isInteractiveElement2.default)((0, _getNodeType2.default)(node), attributes) === false;
var noRoleAttribute = (0, _hasAttribute2.default)(attributes, 'role') === false;

@@ -41,0 +45,0 @@

@@ -19,2 +19,6 @@ /**

var _getNodeType = require('../util/getNodeType');
var _getNodeType2 = _interopRequireDefault(_getNodeType);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -29,3 +33,3 @@

JSXOpeningElement: function JSXOpeningElement(node) {
var type = node.name.name;
var type = (0, _getNodeType2.default)(node);
if (type !== 'img') {

@@ -32,0 +36,0 @@ return;

4

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

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

"coveralls": "^2.11.8",
"eslint": "^2.2.0",
"eslint": "2.2.x",
"istanbul": "^1.0.0-alpha.2",

@@ -36,0 +36,0 @@ "mocha": "^2.4.5",

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

import hasAttribute from '../util/hasAttribute';
import getNodeType from '../util/getNodeType';

@@ -19,3 +20,3 @@ const errorMessage = type => `${type} elements must have an alt tag.`;

const typeCheck = [ 'img' ].concat(context.options[0]);
const nodeType = node.name.name;
const nodeType = getNodeType(node);

@@ -22,0 +23,0 @@ // Only check 'img' elements and custom types.

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

import hasAttribute from '../util/hasAttribute';
import getNodeType from '../util/getNodeType';

@@ -20,3 +21,3 @@ const errorMessage = 'Form controls using a label to identify them must be ' +

const typeCheck = [ 'label' ].concat(context.options[0]);
const nodeType = node.name.name;
const nodeType = getNodeType(node);

@@ -23,0 +24,0 @@ // Only check 'label' elements and custom types.

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

import hasAttribute from '../util/hasAttribute';
import getNodeType from '../util/getNodeType';

@@ -19,3 +20,3 @@ const errorMessage = 'Links must not point to "#". Use a more descriptive href or use a button instead.';

const typeCheck = [ 'a' ].concat(context.options[0]);
const nodeType = node.name.name;
const nodeType = getNodeType(node);

@@ -22,0 +23,0 @@ // Only check 'a' elements and custom types.

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

import hasAttribute from '../util/hasAttribute';
import getNodeType from '../util/getNodeType';

@@ -28,3 +29,3 @@ // ----------------------------------------------------------------------------

const isVisible = isHiddenFromScreenReader(attributes) === false;
const isNonInteractive = isInteractiveElement(node.name.name, attributes) === false;
const isNonInteractive = isInteractiveElement(getNodeType(node), attributes) === false;
const noRoleAttribute = hasAttribute(attributes, 'role') === false;

@@ -31,0 +32,0 @@

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

import isHiddenFromScreenReader from '../util/isHiddenFromScreenReader';
import getNodeType from '../util/getNodeType';

@@ -26,3 +27,3 @@ const REDUNDANT_WORDS = [

JSXOpeningElement: node => {
const type = node.name.name;
const type = getNodeType(node);
if (type !== 'img') {

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

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

{ code: '<IMG />', parserOptions },
{ code: '<UX.Layout>test</UX.Layout>', parserOptions },

@@ -59,0 +60,0 @@ // CUSTOM ELEMENT TESTS FOR STRING OPTION

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

{ code: '<Label htmlFor="foo" />', parserOptions },
{ code: '<UX.Layout>test</UX.Layout>', parserOptions },

@@ -50,0 +51,0 @@ // CUSTOM ELEMENT STRING OPTION TESTS

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

{ code: '<a href="#foo" />', parserOptions },
{ code: '<UX.Layout>test</UX.Layout>', parserOptions },

@@ -53,0 +54,0 @@ // CUSTOM ELEMENT TEST FOR STRING OPTION

@@ -57,3 +57,4 @@ /**

{ code: '<img alt={function(e){}} />', parserOptions },
{ code: '<img aria-hidden={false} alt="Doing cool things." />', parserOptions }
{ code: '<img aria-hidden={false} alt="Doing cool things." />', parserOptions },
{ code: '<UX.Layout>test</UX.Layout>', parserOptions }
],

@@ -60,0 +61,0 @@ invalid: [

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