Skip to content

Commit b7fabe6

Browse files
committed
[lint] - Fix all new linting errors.
1 parent 517d131 commit b7fabe6

34 files changed

+44
-45
lines changed

src/rules/aria-props.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
// Rule Definition
88
// ----------------------------------------------------------------------------
99

10+
import { propName } from 'jsx-ast-utils';
1011
import ariaAttributes from '../util/attributes/ARIA';
1112
import getSuggestion from '../util/getSuggestion';
12-
import { propName } from 'jsx-ast-utils';
1313

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

src/rules/aria-proptypes.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
// Rule Definition
88
// ----------------------------------------------------------------------------
99

10-
import ariaAttributes from '../util/attributes/ARIA';
1110
import { getLiteralPropValue, propName } from 'jsx-ast-utils';
11+
import ariaAttributes from '../util/attributes/ARIA';
1212

1313
const errorMessage = (name, type, permittedValues) => {
1414
switch (type) {

src/rules/aria-role.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
// Rule Definition
88
// ----------------------------------------------------------------------------
99

10-
import roles from '../util/attributes/role';
1110
import { getLiteralPropValue, propName } from 'jsx-ast-utils';
11+
import roles from '../util/attributes/role';
1212

1313
const errorMessage = 'Elements with ARIA roles must use a valid, non-abstract ARIA role.';
1414

src/rules/aria-unsupported-elements.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
// Rule Definition
99
// ----------------------------------------------------------------------------
1010

11+
import { elementType, propName } from 'jsx-ast-utils';
1112
import DOM from '../util/attributes/DOM';
1213
import ARIA from '../util/attributes/ARIA';
13-
import { elementType, propName } from 'jsx-ast-utils';
1414

1515
const errorMessage = invalidProp =>
1616
`This element does not support ARIA roles, states and properties. \
@@ -28,8 +28,10 @@ module.exports = {
2828
create: context => ({
2929
JSXOpeningElement: node => {
3030
const nodeType = elementType(node);
31-
const nodeAttrs = DOM[nodeType];
32-
const isReservedNodeType = nodeAttrs && nodeAttrs.reserved || false;
31+
const nodeAttrs = DOM[nodeType] || {};
32+
const {
33+
reserved: isReservedNodeType = false,
34+
} = nodeAttrs;
3335

3436
// If it's not reserved, then it can have ARIA-* roles, states, and properties
3537
if (isReservedNodeType === false) {

src/rules/onclick-has-focus.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
* @author Ethan Cohen
44
*/
55

6+
import { getProp, elementType } from 'jsx-ast-utils';
67
import isHiddenFromScreenReader from '../util/isHiddenFromScreenReader';
78
import isInteractiveElement from '../util/isInteractiveElement';
8-
import { getProp, elementType } from 'jsx-ast-utils';
99
import getTabIndex from '../util/getTabIndex';
1010

1111
// ----------------------------------------------------------------------------

src/rules/onclick-has-role.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
* @author Ethan Cohen
55
*/
66

7+
import { getProp, getPropValue, elementType } from 'jsx-ast-utils';
78
import isHiddenFromScreenReader from '../util/isHiddenFromScreenReader';
89
import isInteractiveElement from '../util/isInteractiveElement';
9-
import { getProp, getPropValue, elementType } from 'jsx-ast-utils';
1010

1111
// ----------------------------------------------------------------------------
1212
// Rule Definition

src/rules/role-has-required-aria-props.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,8 @@
88
// Rule Definition
99
// ----------------------------------------------------------------------------
1010

11-
import validRoleTypes from '../util/attributes/role';
1211
import { getProp, getLiteralPropValue, propName } from 'jsx-ast-utils';
13-
12+
import validRoleTypes from '../util/attributes/role';
1413

1514
const errorMessage = (role, requiredProps) =>
1615
`Elements with the ARIA role "${role}" must have the following ` +

src/rules/role-supports-aria-props.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@
88
// Rule Definition
99
// ----------------------------------------------------------------------------
1010

11+
import { getProp, getLiteralPropValue, elementType, propName } from 'jsx-ast-utils';
1112
import ROLES from '../util/attributes/role';
1213
import ARIA from '../util/attributes/ARIA';
1314
import getImplicitRole from '../util/getImplicitRole';
14-
import { getProp, getLiteralPropValue, elementType, propName } from 'jsx-ast-utils';
1515

1616
const errorMessage = (attr, role, tag, isImplicit) => {
1717
if (isImplicit) {

src/util/isInteractiveElement.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ const isInteractiveElement = (tagName, attributes) => {
3434
return true;
3535
}
3636

37-
if (interactiveMap.hasOwnProperty(tagName) === false) {
37+
if ({}.hasOwnProperty.call(interactiveMap, tagName) === false) {
3838
return false;
3939
}
4040

tests/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
/* eslint-env mocha */
2-
import plugin from '../src';
32

43
import assert from 'assert';
54
import fs from 'fs';
65
import path from 'path';
6+
import plugin from '../src';
77

88
const rules = fs.readdirSync(path.resolve(__dirname, '../src/rules/'))
99
.map(f => path.basename(f, '.js'));

0 commit comments

Comments
 (0)