diff --git a/.eslintrc.js b/.eslintrc.js index 01dc09d52..e672beadd 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -24,6 +24,7 @@ module.exports = { "simple-import-sort/exports": "warn", "prefer-const": "warn", "no-nested-ternary": "warn", + "curly": "error", "@typescript-eslint/consistent-type-imports": "error", }, overrides: [ diff --git a/ts/components/Label.svelte b/ts/components/Label.svelte index 2db73b3b5..0c2ba3f0a 100644 --- a/ts/components/Label.svelte +++ b/ts/components/Label.svelte @@ -24,7 +24,9 @@ bind:this={spanRef} for={forId} on:click={(e) => { - if (preventMouseClick) e.preventDefault(); + if (preventMouseClick) { + e.preventDefault(); + } }} > diff --git a/ts/components/SpinBox.svelte b/ts/components/SpinBox.svelte index 9b951ce1a..a9eb00919 100644 --- a/ts/components/SpinBox.svelte +++ b/ts/components/SpinBox.svelte @@ -35,7 +35,9 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html } function decimalPlaces(value: number) { - if (Math.floor(value) === value) return 0; + if (Math.floor(value) === value) { + return 0; + } return value.toString().split(".")[1].length || 0; } diff --git a/ts/image-occlusion/tools/tool-ellipse.ts b/ts/image-occlusion/tools/tool-ellipse.ts index a06ccbfc7..b784a6999 100644 --- a/ts/image-occlusion/tools/tool-ellipse.ts +++ b/ts/image-occlusion/tools/tool-ellipse.ts @@ -43,8 +43,9 @@ export const drawEllipse = (canvas: fabric.Canvas): void => { }); canvas.on("mouse:move", function(o) { - if (!isDown) return; - + if (!isDown) { + return; + } const pointer = canvas.getPointer(o.e); let rx = Math.abs(origX - pointer.x) / 2; let ry = Math.abs(origY - pointer.y) / 2; diff --git a/ts/image-occlusion/tools/tool-rect.ts b/ts/image-occlusion/tools/tool-rect.ts index c1bbb304a..6ad3f2d55 100644 --- a/ts/image-occlusion/tools/tool-rect.ts +++ b/ts/image-occlusion/tools/tool-rect.ts @@ -44,7 +44,9 @@ export const drawRectangle = (canvas: fabric.Canvas): void => { }); canvas.on("mouse:move", function(o) { - if (!isDown) return; + if (!isDown) { + return; + } const pointer = canvas.getPointer(o.e); let x = pointer.x; let y = pointer.y; diff --git a/ts/image-occlusion/tools/tool-undo-redo.ts b/ts/image-occlusion/tools/tool-undo-redo.ts index 286d6b4ec..2c176d74f 100644 --- a/ts/image-occlusion/tools/tool-undo-redo.ts +++ b/ts/image-occlusion/tools/tool-undo-redo.ts @@ -20,8 +20,12 @@ type UndoState = { const shapeType = ["rect", "ellipse", "i-text"]; const validShape = (shape: fabric.Object): boolean => { - if (shape.width <= 5 || shape.height <= 5) return false; - if (shapeType.indexOf(shape.type) === -1) return false; + if (shape.width <= 5 || shape.height <= 5) { + return false; + } + if (shapeType.indexOf(shape.type) === -1) { + return false; + } return true; }; diff --git a/ts/reviewer/preload.ts b/ts/reviewer/preload.ts index 72ae1b645..9adb097f5 100644 --- a/ts/reviewer/preload.ts +++ b/ts/reviewer/preload.ts @@ -105,7 +105,9 @@ export async function preloadResources(html: string): Promise { timeout = 500; } else if (images.length) { timeout = 200; - } else return; + } else { + return; + } await Promise.race([ Promise.all([...styleSheets, ...images, ...fonts]),