mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 22:12:21 -04:00
Enforce curly bracket usage for one-statement ifs
This commit is contained in:
parent
a53806e24a
commit
9740393d72
7 changed files with 22 additions and 8 deletions
|
@ -24,6 +24,7 @@ module.exports = {
|
||||||
"simple-import-sort/exports": "warn",
|
"simple-import-sort/exports": "warn",
|
||||||
"prefer-const": "warn",
|
"prefer-const": "warn",
|
||||||
"no-nested-ternary": "warn",
|
"no-nested-ternary": "warn",
|
||||||
|
"curly": "error",
|
||||||
"@typescript-eslint/consistent-type-imports": "error",
|
"@typescript-eslint/consistent-type-imports": "error",
|
||||||
},
|
},
|
||||||
overrides: [
|
overrides: [
|
||||||
|
|
|
@ -24,7 +24,9 @@
|
||||||
bind:this={spanRef}
|
bind:this={spanRef}
|
||||||
for={forId}
|
for={forId}
|
||||||
on:click={(e) => {
|
on:click={(e) => {
|
||||||
if (preventMouseClick) e.preventDefault();
|
if (preventMouseClick) {
|
||||||
|
e.preventDefault();
|
||||||
|
}
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<slot />
|
<slot />
|
||||||
|
|
|
@ -35,7 +35,9 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
}
|
}
|
||||||
|
|
||||||
function decimalPlaces(value: number) {
|
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;
|
return value.toString().split(".")[1].length || 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -43,8 +43,9 @@ export const drawEllipse = (canvas: fabric.Canvas): void => {
|
||||||
});
|
});
|
||||||
|
|
||||||
canvas.on("mouse:move", function(o) {
|
canvas.on("mouse:move", function(o) {
|
||||||
if (!isDown) return;
|
if (!isDown) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
const pointer = canvas.getPointer(o.e);
|
const pointer = canvas.getPointer(o.e);
|
||||||
let rx = Math.abs(origX - pointer.x) / 2;
|
let rx = Math.abs(origX - pointer.x) / 2;
|
||||||
let ry = Math.abs(origY - pointer.y) / 2;
|
let ry = Math.abs(origY - pointer.y) / 2;
|
||||||
|
|
|
@ -44,7 +44,9 @@ export const drawRectangle = (canvas: fabric.Canvas): void => {
|
||||||
});
|
});
|
||||||
|
|
||||||
canvas.on("mouse:move", function(o) {
|
canvas.on("mouse:move", function(o) {
|
||||||
if (!isDown) return;
|
if (!isDown) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
const pointer = canvas.getPointer(o.e);
|
const pointer = canvas.getPointer(o.e);
|
||||||
let x = pointer.x;
|
let x = pointer.x;
|
||||||
let y = pointer.y;
|
let y = pointer.y;
|
||||||
|
|
|
@ -20,8 +20,12 @@ type UndoState = {
|
||||||
const shapeType = ["rect", "ellipse", "i-text"];
|
const shapeType = ["rect", "ellipse", "i-text"];
|
||||||
|
|
||||||
const validShape = (shape: fabric.Object): boolean => {
|
const validShape = (shape: fabric.Object): boolean => {
|
||||||
if (shape.width <= 5 || shape.height <= 5) return false;
|
if (shape.width <= 5 || shape.height <= 5) {
|
||||||
if (shapeType.indexOf(shape.type) === -1) return false;
|
return false;
|
||||||
|
}
|
||||||
|
if (shapeType.indexOf(shape.type) === -1) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -105,7 +105,9 @@ export async function preloadResources(html: string): Promise<void> {
|
||||||
timeout = 500;
|
timeout = 500;
|
||||||
} else if (images.length) {
|
} else if (images.length) {
|
||||||
timeout = 200;
|
timeout = 200;
|
||||||
} else return;
|
} else {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
await Promise.race([
|
await Promise.race([
|
||||||
Promise.all([...styleSheets, ...images, ...fonts]),
|
Promise.all([...styleSheets, ...images, ...fonts]),
|
||||||
|
|
Loading…
Reference in a new issue