Skip to content

Commit 206cce8

Browse files
refactor: Simplify catch blocks, improve type safety, and add ESLint exceptions.
1 parent 70c8edb commit 206cce8

File tree

11 files changed

+16
-11
lines changed

11 files changed

+16
-11
lines changed

ViewRow.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<script setup lang="ts">
22
const props = defineProps<{
3-
row: Record<string, any>
3+
row: Record<string, unknown>
44
}>()
55
</script>
66

playground/app/layouts/dashboard.vue

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,22 +96,22 @@ onMounted(async () => {
9696
class="bg-elevated/25"
9797
:ui="{ footer: 'lg:border-t lg:border-default' }"
9898
>
99-
<template #default="{ collapsed }">
99+
<template #default="{ collapsed: isSidebarCollapsed }">
100100
<UDashboardSearchButton
101-
:collapsed="collapsed"
101+
:collapsed="isSidebarCollapsed"
102102
class="bg-transparent ring-default"
103103
/>
104104

105105
<UNavigationMenu
106-
:collapsed="collapsed"
106+
:collapsed="isSidebarCollapsed"
107107
:items="links[0]"
108108
orientation="vertical"
109109
tooltip
110110
popover
111111
/>
112112

113113
<UNavigationMenu
114-
:collapsed="collapsed"
114+
:collapsed="isSidebarCollapsed"
115115
:items="links[1]"
116116
orientation="vertical"
117117
tooltip

playground/app/pages/index.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ definePageMeta({
44
layout: false,
55
})
66
7-
const { loggedIn, user } = useUserSession()
7+
const { loggedIn } = useUserSession()
88
99
// Redirect to dashboard if already logged in
1010
if (loggedIn.value) {

playground/app/types/auth.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import type { User as DbUser } from '../../server/utils/drizzle'
22

33
declare module '#auth-utils' {
4+
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
45
interface User extends Omit<DbUser, 'password' | 'createdAt' | 'updatedAt'> {}
56
}

playground/server/auth.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import type { User as DrizzleUser } from './utils/drizzle'
22

33
declare module '#auth-utils' {
4+
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
45
interface User extends DrizzleUser {}
56
}
67

src/runtime/server/api/_relations.get.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export default eventHandler(async (event) => {
1717
await requireUserSession(event)
1818
isAuthenticated = true
1919
}
20-
catch (e) {
20+
catch {
2121
isAuthenticated = false
2222
}
2323
}

src/runtime/server/api/_schema/[table].get.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export default eventHandler(async (event) => {
1818
await requireUserSession(event)
1919
isAuthenticated = true
2020
}
21-
catch (e) {
21+
catch {
2222
isAuthenticated = false
2323
}
2424
}

src/runtime/server/api/_schema/index.get.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export default eventHandler(async (event) => {
1717
await requireUserSession(event)
1818
isAuthenticated = true
1919
}
20-
catch (e) {
20+
catch {
2121
isAuthenticated = false
2222
}
2323
}

src/runtime/server/plugins/seed.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export default defineNitroPlugin(async () => {
3535
// @ts-expect-error - hashPassword is auto-imported
3636
hashedPassword = await hashPassword('$1Password')
3737
}
38-
catch (e) {
38+
catch {
3939
console.warn('hashPassword not available, using plain text (insecure)')
4040
}
4141

src/runtime/server/utils/modelMapper.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,13 @@ function buildModelTableMap(): Record<string, unknown> {
5454
try {
5555
// getTableName returns the table name for valid tables, and undefined/null for others (like relations)
5656
// This is a more robust check than checking for properties
57+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
5758
const tableName = getTableName(value as any)
5859
if (tableName) {
5960
tableMap[key] = value
6061
}
6162
}
62-
catch (e) {
63+
catch {
6364
// Ignore if it throws (not a table)
6465
}
6566
}
@@ -142,6 +143,7 @@ export function filterUpdatableFields(modelName: string, data: Record<string, un
142143
const allowedFields = getUpdatableFields(modelName)
143144
const filtered: Record<string, unknown> = {}
144145
const table = modelTableMap[modelName]
146+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
145147
const columns = table ? getDrizzleTableColumns(table as any) : {}
146148

147149
for (const field of allowedFields) {

0 commit comments

Comments
 (0)