Skip to content

Commit d367ea5

Browse files
nschonnimcking65
authored andcommitted
Infrastructure: Add eslint rules from eslint:recommended config (pull #1207)
Perdiscussion in issue #1180, ad the eslint:recommended shareable config to eslint. Then fix errors. * chore: switch to eslint:recommended * chore: eslint fix with new config * fix: no-const-assign * fix: no-empty * fix: no-useless-escape * fix: no-duplicate-case * fix: no-constant-condition * fix: no-unsafe-negation * chore: ignore no-cond-assign * fix: no-redeclare * Option collides with built-in type * fix: no-prototype-builtins * chore: ignore currently failing rules
1 parent 422ca61 commit d367ea5

29 files changed

+325
-406
lines changed

.eslintrc.json

Lines changed: 7 additions & 105 deletions
Original file line numberDiff line numberDiff line change
@@ -1,109 +1,11 @@
11
{
2+
"extends": "eslint:recommended",
3+
"env": {
4+
"browser": true
5+
},
26
"rules": {
3-
"no-with": 2,
4-
"no-mixed-spaces-and-tabs": 2,
5-
"no-multiple-empty-lines": 2,
6-
"no-multi-spaces": 0,
7-
"operator-linebreak": [
8-
2,
9-
"after"
10-
],
11-
"quote-props": 0,
12-
"key-spacing": [
13-
2,
14-
{
15-
"afterColon": true
16-
}
17-
],
18-
"space-unary-ops": [
19-
2,
20-
{
21-
"words": false,
22-
"nonwords": false
23-
}
24-
],
25-
"no-spaced-func": 2,
26-
"array-bracket-spacing": [
27-
2,
28-
"never",
29-
{
30-
"singleValue": true
31-
}
32-
],
33-
"space-in-parens": [
34-
2,
35-
"never"
36-
],
37-
"comma-dangle": [
38-
2,
39-
"never"
40-
],
41-
"no-trailing-spaces": 2,
42-
"yoda": [
43-
2,
44-
"never"
45-
],
46-
"camelcase": [
47-
2,
48-
{
49-
"properties": "always"
50-
}
51-
],
52-
"comma-style": [
53-
2,
54-
"last"
55-
],
56-
"curly": [
57-
2,
58-
"all"
59-
],
60-
"dot-notation": 2,
61-
"brace-style": [
62-
2,
63-
"stroustrup",
64-
{
65-
"allowSingleLine": true
66-
}
67-
],
68-
"eol-last": 2,
69-
"wrap-iife": 2,
70-
"semi": [
71-
2,
72-
"always"
73-
],
74-
"space-infix-ops": 2,
75-
"keyword-spacing": [
76-
2,
77-
{}
78-
],
79-
"spaced-comment": [
80-
2,
81-
"always"
82-
],
83-
"space-before-blocks": [
84-
2,
85-
"always"
86-
],
87-
"space-before-function-paren": [
88-
2,
89-
"always"
90-
],
91-
"consistent-this": [
92-
2,
93-
"self"
94-
],
95-
"indent": [
96-
2,
97-
2,
98-
{
99-
"SwitchCase": 1
100-
}
101-
],
102-
"quotes": [
103-
2,
104-
"single"
105-
],
106-
"no-eval": "error",
107-
"no-implied-eval": "error"
7+
"no-unused-vars": 0,
8+
"no-undef": 0,
9+
"no-fallthrough": 0
10810
}
10911
}

examples/combobox/aria1.0pattern/js/listbox.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ var Listbox = function (domNode, comboboxObj) {
77
msgPrefix = 'Listbox constructor argument domNode ';
88

99
// Check whether domNode is a DOM element
10-
if (!domNode instanceof Element) {
10+
if (!(domNode instanceof Element)) {
1111
throw new TypeError(msgPrefix + 'is not a DOM Element.');
1212
}
1313

@@ -65,7 +65,7 @@ Listbox.prototype.init = function () {
6565
optionElement = optionElements[i];
6666

6767
if (!optionElement.firstElementChild && optionElement.getAttribute('role') != 'separator') {
68-
option = new Option(optionElement, this);
68+
option = new ListboxOption(optionElement, this);
6969
option.init();
7070
this.allOptions.push(option);
7171
}

examples/combobox/aria1.0pattern/js/listboxOption.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* This content is licensed according to the W3C Software License at
33
* https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document
44
*/
5-
var Option = function (domNode, listboxObj) {
5+
var ListboxOption = function (domNode, listboxObj) {
66

77
this.domNode = domNode;
88
this.listbox = listboxObj;
@@ -11,7 +11,7 @@ var Option = function (domNode, listboxObj) {
1111

1212
};
1313

14-
Option.prototype.init = function () {
14+
ListboxOption.prototype.init = function () {
1515

1616
if (!this.domNode.getAttribute('role')) {
1717
this.domNode.setAttribute('role', 'option');
@@ -25,18 +25,18 @@ Option.prototype.init = function () {
2525

2626
/* EVENT HANDLERS */
2727

28-
Option.prototype.handleClick = function (event) {
28+
ListboxOption.prototype.handleClick = function (event) {
2929
this.listbox.setOption(this);
3030
this.listbox.close(true);
3131
};
3232

33-
Option.prototype.handleMouseover = function (event) {
33+
ListboxOption.prototype.handleMouseover = function (event) {
3434
this.listbox.hasHover = true;
3535
this.listbox.open();
3636

3737
};
3838

39-
Option.prototype.handleMouseout = function (event) {
39+
ListboxOption.prototype.handleMouseout = function (event) {
4040
this.listbox.hasHover = false;
4141
setTimeout(this.listbox.close.bind(this.listbox, false), 300);
4242
};

examples/dialog-modal/js/dialog.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ aria.Utils = aria.Utils || {};
7070
element.focus();
7171
}
7272
catch (e) {
73+
// continue regardless of error
7374
}
7475
aria.Utils.IgnoreUtilFocusChanges = false;
7576
return (document.activeElement === element);

0 commit comments

Comments
 (0)