Skip to content

Commit

Permalink
Infrastructure: Add eslint rules from eslint:recommended config (pull #…
Browse files Browse the repository at this point in the history
…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
  • Loading branch information
nschonni authored and mcking65 committed Oct 22, 2019
1 parent 422ca61 commit d367ea5
Show file tree
Hide file tree
Showing 29 changed files with 325 additions and 406 deletions.
112 changes: 7 additions & 105 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,109 +1,11 @@
{
"extends": "eslint:recommended",
"env": {
"browser": true
},
"rules": {
"no-with": 2,
"no-mixed-spaces-and-tabs": 2,
"no-multiple-empty-lines": 2,
"no-multi-spaces": 0,
"operator-linebreak": [
2,
"after"
],
"quote-props": 0,
"key-spacing": [
2,
{
"afterColon": true
}
],
"space-unary-ops": [
2,
{
"words": false,
"nonwords": false
}
],
"no-spaced-func": 2,
"array-bracket-spacing": [
2,
"never",
{
"singleValue": true
}
],
"space-in-parens": [
2,
"never"
],
"comma-dangle": [
2,
"never"
],
"no-trailing-spaces": 2,
"yoda": [
2,
"never"
],
"camelcase": [
2,
{
"properties": "always"
}
],
"comma-style": [
2,
"last"
],
"curly": [
2,
"all"
],
"dot-notation": 2,
"brace-style": [
2,
"stroustrup",
{
"allowSingleLine": true
}
],
"eol-last": 2,
"wrap-iife": 2,
"semi": [
2,
"always"
],
"space-infix-ops": 2,
"keyword-spacing": [
2,
{}
],
"spaced-comment": [
2,
"always"
],
"space-before-blocks": [
2,
"always"
],
"space-before-function-paren": [
2,
"always"
],
"consistent-this": [
2,
"self"
],
"indent": [
2,
2,
{
"SwitchCase": 1
}
],
"quotes": [
2,
"single"
],
"no-eval": "error",
"no-implied-eval": "error"
"no-unused-vars": 0,
"no-undef": 0,
"no-fallthrough": 0
}
}
4 changes: 2 additions & 2 deletions examples/combobox/aria1.0pattern/js/listbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ var Listbox = function (domNode, comboboxObj) {
msgPrefix = 'Listbox constructor argument domNode ';

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

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

if (!optionElement.firstElementChild && optionElement.getAttribute('role') != 'separator') {
option = new Option(optionElement, this);
option = new ListboxOption(optionElement, this);
option.init();
this.allOptions.push(option);
}
Expand Down
10 changes: 5 additions & 5 deletions examples/combobox/aria1.0pattern/js/listboxOption.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* This content is licensed according to the W3C Software License at
* https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document
*/
var Option = function (domNode, listboxObj) {
var ListboxOption = function (domNode, listboxObj) {

this.domNode = domNode;
this.listbox = listboxObj;
Expand All @@ -11,7 +11,7 @@ var Option = function (domNode, listboxObj) {

};

Option.prototype.init = function () {
ListboxOption.prototype.init = function () {

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

/* EVENT HANDLERS */

Option.prototype.handleClick = function (event) {
ListboxOption.prototype.handleClick = function (event) {
this.listbox.setOption(this);
this.listbox.close(true);
};

Option.prototype.handleMouseover = function (event) {
ListboxOption.prototype.handleMouseover = function (event) {
this.listbox.hasHover = true;
this.listbox.open();

};

Option.prototype.handleMouseout = function (event) {
ListboxOption.prototype.handleMouseout = function (event) {
this.listbox.hasHover = false;
setTimeout(this.listbox.close.bind(this.listbox, false), 300);
};
1 change: 1 addition & 0 deletions examples/dialog-modal/js/dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ aria.Utils = aria.Utils || {};
element.focus();
}
catch (e) {
// continue regardless of error
}
aria.Utils.IgnoreUtilFocusChanges = false;
return (document.activeElement === element);
Expand Down
Loading

0 comments on commit d367ea5

Please sign in to comment.