Skip to content

Commit 0524b76

Browse files
authored
Merge branch 'master' into fix-lang-rule
2 parents 5e82b09 + 13c6cc3 commit 0524b76

15 files changed

+60
-51
lines changed

.travis.yml

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
language: node_js
22
node_js:
3+
- "14"
34
- "12"
45
- "10"
5-
- "9"
66
- "8"
7-
- "7"
87
- "6"
9-
- "5"
108
- "4"
119
cache:
1210
yarn: true
@@ -29,6 +27,7 @@ env:
2927
global:
3028
- TEST=true
3129
matrix:
30+
- ESLINT=7
3231
- ESLINT=6
3332
- ESLINT=5
3433
- ESLINT=4
@@ -45,19 +44,15 @@ matrix:
4544
env: ESLINT=5
4645
- node_js: "4"
4746
env: ESLINT=6
48-
- node_js: "5"
49-
env: ESLINT=5
47+
- node_js: "4"
48+
env: ESLINT=7
5049
- node_js: "6"
5150
env: ESLINT=6
51+
- node_js: "6"
52+
env: ESLINT=7
53+
- node_js: "8"
54+
env: ESLINT=7
5255
allow_failures:
53-
- node_js: "7"
54-
env: ESLINT=6
55-
- node_js: "5"
56-
env: ESLINT=6
57-
- node_js: "5"
58-
env: ESLINT=4
59-
- node_js: "5"
60-
env: ESLINT=3
6156
- node_js: "4"
6257
env: ESLINT=4
6358
- node_js: "4"

__tests__/src/rules/alt-text-test.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ const array = [{
5050
'input[type="image"]': ['InputImage'],
5151
}];
5252

