Stricter compilation rules, better linting

This commit is contained in:
2025-07-19 11:34:05 +02:00
parent cb11398b3e
commit 161916e5ca
11 changed files with 247 additions and 47 deletions

View File

@ -49,7 +49,9 @@ export function Space() {
// Drag in empty space - rectangle selection
const handleMouseDown = (e: React.MouseEvent) => {
if (e.detail === 2) return // Ignore double-click
if (e.detail === 2) {
return
} // Ignore double-click
const rect = e.currentTarget.getBoundingClientRect()
const x = e.clientX - rect.left
@ -61,10 +63,14 @@ export function Space() {
}
const handleMouseMove = (e: MouseEvent) => {
if (!isSelecting) return
if (!isSelecting) {
return
}
const spaceElement = document.querySelector('[data-space-canvas]') as HTMLElement
if (!spaceElement) return
if (!spaceElement) {
return
}
const rect = spaceElement.getBoundingClientRect()
const x = e.clientX - rect.left
@ -74,13 +80,17 @@ export function Space() {
}
const handleMouseUp = (e: MouseEvent) => {
if (!isSelecting) return
if (!isSelecting) {
return
}
setIsSelecting(false)
// Get final mouse position directly from event
const spaceElement = document.querySelector('[data-space-canvas]') as HTMLElement
if (!spaceElement) return
if (!spaceElement) {
return
}
const rect = spaceElement.getBoundingClientRect()
const finalX = e.clientX - rect.left
@ -114,13 +124,16 @@ export function Space() {
document.removeEventListener('mouseup', handleMouseUp)
}
}
return undefined
}, [isSelecting, selectionStart])
// Keyboard shortcuts
useEffect(() => {
const handleKeyDown = (e: KeyboardEvent) => {
// Don't handle shortcuts if editing a note, navigation console or welcome modal is open
if ($editingNoteId || showNavigationConsole || showWelcomeModal) return
if ($editingNoteId || showNavigationConsole || showWelcomeModal) {
return
}
if (e.key === ':' && !e.shiftKey) {
e.preventDefault()