Skip to content

Commit

Permalink
Infrastructure: Fix previously excluded ESLint issues (pull #1610)
Browse files Browse the repository at this point in the history
* fix: Remove unused variables in tests
* fix: no undefined in test files
* fix: ESLint errors in respec-config
* fix: ESLint in treeview
* fix: ESLint in toolbar files
* fix: Unused vars in tabs
* fix: unused vars in slider
* fix: Unused vars in meter
* fix: ESLint issues in menubar
* fix: ESLint menu-button files
* fix: ESLint listbox examples
* fix: Ignore exported link helper
* fix: ESLint in landmarks examples
* fix: ESLint errors in supporting example JS
* fix: ESLint in grid examples
* fix: ESLint in feed example
* fix: ESLint in disclosure example
* fix: ESLint in dialog modal example
* fix: ESLint in combobox examples
* fix: ESLint in checkbox examples
* fix: ESLint in alert example
* fix: ESLint in accordion
* chore: Remove passing no-console
* chore: Allow console in Node scripts
* chore: Disallow unused eslint-disable directives
  • Loading branch information
nschonni authored Jan 8, 2021
1 parent 90c8cde commit 0f03626
Show file tree
Hide file tree
Showing 78 changed files with 164 additions and 434 deletions.
105 changes: 0 additions & 105 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,111 +39,6 @@
"rules": {
"no-console": 0
}
},
{
"files": [
"examples/accordion/js/accordion.js",
"examples/alert/js/alert.js",
"examples/checkbox/checkbox-1/js/checkbox.js",
"examples/checkbox/checkbox-2/js/checkboxMixed.js",
"examples/checkbox/checkbox-2/js/controlledCheckbox.js",
"examples/combobox/js/combobox-autocomplete.js",
"examples/combobox/js/combobox-datepicker.js",
"examples/combobox/js/grid-combo-example.js",
"examples/combobox/js/grid-combo.js",
"examples/dialog-modal/js/alertdialog.js",
"examples/dialog-modal/js/dialog.js",
"examples/disclosure/js/disclosureButton.js",
"examples/disclosure/js/disclosureMenu.js",
"examples/grid/js/dataGrid.js",
"examples/grid/js/dataGrids.js",
"examples/grid/js/layoutGrids.js",
"examples/js/examples.js",
"examples/landmarks/js/bootstrap-accessibility-2.js",
"examples/landmarks/js/show.js",
"examples/link/js/link.js",
"examples/listbox/js/listbox-collapsible.js",
"examples/listbox/js/listbox-scrollable.js",
"examples/listbox/js/listbox.js",
"examples/menu-button/js/menu-button-actions-active-descendant.js",
"examples/menu-button/js/menu-button-actions.js",
"examples/menu-button/js/menu-button-links.js",
"examples/menubar/js/menubar-editor.js",
"examples/menubar/js/menubar-navigation.js",
"examples/meter/js/meter.js",
"examples/slider/js/multithumb-slider.js",
"examples/slider/js/slider.js",
"examples/slider/js/text-slider.js",
"examples/slider/js/vertical-slider.js",
"examples/tabs/tabs-2/js/tabs.js",
"examples/toolbar/js/FontMenu.js",
"examples/toolbar/js/FontMenuButton.js",
"examples/toolbar/js/FontMenuItem.js",
"examples/toolbar/js/FormatToolbar.js",
"examples/toolbar/js/FormatToolbarItem.js",
"examples/treeview/treeview-1/js/treeitem.js",
"examples/treeview/treeview-2/js/treeitemLinks.js",
"respec-config.js",
"test/index.js",
"test/tests/accordion_accordion.js",
"test/tests/combobox_datepicker.js",
"test/tests/combobox_select-only.js",
"test/tests/dialog-modal_datepicker.js",
"test/tests/grid_LayoutGrids.js",
"test/tests/grid_dataGrids.js",
"test/tests/menu-button_actions.js",
"test/tests/menu-button_actions-active-descendant.js",
"test/tests/menubar_menubar-editor.js",
"test/tests/menubar_menubar-navigation.js",
"test/tests/slider_slider-2.js",
"test/tests/tabs_tabs-1.js",
"test/tests/tabs_tabs-2.js",
"test/util/assertHasFocus.js",
"test/tests/toolbar_toolbar.js",
"test/tests/treegrid_treegrid-1.js",
"test/tests/treeview_treeview-1a.js",
"test/tests/treeview_treeview-1b.js",
"test/tests/treeview_treeview-2a.js",
"test/tests/treeview_treeview-2b.js",
"test/util/assertAriaDescribedby.js",
"test/util/assertDotValue.js",
"test/util/report.js"
],
"rules": {
"no-unused-vars": 0
}
},
{
"files": [
"examples/checkbox/checkbox-2/js/checkboxMixed.js",
"examples/combobox/js/grid-combo-example.js",
"examples/combobox/js/grid-combo.js",
"examples/dialog-modal/js/alertdialog.js",
"examples/feed/js/main.js",
"examples/grid/js/dataGrids.js",
"examples/js/app.js",
"examples/landmarks/js/bootstrap-accessibility-2.js",
"examples/landmarks/js/show.js",
"examples/landmarks/js/tabs.js",
"examples/listbox/js/listbox-rearrangeable.js",
"examples/listbox/js/listbox-scrollable.js",
"examples/menubar/js/menubar-editor.js",
"examples/toolbar/js/FontMenu.js",
"examples/toolbar/js/FontMenuButton.js",
"examples/toolbar/js/FormatToolbar.js",
"examples/treeview/treeview-1/js/tree.js",
"examples/treeview/treeview-2/js/treeLinks.js",
"respec-config.js",
"test/tests/link_link.js",
"test/tests/menu-button_actions-active-descendant.js",
"test/tests/menu-button_actions.js",
"test/tests/menu-button_links.js",
"test/util/assertTabOrder.js",
"test/util/force-serial.js"
],
"rules": {
"no-undef": 0
}
}
]
}
12 changes: 2 additions & 10 deletions examples/accordion/js/accordion.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@ Array.prototype.slice
var triggers = Array.prototype.slice.call(
accordion.querySelectorAll('.Accordion-trigger')
);
var panels = Array.prototype.slice.call(
accordion.querySelectorAll('.Accordion-panel')
);

