Skip to content

Commit

Permalink
fix(lint): fix lint issues from updated config
Browse files Browse the repository at this point in the history
  • Loading branch information
Arcath committed Dec 17, 2024
1 parent bf42d26 commit 43a6264
Show file tree
Hide file tree
Showing 26 changed files with 63 additions and 59 deletions.
2 changes: 1 addition & 1 deletion app/entry.server.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {renderToString} from 'react-dom/server'
import {RemixServer} from '@remix-run/react'
import type {EntryContext} from '@remix-run/node'
import {type EntryContext} from '@remix-run/node'

export default function handleRequest(
request: Request,
Expand Down
8 changes: 4 additions & 4 deletions app/lib/backup.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export const backup = async () => {

const {username, password, host, port, db} = matches!.groups!

await new Promise((resolve, reject) => {
await new Promise(resolve => {
exec(
`pg_dump -Fc -U ${username} -d ${db} -h ${host} -p ${port} > "${BACKUPS_DIR}/db.dump"`,
{env: {PGPASSWORD: password, NODE_ENV: process.env.NODE_ENV}},
Expand All @@ -43,10 +43,10 @@ export const backup = async () => {
],
({filePath, zipPath}) => {
console.dir([filePath, zipPath])
return new Promise((resolve, reject) => {
return new Promise(resolve => {
zip.addLocalFolderAsync(
filePath,
(s, e) => {
() => {
resolve()
},
zipPath
Expand Down Expand Up @@ -102,7 +102,7 @@ export const restore = async (filePath: string) => {

const {username, password, host, port, db} = matches!.groups!

await new Promise((resolve, reject) => {
await new Promise(resolve => {
exec(
`pg_restore -C -U ${username} -d ${db} -h ${host} -p ${port} < "${path.join(
BACKUPS_DIR,
Expand Down
3 changes: 1 addition & 2 deletions app/lib/components/boxes/button.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import type {FunctionComponent} from 'react'
import {useState, type FunctionComponent} from 'react'
import {motion} from 'framer-motion'
import {useState} from 'react'

export const Button: FunctionComponent<{
image: string
Expand Down
2 changes: 1 addition & 1 deletion app/lib/components/tabed-box.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export const TabedBox: FC<{
<div className="w-16 flex flex-col">
{children.map((child, i) => {
if (child === undefined) {
return //eslint-disable-line
return
}

return (
Expand Down
6 changes: 3 additions & 3 deletions app/lib/ldap.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export const createClient = (
): Promise<
{error: string; client: undefined} | {client: ldap.Client; error: undefined}
> => {
return new Promise((resolve, reject) => {
return new Promise(resolve => {
const client = ldap.createClient({
url: `ldaps://${dc}`,
tlsOptions: {rejectUnauthorized: false}
Expand All @@ -28,7 +28,7 @@ export const findUserDN = async (
username: string,
ou: string
): Promise<{error: string; dn: undefined} | {error: undefined; dn: string}> => {
return new Promise((resolve, reject) => {
return new Promise(resolve => {
client.search(
ou,
{
Expand All @@ -47,7 +47,7 @@ export const findUserDN = async (
resolve({dn: entry.dn.toString(), error: undefined})
})

res.on('end', result => {
res.on('end', () => {
if (entries === 0) {
resolve({error: `Unable to find user ${username}`, dn: undefined})
client.unbind()
Expand Down
3 changes: 1 addition & 2 deletions app/lib/printers.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ export type PrinterData = {
}

declare global {
// eslint-disable-next-line
var __printersCache: {time: Date; data: PrinterData[]} | undefined
}

Expand Down Expand Up @@ -42,7 +41,7 @@ export const getSupplyLevels = async () => {
lastUpdate === null ||
parseInt(lastUpdate) < Date.now() - SECOND_IN_MS * 600
) {
asyncForEach(
await asyncForEach(
printers,
async ({id, blackOID, cyanOID, yellowOID, magentaOID}) => {
await addJob('updatePrintLevels', {
Expand Down
1 change: 0 additions & 1 deletion app/lib/prisma.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import {getConfigValue} from './config.server'
declare global {
// This prevents us from making multiple connections to the db when the
// require cache is cleared.
// eslint-disable-next-line
var __prisma: PrismaClient | undefined
}

Expand Down
10 changes: 5 additions & 5 deletions app/root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ import {
isRouteErrorResponse,
useLoaderData
} from '@remix-run/react'
import type {
MetaFunction,
LinksFunction,
LoaderFunctionArgs
import {
json,
type MetaFunction,
type LinksFunction,
type LoaderFunctionArgs
} from '@remix-run/node'
import {json} from '@remix-run/node'
import {pick} from '@arcath/utils'
import colorString from 'color-string'

Expand Down
5 changes: 2 additions & 3 deletions app/routes/_index.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import type {LoaderFunction} from '@remix-run/node'
import {redirect} from '@remix-run/node'
import {redirect, type LoaderFunction} from '@remix-run/node'

import {getConfigValue} from '~/lib/config.server'

export const loader: LoaderFunction = async ({context}) => {
export const loader: LoaderFunction = async () => {
const target = await getConfigValue('indexPage')

return redirect(target)
Expand Down
4 changes: 2 additions & 2 deletions app/routes/admin.admins.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
type ActionFunctionArgs
} from '@remix-run/node'
import {useLoaderData, useRouteLoaderData} from '@remix-run/react'
import type {User} from '@prisma/client'
import {type User} from '@prisma/client'
import {invariant} from '@arcath/utils'

import {getUPNFromHeaders, getUserFromUPN} from '~/lib/user.server'
Expand All @@ -20,7 +20,7 @@ import {
labelSpanClasses
} from '~/lib/classes'

import type {RootLoaderData} from '~/root'
import {type RootLoaderData} from '~/root'

export const loader: LoaderFunction = async ({request}) => {
const user = await getUserFromUPN(getUPNFromHeaders(request))
Expand Down
8 changes: 6 additions & 2 deletions app/routes/admin.config.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import type {ActionFunction, LoaderFunction} from '@remix-run/node'
import {json, redirect} from '@remix-run/server-runtime'
import {
json,
redirect,
type ActionFunction,
type LoaderFunction
} from '@remix-run/node'
import {useLoaderData} from '@remix-run/react'
import {invariant, keys, asyncMap, asyncForEach} from '@arcath/utils'

Expand Down
3 changes: 1 addition & 2 deletions app/routes/admin.debug.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import type {LoaderFunction} from '@remix-run/node'
import {json} from '@remix-run/node'
import {json, type LoaderFunction} from '@remix-run/node'
import {useLoaderData} from '@remix-run/react'
import {keyValue} from '@arcath/utils'

Expand Down
4 changes: 2 additions & 2 deletions app/routes/admin.doodles.edit.$id.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -198,9 +198,9 @@ const AdminDoodlesEdit = () => {
<button className={buttonClasses()}>Update Doodle!</button>
<button
className={buttonClasses('bg-blue-300', ['col-start-3'])}
onClick={e => {
onClick={async e => {
e.preventDefault()
updatePreview()
await updatePreview()
}}
>
Preview Doodle!
Expand Down
10 changes: 7 additions & 3 deletions app/routes/admin.manual-users.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
import type {ActionFunction, LoaderFunction} from '@remix-run/node'
import {json, redirect} from '@remix-run/server-runtime'
import {
json,
redirect,
type ActionFunction,
type LoaderFunction
} from '@remix-run/node'
import {useLoaderData} from '@remix-run/react'
import {invariant} from '@arcath/utils'

import type {User} from '@prisma/client'
import {type User} from '@prisma/client'

import {getUPNFromHeaders, getUserFromUPN} from '~/lib/user.server'
import {getPrisma} from '~/lib/prisma'
Expand Down
2 changes: 1 addition & 1 deletion app/routes/aup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export const action = async ({request}: ActionFunctionArgs) => {
modification: createAttribute('member', dn)
})

await new Promise((resolve, reject) => {
await new Promise(resolve => {
client.modify(groupDN, [change], err => {
resolve(err)
})
Expand Down
5 changes: 2 additions & 3 deletions app/routes/import.staff.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import type {ActionFunction} from '@remix-run/node'
import {json, type ActionFunction} from '@remix-run/node'

import {json} from '@remix-run/node'
import {asyncForEach} from '@arcath/utils'

import {getPrisma} from '~/lib/prisma'
Expand Down Expand Up @@ -43,7 +42,7 @@ export const action: ActionFunction = async ({request}) => {

const prisma = getPrisma()

asyncForEach(staffMembers, async ({name, username}) => {
await asyncForEach(staffMembers, async ({name, username}) => {
const user = await prisma.user.findFirst({
where: {username}
})
Expand Down
6 changes: 2 additions & 4 deletions app/routes/import.students.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import type {ActionFunction} from '@remix-run/node'

import {json} from '@remix-run/node'
import {json, type ActionFunction} from '@remix-run/node'

import {getPrisma} from '~/lib/prisma'
import {getConfigValue} from '~/lib/config.server'
Expand Down Expand Up @@ -74,7 +72,7 @@ export const action: ActionFunction = async ({request}) => {

await prisma.user.create({data: newUser})
await log('Imports', `Added new student ${newUser.username}`)
}).catch(async reason => {
}).catch(async () => {
await log('Imports', `Could not import ${username}`)
})
}
Expand Down
2 changes: 1 addition & 1 deletion app/routes/reset-password.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ const resetPassword = async (username: string) => {
)
})

res.on('end', result => {
res.on('end', () => {
if (entries === 0) {
resolve({error: `Unable to find user ${username}`})
client.unbind()
Expand Down
5 changes: 3 additions & 2 deletions app/routes/shortcuts.manage.add.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import path from 'path'
import type {ActionFunction, LoaderFunction} from '@remix-run/node'
import {
type ActionFunction,
type LoaderFunction,
redirect,
unstable_parseMultipartFormData,
unstable_composeUploadHandlers,
unstable_createFileUploadHandler,
unstable_createMemoryUploadHandler,
json
} from '@remix-run/node'
import type {Shortcut} from '@prisma/client'
import {type Shortcut} from '@prisma/client'
import {invariant, clamp} from '@arcath/utils'

import {getUPNFromHeaders, getUserFromUPN} from '~/lib/user.server'
Expand Down
3 changes: 1 addition & 2 deletions app/routes/shortcuts.manage.delete.$id.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import type {LoaderFunction} from '@remix-run/node'
import {redirect} from '@remix-run/node'
import {type LoaderFunction, redirect} from '@remix-run/node'

import {getUPNFromHeaders, getUserFromUPN} from '~/lib/user.server'
import {getPrisma} from '~/lib/prisma'
Expand Down
5 changes: 3 additions & 2 deletions app/routes/shortcuts.manage.edit.$id.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import path from 'path'
import type {ActionFunction, LoaderFunction} from '@remix-run/node'
import {
type ActionFunction,
type LoaderFunction,
redirect,
unstable_parseMultipartFormData,
unstable_composeUploadHandlers,
Expand All @@ -9,7 +10,7 @@ import {
json
} from '@remix-run/node'
import {useLoaderData} from '@remix-run/react'
import type {Shortcut, User} from '@prisma/client'
import {type Shortcut, type User} from '@prisma/client'
import {invariant, clamp} from '@arcath/utils'

import {getUPNFromHeaders, getUserFromUPN} from '~/lib/user.server'
Expand Down
5 changes: 2 additions & 3 deletions app/routes/shortcuts.manage.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import type {LoaderFunction} from '@remix-run/node'
import type {User, Shortcut} from '@prisma/client'
import {json, type LoaderFunction} from '@remix-run/node'
import {type User, type Shortcut} from '@prisma/client'

import {json} from '@remix-run/node'
import {useLoaderData, Outlet} from '@remix-run/react'

import {getUPNFromHeaders, getUserFromUPN} from '~/lib/user.server'
Expand Down
5 changes: 2 additions & 3 deletions app/routes/wifi.claimed.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import type {LoaderFunction} from '@remix-run/node'
import type {User, WirelessVoucher} from '@prisma/client'
import {json, type LoaderFunction} from '@remix-run/node'
import {type User, type WirelessVoucher} from '@prisma/client'

import {json} from '@remix-run/node'
import {useLoaderData} from 'react-router'
import {format} from 'date-fns'

Expand Down
2 changes: 1 addition & 1 deletion app/routes/wifi.create.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type {ActionFunction, LoaderFunction} from '@remix-run/node'
import {type ActionFunction, type LoaderFunction} from '@remix-run/node'
import {json, redirect} from '@remix-run/server-runtime'
import {invariant, asyncForEach} from '@arcath/utils'

Expand Down
10 changes: 7 additions & 3 deletions app/routes/wifi.guest._index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import type {ActionFunction, LoaderFunction} from '@remix-run/node'
import type {User, WirelessVoucher} from '@prisma/client'
import {
json,
redirect,
type ActionFunction,
type LoaderFunction
} from '@remix-run/node'
import {type User, type WirelessVoucher} from '@prisma/client'

import {json, redirect} from '@remix-run/node'
import {useLoaderData} from 'react-router'
import {invariant} from '@arcath/utils'

Expand Down
3 changes: 2 additions & 1 deletion eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ export const config = [
'**/server-build/**',
'**/dist/**',
'**/coverage/**',
'.test.env'
'.test.env',
'docs/**'
]
},

Expand Down

0 comments on commit 43a6264

Please sign in to comment.