diff --git a/biome.json b/biome.json index 9824a61..1dca93a 100644 --- a/biome.json +++ b/biome.json @@ -20,7 +20,11 @@ "recommended": true, "complexity": { "noForEach": "error", - "useLiteralKeys": "error" + "noUselessFragments": "error", + "useLiteralKeys": "error", + "noUselessCatch": "error", + "useSimplifiedLogicExpression": "error", + "noExcessiveCognitiveComplexity": "warn" }, "style": { "useConst": "error", diff --git a/frontend/src/components/ui/ComposeCanvas.tsx b/frontend/src/components/ui/ComposeCanvas.tsx index d8ef1d6..1a661e7 100644 --- a/frontend/src/components/ui/ComposeCanvas.tsx +++ b/frontend/src/components/ui/ComposeCanvas.tsx @@ -44,7 +44,7 @@ export const ComposeCanvas = forwardRef< }; const finalWidth = await waitForLayout(); - if (!isMounted || !canvasRef.current || !wrapperRef.current) return; + if (!(isMounted && canvasRef.current && wrapperRef.current)) return; const initialHeight = Math.max( wrapperRef.current.clientHeight || 900, @@ -101,7 +101,7 @@ export const ComposeCanvas = forwardRef< canvas.add(textbox); textbox.on("changed", () => { - if (!canvas || !wrapperRef.current) return; + if (!(canvas && wrapperRef.current)) return; const neededHeight = textbox.top + textbox.height + PAD; if (neededHeight > canvas.height) { const newH = neededHeight + PAD; diff --git a/frontend/src/pages/Activate.tsx b/frontend/src/pages/Activate.tsx index 9e3a186..cad05d5 100644 --- a/frontend/src/pages/Activate.tsx +++ b/frontend/src/pages/Activate.tsx @@ -15,7 +15,7 @@ export default function Activate() { const navigate = useNavigate(); useEffect(() => { - if (!uidb64 || !token || hasCalled.current) return; + if (!(uidb64 && token) || hasCalled.current) return; // prevent double api calls hasCalled.current = true; diff --git a/frontend/src/pages/Editor.tsx b/frontend/src/pages/Editor.tsx index f86dba1..d48492e 100644 --- a/frontend/src/pages/Editor.tsx +++ b/frontend/src/pages/Editor.tsx @@ -36,7 +36,7 @@ export default function Editor() { const fileInputRef = useRef(null); useEffect(() => { - if (!public_id || !masterKey) return; + if (!(public_id && masterKey)) return; const loadExistingLetter = async () => { setIsInitialLoading(true); @@ -95,7 +95,7 @@ export default function Editor() { }; const handleSave = async (status: "SEALED" | "DRAFT"): Promise => { - if (!public_id && !letterIdRef.current) { + if (!(public_id || letterIdRef.current)) { letterIdRef.current = crypto.randomUUID(); navigate(PATHS.write(letterIdRef.current), { replace: true }); } else if (public_id) {