diff --git a/package-lock.json b/package-lock.json index 2cf69cf8..a4a7e21e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -15548,9 +15548,9 @@ "integrity": "sha1-1PRWKwzjaW5BrFLQ4ALlemNdxtw=" }, "prettier": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.0.3.tgz", - "integrity": "sha512-5qpBDBHO9fpE0zruKiTZm8Gxmz7kknO+WlQR/ivV+RMwgDw/WjOgmxLDn66MPrxq/WZPx/EgEZzh87xJO5E6Fw==", + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.0.4.tgz", + "integrity": "sha512-SVJIQ51spzFDvh4fIbCLvciiDMCrRhlN3mbZvv/+ycjvmF5E73bKdGfU8QDLNmjYJf+lsGnDBC4UUnvTe5OO0w==", "dev": true }, "prettier-linter-helpers": { diff --git a/package.json b/package.json index 1e3b9401..55a4a102 100644 --- a/package.json +++ b/package.json @@ -48,7 +48,7 @@ "lint-staged": "10.1.3", "node-sass": "4.13.1", "pepjs": "0.5.2", - "prettier": "2.0.3", + "prettier": "2.0.4", "rewire": "5.0.0", "typescript": "3.8.3" }, diff --git a/src/components/App.tsx b/src/components/App.tsx index 389bb091..61fb8a21 100644 --- a/src/components/App.tsx +++ b/src/components/App.tsx @@ -134,11 +134,9 @@ import { function withBatchedUpdates< TFunction extends ((event: any) => void) | (() => void) >(func: Parameters["length"] extends 0 | 1 ? TFunction : never) { - return ( - ((event) => { - unstable_batchedUpdates(func as TFunction, event); - }) as TFunction - ); + return ((event) => { + unstable_batchedUpdates(func as TFunction, event); + }) as TFunction; } const { history } = createHistory(); diff --git a/src/element/handlerRectangles.ts b/src/element/handlerRectangles.ts index 2971700e..ea0a924b 100644 --- a/src/element/handlerRectangles.ts +++ b/src/element/handlerRectangles.ts @@ -193,48 +193,38 @@ export function handlerRectangles( const [, p1] = element.points; if (p1[0] === 0 || p1[1] === 0) { - return ( - { - nw: handlers.nw, - se: handlers.se, - } as typeof handlers - ); + return { + nw: handlers.nw, + se: handlers.se, + } as typeof handlers; } if (p1[0] > 0 && p1[1] < 0) { - return ( - { - ne: handlers.ne, - sw: handlers.sw, - } as typeof handlers - ); + return { + ne: handlers.ne, + sw: handlers.sw, + } as typeof handlers; } if (p1[0] > 0 && p1[1] > 0) { - return ( - { - nw: handlers.nw, - se: handlers.se, - } as typeof handlers - ); + return { + nw: handlers.nw, + se: handlers.se, + } as typeof handlers; } if (p1[0] < 0 && p1[1] > 0) { - return ( - { - ne: handlers.ne, - sw: handlers.sw, - } as typeof handlers - ); + return { + ne: handlers.ne, + sw: handlers.sw, + } as typeof handlers; } if (p1[0] < 0 && p1[1] < 0) { - return ( - { - nw: handlers.nw, - se: handlers.se, - } as typeof handlers - ); + return { + nw: handlers.nw, + se: handlers.se, + } as typeof handlers; } } } diff --git a/src/element/index.ts b/src/element/index.ts index ba8e1a07..95b55f0c 100644 --- a/src/element/index.ts +++ b/src/element/index.ts @@ -67,10 +67,9 @@ export function getDrawingVersion(elements: readonly ExcalidrawElement[]) { } export function getNonDeletedElements(elements: readonly ExcalidrawElement[]) { - return ( - elements.filter((element) => !element.isDeleted) as - readonly NonDeletedExcalidrawElement[] - ); + return elements.filter( + (element) => !element.isDeleted, + ) as readonly NonDeletedExcalidrawElement[]; } export function isNonDeletedElement( diff --git a/src/is-mobile.tsx b/src/is-mobile.tsx index d45d1f56..ec148b4a 100644 --- a/src/is-mobile.tsx +++ b/src/is-mobile.tsx @@ -13,9 +13,7 @@ export function IsMobileProvider({ children }: { children: React.ReactNode }) { matches: false, addListener: () => {}, removeListener: () => {}, - } as - any) as - MediaQueryList); + } as any) as MediaQueryList); } const [isMobile, setMobile] = useState(query.current.matches); diff --git a/src/keys.ts b/src/keys.ts index 804ebcd1..dd2c6bed 100644 --- a/src/keys.ts +++ b/src/keys.ts @@ -1,21 +1,20 @@ export const isDarwin = /Mac|iPod|iPhone|iPad/.test(window.navigator.platform); -export const KEYS = - { - ARROW_LEFT: "ArrowLeft", - ARROW_RIGHT: "ArrowRight", - ARROW_DOWN: "ArrowDown", - ARROW_UP: "ArrowUp", - ENTER: "Enter", - ESCAPE: "Escape", - DELETE: "Delete", - BACKSPACE: "Backspace", - CTRL_OR_CMD: isDarwin ? "metaKey" : "ctrlKey", - TAB: "Tab", - SPACE: " ", - QUESTION_MARK: "?", - F_KEY_CODE: 70, - } as const; +export const KEYS = { + ARROW_LEFT: "ArrowLeft", + ARROW_RIGHT: "ArrowRight", + ARROW_DOWN: "ArrowDown", + ARROW_UP: "ArrowUp", + ENTER: "Enter", + ESCAPE: "Escape", + DELETE: "Delete", + BACKSPACE: "Backspace", + CTRL_OR_CMD: isDarwin ? "metaKey" : "ctrlKey", + TAB: "Tab", + SPACE: " ", + QUESTION_MARK: "?", + F_KEY_CODE: 70, +} as const; export type Key = keyof typeof KEYS; diff --git a/src/shapes.tsx b/src/shapes.tsx index 9fe691c0..c6da1445 100644 --- a/src/shapes.tsx +++ b/src/shapes.tsx @@ -2,79 +2,78 @@ import React from "react"; import oc from "open-color"; // We inline font-awesome icons in order to save on js size rather than including the font awesome react library -export const SHAPES = - [ - { - icon: ( - // fa-mouse-pointer - - - - ), - value: "selection", - }, - { - icon: ( - // fa-square - - - - ), - value: "rectangle", - }, - { - icon: ( - // custom - - - - ), - value: "diamond", - }, - { - icon: ( - // fa-circle - - - - ), - value: "ellipse", - }, - { - icon: ( - // fa-long-arrow-alt-right - - - - ), - value: "arrow", - }, - { - icon: ( - // custom - - - - ), - value: "line", - }, - { - icon: ( - // fa-font - - - - ), - value: "text", - }, - ] as const; +export const SHAPES = [ + { + icon: ( + // fa-mouse-pointer + + + + ), + value: "selection", + }, + { + icon: ( + // fa-square + + + + ), + value: "rectangle", + }, + { + icon: ( + // custom + + + + ), + value: "diamond", + }, + { + icon: ( + // fa-circle + + + + ), + value: "ellipse", + }, + { + icon: ( + // fa-long-arrow-alt-right + + + + ), + value: "arrow", + }, + { + icon: ( + // custom + + + + ), + value: "line", + }, + { + icon: ( + // fa-font + + + + ), + value: "text", + }, +] as const; export const shapesShortcutKeys = SHAPES.map((shape, index) => [ shape.value[0], diff --git a/src/tests/regressionTests.test.tsx b/src/tests/regressionTests.test.tsx index f55a76f4..e15998ff 100644 --- a/src/tests/regressionTests.test.tsx +++ b/src/tests/regressionTests.test.tsx @@ -164,11 +164,13 @@ function getSelectedElement(): ExcalidrawElement { type HandlerRectanglesRet = keyof ReturnType; function getResizeHandles() { - const rects = - handlerRectangles(getSelectedElement(), h.state.zoom, pointerType) as - { - [T in HandlerRectanglesRet]: [number, number, number, number]; - }; + const rects = handlerRectangles( + getSelectedElement(), + h.state.zoom, + pointerType, + ) as { + [T in HandlerRectanglesRet]: [number, number, number, number]; + }; const rv: { [K in keyof typeof rects]: [number, number] } = {} as any;