mirror of
https://github.com/ramvignesh-b/pi-ku.git
synced 2026-05-04 08:56:52 +00:00
refactor: simplify logical expressions and update biome linting rules
This commit is contained in:
+5
-1
@@ -20,7 +20,11 @@
|
|||||||
"recommended": true,
|
"recommended": true,
|
||||||
"complexity": {
|
"complexity": {
|
||||||
"noForEach": "error",
|
"noForEach": "error",
|
||||||
"useLiteralKeys": "error"
|
"noUselessFragments": "error",
|
||||||
|
"useLiteralKeys": "error",
|
||||||
|
"noUselessCatch": "error",
|
||||||
|
"useSimplifiedLogicExpression": "error",
|
||||||
|
"noExcessiveCognitiveComplexity": "warn"
|
||||||
},
|
},
|
||||||
"style": {
|
"style": {
|
||||||
"useConst": "error",
|
"useConst": "error",
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ export const ComposeCanvas = forwardRef<
|
|||||||
};
|
};
|
||||||
|
|
||||||
const finalWidth = await waitForLayout();
|
const finalWidth = await waitForLayout();
|
||||||
if (!isMounted || !canvasRef.current || !wrapperRef.current) return;
|
if (!(isMounted && canvasRef.current && wrapperRef.current)) return;
|
||||||
|
|
||||||
const initialHeight = Math.max(
|
const initialHeight = Math.max(
|
||||||
wrapperRef.current.clientHeight || 900,
|
wrapperRef.current.clientHeight || 900,
|
||||||
@@ -101,7 +101,7 @@ export const ComposeCanvas = forwardRef<
|
|||||||
canvas.add(textbox);
|
canvas.add(textbox);
|
||||||
|
|
||||||
textbox.on("changed", () => {
|
textbox.on("changed", () => {
|
||||||
if (!canvas || !wrapperRef.current) return;
|
if (!(canvas && wrapperRef.current)) return;
|
||||||
const neededHeight = textbox.top + textbox.height + PAD;
|
const neededHeight = textbox.top + textbox.height + PAD;
|
||||||
if (neededHeight > canvas.height) {
|
if (neededHeight > canvas.height) {
|
||||||
const newH = neededHeight + PAD;
|
const newH = neededHeight + PAD;
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ export default function Activate() {
|
|||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!uidb64 || !token || hasCalled.current) return;
|
if (!(uidb64 && token) || hasCalled.current) return;
|
||||||
|
|
||||||
// prevent double api calls
|
// prevent double api calls
|
||||||
hasCalled.current = true;
|
hasCalled.current = true;
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ export default function Editor() {
|
|||||||
const fileInputRef = useRef<HTMLInputElement>(null);
|
const fileInputRef = useRef<HTMLInputElement>(null);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!public_id || !masterKey) return;
|
if (!(public_id && masterKey)) return;
|
||||||
|
|
||||||
const loadExistingLetter = async () => {
|
const loadExistingLetter = async () => {
|
||||||
setIsInitialLoading(true);
|
setIsInitialLoading(true);
|
||||||
@@ -95,7 +95,7 @@ export default function Editor() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const handleSave = async (status: "SEALED" | "DRAFT"): Promise<void> => {
|
const handleSave = async (status: "SEALED" | "DRAFT"): Promise<void> => {
|
||||||
if (!public_id && !letterIdRef.current) {
|
if (!(public_id || letterIdRef.current)) {
|
||||||
letterIdRef.current = crypto.randomUUID();
|
letterIdRef.current = crypto.randomUUID();
|
||||||
navigate(PATHS.write(letterIdRef.current), { replace: true });
|
navigate(PATHS.write(letterIdRef.current), { replace: true });
|
||||||
} else if (public_id) {
|
} else if (public_id) {
|
||||||
|
|||||||
Reference in New Issue
Block a user