Skip to content

Commit 547b944

Browse files
committed
Enforce consistent import ordering and tab width
1 parent 3dbd855 commit 547b944

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+2110
-2150
lines changed

.prettierrc.json

+35-39
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,37 @@
11
{
2-
"arrowParens": "always",
3-
"bracketSpacing": true,
4-
"htmlWhitespaceSensitivity": "css",
5-
"insertPragma": false,
6-
"bracketSameLine": true,
7-
"jsxSingleQuote": true,
8-
"printWidth": 120,
9-
"proseWrap": "preserve",
10-
"quoteProps": "as-needed",
11-
"requirePragma": false,
12-
"semi": false,
13-
"singleQuote": true,
14-
"tabWidth": 2,
15-
"trailingComma": "es5",
16-
"useTabs": false,
17-
"endOfLine": "lf",
18-
"plugins": ["@ianvs/prettier-plugin-sort-imports", "prettier-plugin-tailwindcss"],
19-
"importOrder": [
20-
"^(react/(.*)$)|^(react$)",
21-
"^(next/(.*)$)|^(next$)",
22-
"<THIRD_PARTY_MODULES>",
23-
"",
24-
"^types$",
25-
"^@/types/(.*)$",
26-
"^@/config/(.*)$",
27-
"^@/lib/(.*)$",
28-
"^@/hooks/(.*)$",
29-
"^@/components/ui/(.*)$",
30-
"^@/components/(.*)$",
31-
"^@/app/(.*)$",
32-
"",
33-
"^[./]"
34-
],
35-
"importOrderSeparation": false,
36-
"importOrderSortSpecifiers": true,
37-
"importOrderBuiltinModulesToTop": true,
38-
"importOrderParserPlugins": ["typescript", "jsx", "decorators-legacy"],
39-
"importOrderMergeDuplicateImports": true,
40-
"importOrderCombineTypeAndValueImports": true
2+
"arrowParens": "always",
3+
"bracketSpacing": true,
4+
"htmlWhitespaceSensitivity": "css",
5+
"insertPragma": false,
6+
"bracketSameLine": true,
7+
"jsxSingleQuote": true,
8+
"printWidth": 120,
9+
"proseWrap": "preserve",
10+
"quoteProps": "as-needed",
11+
"requirePragma": false,
12+
"semi": false,
13+
"singleQuote": true,
14+
"tabWidth": 2,
15+
"trailingComma": "es5",
16+
"useTabs": false,
17+
"endOfLine": "lf",
18+
"plugins": ["@ianvs/prettier-plugin-sort-imports", "prettier-plugin-tailwindcss"],
19+
"importOrder": [
20+
"^(react/(.*)$)|^(react$)",
21+
"^(next/(.*)$)|^(next$)",
22+
"^(next-(.*)$)",
23+
"<THIRD_PARTY_MODULES>",
24+
"",
25+
"^types$",
26+
"^@/types/(.*)$",
27+
"^@/config/(.*)$",
28+
"^@/lib/(.*)$",
29+
"^@/hooks/(.*)$",
30+
"^@/components/ui/(.*)$",
31+
"^@/components/(.*)$",
32+
"^@/app/(.*)$",
33+
"",
34+
"^[./]"
35+
],
36+
"importOrderParserPlugins": ["typescript", "jsx", "decorators-legacy"]
4137
}

bun.lockb

563 Bytes
Binary file not shown.

drizzle.config.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import type { Config } from 'drizzle-kit'
22

33
export default {
4-
schema: './src/lib/db/schema.ts',
5-
dialect: 'postgresql',
6-
dbCredentials: {
7-
url: process.env.POSTGRES_URL!
8-
}
4+
schema: './src/lib/db/schema.ts',
5+
dialect: 'postgresql',
6+
dbCredentials: {
7+
url: process.env.POSTGRES_URL!,
8+
},
99
} satisfies Config

middleware.ts

+35-35
Original file line numberDiff line numberDiff line change
@@ -6,45 +6,45 @@ import { signToken, verifyToken } from '@/lib/auth/session'
66
const protectedRoutes = '/dashboard'
77