accordion.addEventListener('click', function (event) {
var target = event.target;
Expand Down Expand Up @@ -78,11 +75,6 @@ Array.prototype.slice
var target = event.target;
var key = event.which.toString();

var isExpanded = target.getAttribute('aria-expanded') == 'true';
var allowToggle = allowMultiple
? allowMultiple
: accordion.hasAttribute('data-allow-toggle');

// 33 = Page Up, 34 = Page Down
var ctrlModifier = event.ctrlKey && key.match(/33|34/);

Expand Down Expand Up @@ -120,11 +112,11 @@ Array.prototype.slice
accordion
.querySelectorAll('.Accordion-trigger')
.forEach(function (trigger) {
trigger.addEventListener('focus', function (event) {
trigger.addEventListener('focus', function () {
accordion.classList.add('focus');
});

trigger.addEventListener('blur', function (event) {
trigger.addEventListener('blur', function () {
accordion.classList.remove('focus');
});
});
Expand Down
2 changes: 1 addition & 1 deletion examples/alert/js/alert.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ window.addEventListener('load', function () {
*
*/

function addAlert(event) {
function addAlert() {
var example = document.getElementById('example');
var template = document.getElementById('alert-template').innerHTML;

Expand Down
6 changes: 3 additions & 3 deletions examples/checkbox/checkbox-1/js/checkbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,14 @@ Checkbox.prototype.handleKeydown = function (event) {
}
};

Checkbox.prototype.handleClick = function (event) {
Checkbox.prototype.handleClick = function () {
this.toggleCheckbox();
};

Checkbox.prototype.handleFocus = function (event) {
Checkbox.prototype.handleFocus = function () {
this.domNode.classList.add('focus');
};

Checkbox.prototype.handleBlur = function (event) {
Checkbox.prototype.handleBlur = function () {
this.domNode.classList.remove('focus');
};
8 changes: 5 additions & 3 deletions examples/checkbox/checkbox-2/js/checkboxMixed.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
* for a menu of links
*/

/* global ControlledCheckbox */

'use strict';

/*
Expand Down Expand Up @@ -136,14 +138,14 @@ CheckboxMixed.prototype.handleKeydown = function (event) {
}
};

CheckboxMixed.prototype.handleClick = function (event) {
CheckboxMixed.prototype.handleClick = function () {
this.toggleCheckboxMixed();
};

CheckboxMixed.prototype.handleFocus = function (event) {
CheckboxMixed.prototype.handleFocus = function () {
this.domNode.classList.add('focus');
};

CheckboxMixed.prototype.handleBlur = function (event) {
CheckboxMixed.prototype.handleBlur = function () {
this.domNode.classList.remove('focus');
};
6 changes: 3 additions & 3 deletions examples/checkbox/checkbox-2/js/controlledCheckbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,14 @@ ControlledCheckbox.prototype.setChecked = function (value) {

/* EVENT HANDLERS */

ControlledCheckbox.prototype.handleChange = function (event) {
ControlledCheckbox.prototype.handleChange = function () {
this.controller.updateCheckboxMixed();
};

ControlledCheckbox.prototype.handleKeyup = function (event) {
ControlledCheckbox.prototype.handleKeyup = function () {
this.lastState = this.isChecked();
};

ControlledCheckbox.prototype.handleClick = function (event) {
ControlledCheckbox.prototype.handleClick = function () {
this.lastState = this.isChecked();
};
17 changes: 8 additions & 9 deletions examples/combobox/js/combobox-autocomplete.js
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,6 @@ class ComboboxAutocomplete {

onComboboxKeyDown(event) {
var flag = false,
char = event.key,
altKey = event.altKey;

if (event.ctrlKey || event.shiftKey) {
Expand Down Expand Up @@ -492,30 +491,30 @@ class ComboboxAutocomplete {
}
}

onComboboxClick(event) {
onComboboxClick() {
if (this.isOpen()) {
this.close(true);
} else {
this.open();
}
}

onComboboxFocus(event) {
onComboboxFocus() {
this.filter = this.comboboxNode.value;
this.filterOptions();
this.setVisualFocusCombobox();
this.option = null;
this.setCurrentOptionStyle(null);
}

onComboboxBlur(event) {
onComboboxBlur() {
this.comboboxHasVisualFocus = false;
this.setCurrentOptionStyle(null);
this.removeVisualFocusAll();
setTimeout(this.close.bind(this, false), 300);
}

onButtonClick(event) {
onButtonClick() {
if (this.isOpen()) {
this.close(true);
} else {
Expand All @@ -527,11 +526,11 @@ class ComboboxAutocomplete {

/* Listbox Events */

onListboxMouseover(event) {
onListboxMouseover() {
this.hasHover = true;
}

onListboxMouseout(event) {
onListboxMouseout() {
this.hasHover = false;
setTimeout(this.close.bind(this, false), 300);
}
Expand All @@ -543,12 +542,12 @@ class ComboboxAutocomplete {
this.close(true);
}

onOptionMouseover(event) {
onOptionMouseover() {
this.hasHover = true;
this.open();
}

onOptionMouseout(event) {
onOptionMouseout() {
this.hasHover = false;
setTimeout(this.close.bind(this, false), 300);
}
Expand Down
4 changes: 1 addition & 3 deletions examples/combobox/js/combobox-datepicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -754,9 +754,7 @@ class ComboboxDatePicker {
}

onComboboxKeyDown(event) {
var flag = false,
char = event.key,
altKey = event.altKey;
var flag = false;

if (event.ctrlKey || event.shiftKey) {
return;
Expand Down
2 changes: 1 addition & 1 deletion examples/combobox/js/grid-combo-example.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ function searchVeggies(searchString) {
* @desc Initialize the combobox examples once the page has loaded
*/
window.addEventListener('load', function () {
var ex1Combobox = new aria.GridCombobox(
new aria.GridCombobox(
document.getElementById('ex1-input'),
document.getElementById('ex1-grid'),
searchVeggies
Expand Down
2 changes: 1 addition & 1 deletion examples/combobox/js/grid-combo.js
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ aria.GridCombobox.prototype.handleInputKeyDown = function (evt) {
}
};

aria.GridCombobox.prototype.handleInputFocus = function (evt) {
aria.GridCombobox.prototype.handleInputFocus = function () {
this.updateResults();
};

Expand Down
4 changes: 3 additions & 1 deletion examples/dialog-modal/js/alertdialog.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* global closeDialog, openDialog */

'use strict';

var aria = aria || {};
Expand All @@ -19,7 +21,7 @@ aria.Utils.triggerAlert = function (alertEl, content) {
alertEl.classList.remove('hidden');
alertEl.addEventListener(
'transitionend',
function (e) {
function () {
if (!this.classList.contains('active')) {
this.classList.add('hidden');
}
Expand Down
5 changes: 2 additions & 3 deletions examples/dialog-modal/js/dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,6 @@ aria.Utils = aria.Utils || {};
newFocusAfterClosed,
newFocusFirst
) {
var closedDialog = aria.getCurrentDialog();
aria.OpenDialogList.pop();
this.removeListeners();
aria.Utils.remove(this.preNode);
Expand All @@ -285,7 +284,7 @@ aria.Utils = aria.Utils || {};
this.backdropNode.classList.remove('active');

var focusAfterClosed = newFocusAfterClosed || this.focusAfterClosed;
var dialog = new aria.Dialog(newDialogId, focusAfterClosed, newFocusFirst);
new aria.Dialog(newDialogId, focusAfterClosed, newFocusFirst);
}; // end replace

aria.Dialog.prototype.addListeners = function () {
Expand Down Expand Up @@ -313,7 +312,7 @@ aria.Utils = aria.Utils || {};
}; // end trapFocus

window.openDialog = function (dialogId, focusAfterClosed, focusFirst) {
var dialog = new aria.Dialog(dialogId, focusAfterClosed, focusFirst);
new aria.Dialog(dialogId, focusAfterClosed, focusFirst);
};

window.closeDialog = function (closeButton) {
Expand Down
8 changes: 4 additions & 4 deletions examples/disclosure/js/disclosureButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,23 +79,23 @@ ButtonExpand.prototype.handleKeydown = function (event) {
}
};

ButtonExpand.prototype.handleClick = function (event) {
ButtonExpand.prototype.handleClick = function () {
this.toggleExpand();
};

ButtonExpand.prototype.handleFocus = function (event) {
ButtonExpand.prototype.handleFocus = function () {
this.domNode.classList.add('focus');
};

ButtonExpand.prototype.handleBlur = function (event) {
ButtonExpand.prototype.handleBlur = function () {
this.domNode.classList.remove('focus');
};

/* Initialize Hide/Show Buttons */

window.addEventListener(
'load',
function (event) {
function () {
var buttons = document.querySelectorAll(
'button[aria-expanded][aria-controls]'
);
Expand Down
Loading

0 comments on commit 0f03626

Please sign in to comment.