Add more ESLint rules and change the formatting scripts (#626)

* Add curly rule in ESLint for consistency

* Fix rules

* More rules

* REturn

* Push

* no else return

* prefer const

* destructing
This commit is contained in:
Lipis
2020-02-02 20:04:35 +02:00
committed by GitHub
parent 814299321e
commit 53994e71e5
21 changed files with 201 additions and 77 deletions

View File

@@ -26,11 +26,11 @@ export function Popover({
const viewportWidth = window.innerWidth;
if (x + width > viewportWidth) {
element.style.left = viewportWidth - width + "px";
element.style.left = `${viewportWidth - width}px`;
}
const viewportHeight = window.innerHeight;
if (y + height > viewportHeight) {
element.style.top = viewportHeight - height + "px";
element.style.top = `${viewportHeight - height}px`;
}
}
}, [fitInViewport]);
@@ -42,7 +42,9 @@ export function Popover({
onClick={onCloseRequest}
onContextMenu={e => {
e.preventDefault();
if (onCloseRequest) onCloseRequest();
if (onCloseRequest) {
onCloseRequest();
}
}}
/>
{children}