53-
5453
ruleTester.run('alt-text', rule, {
5554
valid: [
5655
// DEFAULT ELEMENT 'img' TESTS

__tests__/src/rules/label-has-for-test.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ const expectedEveryError = {
3434
type: 'JSXOpeningElement',
3535
};
3636

37-
3837
const optionsComponents = [{
3938
components: ['Label', 'Descriptor'],
4039
}];

__tests__/src/rules/mouse-events-have-key-events-test.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,21 @@ ruleTester.run('mouse-events-have-key-events', rule, {
3939
code: '<div onMouseOver={handleMouseOver} onFocus={handleFocus} {...props} />;',
4040
},
4141
{ code: '<div />;' },
42+
{ code: '<div onBlur={() => {}} />' },
43+
{ code: '<div onFocus={() => {}} />' },
4244
{ code: '<div onMouseOut={() => void 0} onBlur={() => void 0} />' },
4345
{ code: '<div onMouseOut={() => void 0} onBlur={() => void 0} {...props} />' },
4446
{ code: '<div onMouseOut={handleMouseOut} onBlur={handleOnBlur} />' },
4547
{ code: '<div onMouseOut={handleMouseOut} onBlur={handleOnBlur} {...props} />' },
48+
{ code: '<MyElement />' },
49+
{ code: '<MyElement onMouseOver={() => {}} />' },
50+
{ code: '<MyElement onMouseOut={() => {}} />' },
51+
{ code: '<MyElement onBlur={() => {}} />' },
52+
{ code: '<MyElement onFocus={() => {}} />' },
53+
{ code: '<MyElement onMouseOver={() => {}} {...props} />' },
54+
{ code: '<MyElement onMouseOut={() => {}} {...props} />' },
55+
{ code: '<MyElement onBlur={() => {}} {...props} />' },
56+
{ code: '<MyElement onFocus={() => {}} {...props} />' },
4657
].map(parserOptionsMapper),
4758
invalid: [
4859
{ code: '<div onMouseOver={() => void 0} />;', errors: [mouseOverError] },

__tests__/src/rules/no-onchange-test.js

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

7-
87
// -----------------------------------------------------------------------------
98
// Requirements
109
// -----------------------------------------------------------------------------

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ const errorMessage = (role) => {
2929
};
3030
};
3131

32-
3332
// Create basic test cases using all valid role types.
3433
const basicValidityTests = [...roles.keys()].map((role) => {
3534
const {

__tests__/src/util/hasAccessibleChild-test.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ describe('hasAccessibleChild', () => {
1111
});
1212
});
1313

14-
1514
describe('has no children and sets dangerouslySetInnerHTML', () => {
1615
it('Returns true', () => {
1716
const prop = JSXAttributeMock('dangerouslySetInnerHTML', true);

package.json

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -30,48 +30,48 @@
3030
"jest": "jest --coverage __tests__/**/*"
3131
},
3232
"devDependencies": {
33-
"@babel/cli": "^7.4.4",
34-
"@babel/core": "^7.0.0",
35-
"@babel/plugin-transform-flow-strip-types": "^7.2.3",
36-
"babel-eslint": "^10.0.1",
37-
"babel-jest": "^24.0.0",
38-
"babel-preset-airbnb": "^4.0.0",
39-
"coveralls": "^3.0.1",
40-
"eslint": "^3 || ^4 || ^5 || ^6",
41-
"eslint-config-airbnb-base": "^14.0.0",
42-
"eslint-plugin-flowtype": "^4.5.2",
43-
"eslint-plugin-import": "^2.18.0",
44-
"estraverse": "^4.2.0",
33+
"@babel/cli": "^7.10.1",
34+
"@babel/core": "^7.10.2",
35+
"@babel/plugin-transform-flow-strip-types": "^7.10.1",
36+
"babel-eslint": "^10.1.0",
37+
"babel-jest": "^24.9.0",
38+
"babel-preset-airbnb": "^5.0.0",
39+
"coveralls": "^3.1.0",
40+
"eslint": "^3 || ^4 || ^5 || ^6 || ^7",
41+
"eslint-config-airbnb-base": "^14.2.0",
42+
"eslint-plugin-flowtype": "^5.1.3",
43+
"eslint-plugin-import": "^2.21.2",
44+
"estraverse": "^4.3.0",
4545
"expect": "^24.3.1",
46-
"flow-bin": "^0.112.0",
47-
"in-publish": "^2.0.0",
48-
"jest": "^24.0.0",
46+
"flow-bin": "^0.113.0",
47+
"in-publish": "^2.0.1",
48+
"jest": "^24.9.0",
4949
"jscodeshift": "^0.6.0",
50-
"minimist": "^1.2.0",
50+
"minimist": "^1.2.5",
5151
"object.assign": "^4.1.0",
52-
"rimraf": "^3.0.0",
53-
"safe-publish-latest": "^1.1.1",
52+
"rimraf": "^3.0.2",
53+
"safe-publish-latest": "^1.1.4",
5454
"to-ast": "^1.0.0"
5555
},
5656
"engines": {
5757
"node": ">=4.0"
5858
},
5959
"license": "MIT",
6060
"dependencies": {
61-
"@babel/runtime": "^7.4.5",
62-
"aria-query": "^4.0.1",
63-
"array-includes": "^3.0.3",
61+
"@babel/runtime": "^7.10.2",
62+
"aria-query": "^4.0.2",
63+
"array-includes": "^3.1.1",
6464
"ast-types-flow": "^0.0.7",
65-
"axe-core": "^3.5.2",
66-
"axobject-query": "^2.1.1",
67-
"damerau-levenshtein": "^1.0.4",
68-
"emoji-regex": "^7.0.2",
65+
"axe-core": "^3.5.4",
66+
"axobject-query": "^2.1.2",
67+
"damerau-levenshtein": "^1.0.6",
68+
"emoji-regex": "^9.0.0",
6969
"has": "^1.0.3",
70-
"jsx-ast-utils": "^2.2.1",
70+
"jsx-ast-utils": "^2.4.1"
7171
"language-tags": "^1.0.5"
7272
},
7373
"peerDependencies": {
74-
"eslint": "^3 || ^4 || ^5 || ^6"
74+
"eslint": "^3 || ^4 || ^5 || ^6 || ^7"
7575
},
7676
"jest": {
7777
"coverageReporters": [

src/rules/alt-text.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,6 @@ module.exports = {
218218
return type;
219219
}));
220220

221-
222221
return {
223222
JSXOpeningElement: (node) => {
224223
const nodeType = elementType(node);

src/rules/anchor-has-content.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import { elementType } from 'jsx-ast-utils';
1111
import { arraySchema, generateObjSchema } from '../util/schemas';
1212
import hasAccessibleChild from '../util/hasAccessibleChild';
1313

14-
1514
const errorMessage = 'Anchors must have content and the content must be accessible by a screen reader.';
1615

1716
const schema = generateObjSchema({ components: arraySchema });

src/rules/img-redundant-alt.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,7 @@ module.exports = {
5959
const redundantWords = REDUNDANT_WORDS.concat(words);
6060

6161
if (typeof value === 'string' && isVisible) {
62-
const hasRedundancy = redundantWords
63-
.some((word) => Boolean(value.match(new RegExp(`(?!{)\\b${word}\\b(?!})`, 'i'))));
62+
const hasRedundancy = new RegExp(`(?!{)\\b(${redundantWords.join('|')})\\b(?!})`, 'i').test(value);
6463

6564
if (hasRedundancy === true) {
6665
context.report({

src/rules/mouse-events-have-key-events.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
// Rule Definition
99
// ----------------------------------------------------------------------------
1010

11+
import { dom } from 'aria-query';
1112
import { getProp, getPropValue } from 'jsx-ast-utils';
1213
import { generateObjSchema } from '../util/schemas';
1314

@@ -26,6 +27,12 @@ module.exports = {
2627

2728
create: (context) => ({
2829
JSXOpeningElement: (node) => {
30+
const { name } = node.name;
31+
32+
if (!dom.get(name)) {
33+
return;
34+
}
35+
2936
const { attributes } = node;
3037

3138
// Check onmouseover / onfocus pairing.

src/rules/no-distracting-elements.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ const errorMessage = (element) => (
1414
`Do not use <${element}> elements as they can create visual accessibility issues and are deprecated.`
1515
);
1616

17-
1817
const DEFAULT_ELEMENTS = [
1918
'marquee',
2019
'blink',

src/rules/no-noninteractive-tabindex.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ module.exports = {
5858
}
5959
const role = getLiteralPropValue(getProp(node.attributes, 'role'));
6060

61-
6261
if (!dom.has(type)) {
6362
// Do not test higher level JSX components, as we do not know what
6463
// low-level DOM element this maps to.

src/util/isNonInteractiveElement.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ const nonInteractiveRoles = new Set(roleKeys
2626
// 'toolbar' does not descend from widget, but it does support
2727
// aria-activedescendant, thus in practice we treat it as a widget.
2828
&& name !== 'toolbar'
29+
// This role is meant to have no semantic value.
30+
// @see https://www.w3.org/TR/wai-aria-1.2/#generic
31+
&& name !== 'generic'
2932
&& !role.superClass.some((classes) => includes(classes, 'widget'))
3033
);
3134
}).concat(
@@ -42,6 +45,9 @@ const interactiveRoles = new Set(roleKeys
4245
// The `progressbar` is descended from `widget`, but in practice, its
4346
// value is always `readonly`, so we treat it as a non-interactive role.
4447
&& name !== 'progressbar'
48+
// This role is meant to have no semantic value.
49+
// @see https://www.w3.org/TR/wai-aria-1.2/#generic
50+
&& name !== 'generic'
4551
&& role.superClass.some((classes) => includes(classes, 'widget'))
4652
);
4753
}).concat(

0 commit comments

Comments
 (0)