88
export async function middleware(request: NextRequest) {
9-
const { pathname } = request.nextUrl
10-
const sessionCookie = request.cookies.get('session')
11-
const isProtectedRoute = pathname.startsWith(protectedRoutes)
12-
13-
if (isProtectedRoute && !sessionCookie) {
9+
const { pathname } = request.nextUrl
10+
const sessionCookie = request.cookies.get('session')
11+
const isProtectedRoute = pathname.startsWith(protectedRoutes)
12+
13+
if (isProtectedRoute && !sessionCookie) {
14+
return NextResponse.redirect(new URL('/sign-in', request.url))
15+
}
16+
17+
const res = NextResponse.next()
18+
19+
if (sessionCookie) {
20+
try {
21+
const parsed = await verifyToken(sessionCookie.value)
22+
const expiresInOneDay = new Date(Date.now() + 24 * 60 * 60 * 1000)
23+
24+
res.cookies.set({
25+
name: 'session',
26+
value: await signToken({
27+
...parsed,
28+
expires: expiresInOneDay.toISOString(),
29+
}),
30+
httpOnly: true,
31+
secure: true,
32+
sameSite: 'lax',
33+
expires: expiresInOneDay,
34+
})
35+
} catch (error) {
36+
console.error('Error updating session:', error)
37+
res.cookies.delete('session')
38+
if (isProtectedRoute) {
1439
return NextResponse.redirect(new URL('/sign-in', request.url))
40+
}
1541
}
42+
}
1643

17-
const res = NextResponse.next()
18-
19-
if (sessionCookie) {
20-
try {
21-
const parsed = await verifyToken(sessionCookie.value)
22-
const expiresInOneDay = new Date(Date.now() + 24 * 60 * 60 * 1000)
23-
24-
res.cookies.set({
25-
name: 'session',
26-
value: await signToken({
27-
...parsed,
28-
expires: expiresInOneDay.toISOString()
29-
}),
30-
httpOnly: true,
31-
secure: true,
32-
sameSite: 'lax',
33-
expires: expiresInOneDay
34-
})
35-
} catch (error) {
36-
console.error('Error updating session:', error)
37-
res.cookies.delete('session')
38-
if (isProtectedRoute) {
39-
return NextResponse.redirect(new URL('/sign-in', request.url))
40-
}
41-
}
42-
}
43-
44-
return res
44+
return res
4545
}
4646

4747
export const config = {
48-
runtime: 'nodejs',
49-
matcher: ['/((?!api|_next/static|_next/image|favicon.ico).*)']
48+
runtime: 'nodejs',
49+
matcher: ['/((?!api|_next/static|_next/image|favicon.ico).*)'],
5050
}

next.config.ts

+6-7
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
11
import type { NextConfig } from 'next'
2-
32
import initializeBundleAnalyzer from '@next/bundle-analyzer'
43

54
// https://www.npmjs.com/package/@next/bundle-analyzer
65
const withBundleAnalyzer = initializeBundleAnalyzer({
7-
enabled: true
6+
enabled: true,
87
})
98

109
// https://nextjs.org/docs/pages/api-reference/next-config-js
1110
const nextConfig: NextConfig = {
12-
output: 'standalone',
13-
experimental: {
14-
turbo: {},
15-
nodeMiddleware: true
16-
}
11+
output: 'standalone',
12+
experimental: {
13+
turbo: {},
14+
nodeMiddleware: true,
15+
},
1716
}
1817

1918
export default process.env.BUNDLE_ANALYZER_ENABLED === 'true' ? withBundleAnalyzer(nextConfig) : nextConfig

openapi-ts.config.ts

+10-10
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import { defaultPlugins, defineConfig } from '@hey-api/openapi-ts'
22

33
export default defineConfig({
4-
input: 'http://localhost:8080/openapi.json',
5-
output: 'src/lib/client',
6-
plugins: [
7-
...defaultPlugins,
8-
'@hey-api/client-fetch',
9-
{
10-
asClass: true,
11-
name: '@hey-api/sdk'
12-
}
13-
]
4+
input: 'http://localhost:8080/openapi.json',
5+
output: 'src/lib/client',
6+
plugins: [
7+
...defaultPlugins,
8+
'@hey-api/client-fetch',
9+
{
10+
asClass: true,
11+
name: '@hey-api/sdk',
12+
},
13+
],
1414
})

package.json

+64-64
Original file line numberDiff line numberDiff line change
@@ -1,66 +1,66 @@
11
{
2-
"name": "riven-frontend",
3-
"version": "1.0.0",
4-
"private": false,
5-
"scripts": {
6-
"dev": "next dev --turbopack",
7-
"build": "next build",
8-
"start": "next start",
9-
"lint": "next lint",
10-
"lint:fix": "next lint --fix",
11-
"typecheck": "tsc --noEmit",
12-
"format": "prettier --check \"**/*.{ts,tsx}\" --cache",
13-
"format:fix": "prettier --write \"**/*.{ts,tsx}\" --cache",
14-
"db:push": "drizzle-kit push",
15-
"db:studio": "drizzle-kit studio",
16-
"generate-client": "openapi-ts"
17-
},
18-
"dependencies": {
19-
"@hey-api/client-fetch": "^0.8.1",
20-
"@radix-ui/react-checkbox": "^1.1.3",
21-
"@radix-ui/react-dropdown-menu": "^2.1.5",
22-
"@radix-ui/react-label": "^2.1.2",
23-
"@radix-ui/react-select": "^2.1.5",
24-
"@tailwindcss/postcss": "^4.0.3",
25-
"bcryptjs": "^2.4.3",
26-
"class-variance-authority": "^0.7.1",
27-
"drizzle-orm": "^0.39.3",
28-
"jose": "^5.9.6",
29-
"lucide-react": "^0.474.0",
30-
"next": "^15.2.0-canary.54",
31-
"next-themes": "^0.4.4",
32-
"postgres": "^3.4.5",
33-
"react": "19.0.0",
34-
"react-dom": "19.0.0",
35-
"sonner": "^1.7.4",
36-
"tailwind-merge": "^3.0.1",
37-
"tailwindcss": "^4.0.3",
38-
"vaul": "^1.1.2",
39-
"zod": "^3.24.2"
40-
},
41-
"devDependencies": {
42-
"@eslint/js": "^9.19.0",
43-
"@hey-api/openapi-ts": "^0.64.1",
44-
"@next/bundle-analyzer": "^15.1.6",
45-
"@next/eslint-plugin-next": "^15.1.6",
46-
"@trivago/prettier-plugin-sort-imports": "^5.2.2",
47-
"@types/bcryptjs": "^2.4.6",
48-
"@types/node": "^22.13.0",
49-
"@types/react": "19.0.8",
50-
"@types/react-dom": "19.0.3",
51-
"drizzle-kit": "^0.30.4",
52-
"eslint": "^9.19.0",
53-
"eslint-config-next": "15.1.6",
54-
"eslint-config-prettier": "^10.0.1",
55-
"eslint-plugin-import": "^2.31.0",
56-
"eslint-plugin-promise": "^7.2.1",
57-
"eslint-plugin-react": "^7.37.4",
58-
"eslint-plugin-tailwindcss": "^3.18.0",
59-
"globals": "^15.14.0",
60-
"postcss": "^8.5.1",
61-
"prettier": "^3.4.2",
62-
"prettier-plugin-tailwindcss": "^0.6.11",
63-
"typescript": "^5.7.3",
64-
"typescript-eslint": "^8.22.0"
65-
}
2+
"name": "riven-frontend",
3+
"version": "1.0.0",
4+
"private": false,
5+
"scripts": {
6+
"dev": "next dev --turbopack",
7+
"build": "next build",
8+
"start": "next start",
9+
"lint": "next lint",
10+
"lint:fix": "next lint --fix",
11+
"typecheck": "tsc --noEmit",
12+
"format": "prettier --check \"**/*.{ts,tsx}\" --cache",
13+
"format:fix": "prettier --write \"**/*.{ts,tsx}\" --cache",
14+
"db:push": "drizzle-kit push",
15+
"db:studio": "drizzle-kit studio",
16+
"generate-client": "openapi-ts"
17+
},
18+
"dependencies": {
19+
"@hey-api/client-fetch": "^0.8.1",
20+
"@radix-ui/react-checkbox": "^1.1.3",
21+
"@radix-ui/react-dropdown-menu": "^2.1.5",
22+
"@radix-ui/react-label": "^2.1.2",
23+
"@radix-ui/react-select": "^2.1.5",
24+
"@tailwindcss/postcss": "^4.0.3",
25+
"bcryptjs": "^2.4.3",
26+
"class-variance-authority": "^0.7.1",
27+
"drizzle-orm": "^0.39.3",
28+
"jose": "^5.9.6",
29+
"lucide-react": "^0.474.0",
30+
"next": "^15.2.0-canary.54",
31+
"next-themes": "^0.4.4",
32+
"postgres": "^3.4.5",
33+
"react": "19.0.0",
34+
"react-dom": "19.0.0",
35+
"sonner": "^1.7.4",
36+
"tailwind-merge": "^3.0.1",
37+
"tailwindcss": "^4.0.3",
38+
"vaul": "^1.1.2",
39+
"zod": "^3.24.2"
40+
},
41+
"devDependencies": {
42+
"@eslint/js": "^9.19.0",
43+
"@hey-api/openapi-ts": "^0.64.1",
44+
"@ianvs/prettier-plugin-sort-imports": "^4.4.1",
45+
"@next/bundle-analyzer": "^15.1.6",
46+
"@next/eslint-plugin-next": "^15.1.6",
47+
"@types/bcryptjs": "^2.4.6",
48+
"@types/node": "^22.13.0",
49+
"@types/react": "19.0.8",
50+
"@types/react-dom": "19.0.3",
51+
"drizzle-kit": "^0.30.4",
52+
"eslint": "^9.19.0",
53+
"eslint-config-next": "15.1.6",
54+
"eslint-config-prettier": "^10.0.1",
55+
"eslint-plugin-import": "^2.31.0",
56+
"eslint-plugin-promise": "^7.2.1",
57+
"eslint-plugin-react": "^7.37.4",
58+
"eslint-plugin-tailwindcss": "^3.18.0",
59+
"globals": "^15.14.0",
60+
"postcss": "^8.5.1",
61+
"prettier": "^3.4.2",
62+
"prettier-plugin-tailwindcss": "^0.6.11",
63+
"typescript": "^5.7.3",
64+
"typescript-eslint": "^8.22.0"
65+
}
6666
}

src/app/(dashboard)/dashboard/layout.tsx

+12-12
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,22 @@
33
import { type ReactNode } from 'react'
44

55
interface SidebarProps {
6-
children: ReactNode
6+
children: ReactNode
77
}
88

99
function Sidebar({ children }: SidebarProps) {
10-
return (
11-
<div className='container-wrapper'>
12-
<div className='container flex-1 items-start md:grid md:grid-cols-[220px_minmax(0,1fr)] md:gap-6 lg:grid-cols-[240px_minmax(0,1fr)] lg:gap-10'>
13-
<aside className='border-grid fixed top-14 z-30 hidden h-[calc(100vh-3.5rem)] w-full shrink-0 border-r md:sticky md:block'>
14-
<div className='no-scrollbar h-full overflow-auto py-6 pr-4 lg:py-8'>Dashboard</div>
15-
</aside>
16-
{children}
17-
</div>
18-
</div>
19-
)
10+
return (
11+
<div className='container-wrapper'>
12+
<div className='container flex-1 items-start md:grid md:grid-cols-[220px_minmax(0,1fr)] md:gap-6 lg:grid-cols-[240px_minmax(0,1fr)] lg:gap-10'>
13+
<aside className='border-grid fixed top-14 z-30 hidden h-[calc(100vh-3.5rem)] w-full shrink-0 border-r md:sticky md:block'>
14+
<div className='no-scrollbar h-full overflow-auto py-6 pr-4 lg:py-8'>Dashboard</div>
15+
</aside>
16+
{children}
17+
</div>
18+
</div>
19+
)
2020
}
2121

2222
export default function DashboardLayout({ children }: SidebarProps) {
23-
return <Sidebar>{children}</Sidebar>
23+
return <Sidebar>{children}</Sidebar>
2424
}

0 commit comments

Comments
 (0)