add no-unused and react/recommended to eslint (#1523)

* add no-unused-vars and no-unused-imports

* added quotes: double, and remove ignore pattern

* move itif and describeif into utils

Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
Sebastian Malton authored and GitHub committed 2020-11-27 08:48:38 -05:00
1 parent 10eb082854
commit 7451869c25
199 files changed
+1178 -807

No files matched your search

+2 -2
View File
@@ -1,2 +1,2 @@
export * from './menu';
export * from './menu-actions';
export * from "./menu";
export * from "./menu-actions";
+16 -16
View File
@@ -1,4 +1,4 @@
import './menu.scss';
import "./menu.scss";
import React, { Fragment, ReactElement, ReactNode } from "react";
import { createPortal } from "react-dom";
@@ -64,30 +64,30 @@ export class Menu extends React.Component<MenuProps, State> {
if (!this.props.usePortal) {
const parent = this.elem.parentElement;
const position = window.getComputedStyle(parent).position;
if (position === 'static') parent.style.position = 'relative';
if (position === "static") parent.style.position = "relative";
} else if (this.isOpen) {
this.refreshPosition();
}
this.opener = document.getElementById(this.props.htmlFor); // might not exist in sub-menus
if (this.opener) {
this.opener.addEventListener('click', this.toggle);
this.opener.addEventListener('keydown', this.onKeyDown);
this.opener.addEventListener("click", this.toggle);
this.opener.addEventListener("keydown", this.onKeyDown);
}
this.elem.addEventListener('keydown', this.onKeyDown);
window.addEventListener('resize', this.onWindowResize);
window.addEventListener('click', this.onClickOutside, true);
window.addEventListener('scroll', this.onScrollOutside, true);
this.elem.addEventListener("keydown", this.onKeyDown);
window.addEventListener("resize", this.onWindowResize);
window.addEventListener("click", this.onClickOutside, true);
window.addEventListener("scroll", this.onScrollOutside, true);
}
componentWillUnmount() {
if (this.opener) {
this.opener.removeEventListener('click', this.toggle);
this.opener.removeEventListener('keydown', this.onKeyDown);
this.opener.removeEventListener("click", this.toggle);
this.opener.removeEventListener("keydown", this.onKeyDown);
}
this.elem.removeEventListener('keydown', this.onKeyDown);
window.removeEventListener('resize', this.onWindowResize);
window.removeEventListener('click', this.onClickOutside, true);
window.removeEventListener('scroll', this.onScrollOutside, true);
this.elem.removeEventListener("keydown", this.onKeyDown);
window.removeEventListener("resize", this.onWindowResize);
window.removeEventListener("click", this.onClickOutside, true);
window.removeEventListener("scroll", this.onScrollOutside, true);
}
protected get focusableItems() {
@@ -188,7 +188,7 @@ export class Menu extends React.Component<MenuProps, State> {
}
}
onWindowResize(evt: UIEvent) {
onWindowResize() {
if (!this.isOpen) return;
this.refreshPosition();
}
@@ -224,7 +224,7 @@ export class Menu extends React.Component<MenuProps, State> {
render() {
const { position, id } = this.props;
let { className, usePortal } = this.props;
className = cssNames('Menu', className, this.state.position || position, {
className = cssNames("Menu", className, this.state.position || position, {
portal: usePortal,
});