Skip to content

Commit e80ecb1

Browse files
authored
Merge pull request #59 from UTDNebula/prettier-import-sort
removed eslint formatting and added prettier formatting
2 parents 53c4409 + 892f91a commit e80ecb1

File tree

25 files changed

+140
-165
lines changed

25 files changed

+140
-165
lines changed

.prettierrc.mjs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,16 @@ const config = {
1111
useTabs: false,
1212
bracketSameLine: false,
1313
endOfLine: 'auto',
14-
plugins: ['prettier-plugin-tailwindcss'],
14+
plugins: [
15+
'prettier-plugin-tailwindcss',
16+
'@ianvs/prettier-plugin-sort-imports',
17+
],
18+
importOrder: [
19+
'<BUILTIN_MODULES>', // Node.js built-in modules
20+
'<THIRD_PARTY_MODULES>', // Imports not matched by other special words or groups.
21+
'^(@src)(/.*)$',
22+
'^[.]', // relative imports
23+
],
1524
};
1625

1726
export default config;

next.config.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { withSentryConfig } from '@sentry/nextjs';
2+
23
/**
34
* Run `build` or `dev` with `SKIP_ENV_VALIDATION` to skip env validation. This is especially useful
45
* for Docker builds.

package-lock.json

Lines changed: 35 additions & 45 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
"@emotion/react": "^11.14.0",
2020
"@emotion/styled": "^11.14.1",
2121
"@hookform/resolvers": "^3.3.2",
22+
"@ianvs/prettier-plugin-sort-imports": "^4.7.0",
2223
"@mui/icons-material": "^7.3.1",
2324
"@mui/material": "^7.3.1",
2425
"@mui/material-nextjs": "^7.3.0",
@@ -74,7 +75,6 @@
7475
"eslint-plugin-jsx-a11y": "^6.5.1",
7576
"eslint-plugin-react": "^7.29.4",
7677
"eslint-plugin-react-hooks": "^4.4.0",
77-
"eslint-plugin-simple-import-sort": "^7.0.0",
7878
"jest": "^29.7.0",
7979
"postcss": "^8.4.27",
8080
"prettier": "^3.2.5",

src/app/api/auth/[...nextauth]/route.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import NextAuth from 'next-auth';
2-
32
import { authOptions } from '@src/server/auth';
43

54
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment

src/app/api/files/upload/route.ts

Lines changed: 16 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
import { NextResponse } from 'next/server';
2-
import { db } from '@src/server/db';
3-
import { file } from '@src/server/db/schema/file';
4-
import { and, eq } from 'drizzle-orm';
5-
import { getServerAuthSession } from '@src/server/auth';
61
import fs from 'fs';
72
import path from 'path';
8-
3+
import { and, eq } from 'drizzle-orm';
4+
import { NextResponse } from 'next/server';
95
import { z } from 'zod';
6+
import { getServerAuthSession } from '@src/server/auth';
7+
import { db } from '@src/server/db';
8+
import { file } from '@src/server/db/schema/file';
109

1110
const allowedTypes = ['image/png', 'image/jpeg', 'application/pdf'];
1211

@@ -15,10 +14,10 @@ const uploadFormSchema = z.object({
1514
prefix: z.string().min(1, { message: 'Prefix is missing' }),
1615
courseNumber: z.string().min(1, { message: 'Course number is missing' }),
1716
sectionCode: z.string().min(1, { message: 'Section code is missing' }),
18-
professor: z.string().min(1 , { message: 'Professor is missing' }),
17+
professor: z.string().min(1, { message: 'Professor is missing' }),
1918
term: z.enum(['Spring', 'Summer', 'Fall']),
20-
year: z.coerce.number({ message: 'Year is missing'}),
21-
})
19+
year: z.coerce.number({ message: 'Year is missing' }),
20+
});
2221

2322
// Upload file to database w/ file metadata (Local)
2423
export async function POST(req: Request) {
@@ -42,17 +41,11 @@ export async function POST(req: Request) {
4241
const newFile = data.file as File;
4342

4443
if (!(newFile instanceof File)) {
45-
return NextResponse.json(
46-
{ error: 'Invalid file upload' },
47-
{ status: 400 },
48-
);
44+
return NextResponse.json({ error: 'Invalid file upload' }, { status: 400 });
4945
}
50-
46+
5147
if (newFile.size === 0) {
52-
return NextResponse.json(
53-
{ error: 'File is empty' },
54-
{ status: 400 },
55-
);
48+
return NextResponse.json({ error: 'File is empty' }, { status: 400 });
5649
}
5750

5851
if (!allowedTypes.includes(newFile.type)) {
@@ -76,10 +69,7 @@ export async function POST(req: Request) {
7669
});
7770

7871
if (!sectionData) {
79-
return NextResponse.json(
80-
{ error: 'Section not found' },
81-
{ status: 404 },
82-
);
72+
return NextResponse.json({ error: 'Section not found' }, { status: 404 });
8373
}
8474

8575
try {
@@ -96,10 +86,10 @@ export async function POST(req: Request) {
9686
const fileMetadata = {
9787
authorId: session.user.id,
9888
sectionId: sectionData.id,
99-
fileTitle: newFile.name, // required by schema
100-
fileName: newFile.name, // required by schema
89+
fileTitle: newFile.name, // required by schema
90+
fileName: newFile.name, // required by schema
10191
};
102-
92+
10393
const result = await db.insert(file).values(fileMetadata).returning();
10494

10595
return NextResponse.json(
@@ -108,9 +98,6 @@ export async function POST(req: Request) {
10898
);
10999
} catch (err) {
110100
console.error('File upload error:', err);
111-
return NextResponse.json(
112-
{ error: 'File upload failed' },
113-
{ status: 500 },
114-
);
101+
return NextResponse.json({ error: 'File upload failed' }, { status: 500 });
115102
}
116103
}

src/app/api/reports/route.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,12 @@
44
import { NextResponse } from 'next/server'; // Used to send HTTP responses (JSON, status codes)
55
import { z } from 'zod'; // Zod validates and parses input data
66

7+
// Import session helper to check if a user is logged in
8+
import { getServerAuthSession } from '@src/server/auth';
79
// Import database connection and the "report" table schema
810
import { db } from '@src/server/db';
911
import { report } from '@src/server/db/schema/reports';
1012

11-
// Import session helper to check if a user is logged in
12-
import { getServerAuthSession } from '@src/server/auth';
13-
1413
// This ensures the API only accepts the correct fields
1514
const CreateReportSchema = z.object({
1615
fileId: z.string().min(1),

src/app/layout.tsx

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
import '@src/styles/globals.css';
2-
3-
import { ThemeProvider } from '@mui/material/styles';
42
import { AppRouterCacheProvider } from '@mui/material-nextjs/v15-appRouter';
5-
import { Bai_Jamjuree, Inter } from 'next/font/google';
6-
import { type Metadata } from 'next';
3+
import { ThemeProvider } from '@mui/material/styles';
74
import { GoogleAnalytics } from '@next/third-parties/google';
5+
import { type Metadata } from 'next';
6+
import { Bai_Jamjuree, Inter } from 'next/font/google';
87
import Link from 'next/link';
9-
10-
import theme from '@src/utils/theme';
118
import { ToastProvider } from '@src/components/toast/ToastProvider';
9+
import theme from '@src/utils/theme';
1210

1311
const inter = Inter({
1412
subsets: ['latin'],

src/app/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import type { Metadata } from 'next';
21
import NavBar from '@components/NavBar';
2+
import type { Metadata } from 'next';
33

44
export const metadata: Metadata = {
55
alternates: {

src/components/NavBar.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import React from 'react';
2-
import Link from 'next/link';
3-
import Image from 'next/image';
41
import { IconButton, Tooltip } from '@mui/material';
2+
import Image from 'next/image';
3+
import Link from 'next/link';
4+
import React from 'react';
55

66
export default function NavBar() {
77
return (

0 commit comments

Comments
 (0)