From 3b36663ae645f71502d1d80454005236b1a7bc5c Mon Sep 17 00:00:00 2001 From: JohanHjelsethStorstad <82723971+JohanHjelsethStorstad@users.noreply.github.com> Date: Tue, 31 Oct 2023 20:23:30 +0100 Subject: [PATCH 01/25] chore: add linting spesific for ts --- .eslintrc.json | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.eslintrc.json b/.eslintrc.json index bffb357a7..4eb6eb2c6 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -1,3 +1,10 @@ { - "extends": "next/core-web-vitals" + "extends": [ + "next/core-web-vitals", + "eslint:recommended", + "plugin:@typescript-eslint/recommended" + ], + "parser": "@typescript-eslint/parser", + "plugins": ["@typescript-eslint"], + "root": true } From 2e963df2c81c49c2a602f17f724f719313ecfeb9 Mon Sep 17 00:00:00 2001 From: JohanHjelsethStorstad <82723971+JohanHjelsethStorstad@users.noreply.github.com> Date: Tue, 31 Oct 2023 20:30:38 +0100 Subject: [PATCH 02/25] chore: install dev dependecies for linting ts --- package-lock.json | 151 +++++++++++++++++++++++++++++++++------- package.json | 2 + src/typings/global.d.ts | 1 + 3 files changed, 129 insertions(+), 25 deletions(-) diff --git a/package-lock.json b/package-lock.json index 99edbed35..692339056 100644 --- a/package-lock.json +++ b/package-lock.json @@ -31,6 +31,8 @@ "@types/react": "^18.2.33", "@types/react-dom": "^18.2.14", "@types/uuid": "^9.0.6", + "@typescript-eslint/eslint-plugin": "^6.9.1", + "@typescript-eslint/parser": "^6.9.1", "prisma": "^5.4.2", "typescript": "^5.2.2" } @@ -450,6 +452,12 @@ "@types/react": "*" } }, + "node_modules/@types/json-schema": { + "version": "7.0.14", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.14.tgz", + "integrity": "sha512-U3PUjAudAdJBeC2pgN8uTIKgxrb4nlDF3SF0++EldXQvQBGkpFZMSnwQiIoDU77tv45VgNkl/L4ouD+rEomujw==", + "dev": true + }, "node_modules/@types/json5": { "version": "0.0.29", "resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz", @@ -496,21 +504,62 @@ "integrity": "sha512-s/FPdYRmZR8SjLWGMCuax7r3qCWQw9QKHzXVukAuuIJkXkDRwp+Pu5LMIVFi0Fxbav35WURicYr8u1QsoybnQw==", "dev": true }, + "node_modules/@types/semver": { + "version": "7.5.4", + "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.5.4.tgz", + "integrity": "sha512-MMzuxN3GdFwskAnb6fz0orFvhfqi752yjaXylr0Rp4oDg5H0Zn1IuyRhDVvYOwAXoJirx2xuS16I3WjxnAIHiQ==", + "dev": true + }, "node_modules/@types/uuid": { "version": "9.0.6", "resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-9.0.6.tgz", "integrity": "sha512-BT2Krtx4xaO6iwzwMFUYvWBWkV2pr37zD68Vmp1CDV196MzczBRxuEpD6Pr395HAgebC/co7hOphs53r8V7jew==", "dev": true }, + "node_modules/@typescript-eslint/eslint-plugin": { + "version": "6.9.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.9.1.tgz", + "integrity": "sha512-w0tiiRc9I4S5XSXXrMHOWgHgxbrBn1Ro+PmiYhSg2ZVdxrAJtQgzU5o2m1BfP6UOn7Vxcc6152vFjQfmZR4xEg==", + "dev": true, + "dependencies": { + "@eslint-community/regexpp": "^4.5.1", + "@typescript-eslint/scope-manager": "6.9.1", + "@typescript-eslint/type-utils": "6.9.1", + "@typescript-eslint/utils": "6.9.1", + "@typescript-eslint/visitor-keys": "6.9.1", + "debug": "^4.3.4", + "graphemer": "^1.4.0", + "ignore": "^5.2.4", + "natural-compare": "^1.4.0", + "semver": "^7.5.4", + "ts-api-utils": "^1.0.1" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "@typescript-eslint/parser": "^6.0.0 || ^6.0.0-alpha", + "eslint": "^7.0.0 || ^8.0.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, "node_modules/@typescript-eslint/parser": { - "version": "6.4.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-6.4.1.tgz", - "integrity": "sha512-610G6KHymg9V7EqOaNBMtD1GgpAmGROsmfHJPXNLCU9bfIuLrkdOygltK784F6Crboyd5tBFayPB7Sf0McrQwg==", - "dependencies": { - "@typescript-eslint/scope-manager": "6.4.1", - "@typescript-eslint/types": "6.4.1", - "@typescript-eslint/typescript-estree": "6.4.1", - "@typescript-eslint/visitor-keys": "6.4.1", + "version": "6.9.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-6.9.1.tgz", + "integrity": "sha512-C7AK2wn43GSaCUZ9do6Ksgi2g3mwFkMO3Cis96kzmgudoVaKyt62yNzJOktP0HDLb/iO2O0n2lBOzJgr6Q/cyg==", + "dependencies": { + "@typescript-eslint/scope-manager": "6.9.1", + "@typescript-eslint/types": "6.9.1", + "@typescript-eslint/typescript-estree": "6.9.1", + "@typescript-eslint/visitor-keys": "6.9.1", "debug": "^4.3.4" }, "engines": { @@ -530,12 +579,31 @@ } }, "node_modules/@typescript-eslint/scope-manager": { - "version": "6.4.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.4.1.tgz", - "integrity": "sha512-p/OavqOQfm4/Hdrr7kvacOSFjwQ2rrDVJRPxt/o0TOWdFnjJptnjnZ+sYDR7fi4OimvIuKp+2LCkc+rt9fIW+A==", + "version": "6.9.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.9.1.tgz", + "integrity": "sha512-38IxvKB6NAne3g/+MyXMs2Cda/Sz+CEpmm+KLGEM8hx/CvnSRuw51i8ukfwB/B/sESdeTGet1NH1Wj7I0YXswg==", + "dependencies": { + "@typescript-eslint/types": "6.9.1", + "@typescript-eslint/visitor-keys": "6.9.1" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/type-utils": { + "version": "6.9.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-6.9.1.tgz", + "integrity": "sha512-eh2oHaUKCK58qIeYp19F5V5TbpM52680sB4zNSz29VBQPTWIlE/hCj5P5B1AChxECe/fmZlspAWFuRniep1Skg==", + "dev": true, "dependencies": { - "@typescript-eslint/types": "6.4.1", - "@typescript-eslint/visitor-keys": "6.4.1" + "@typescript-eslint/typescript-estree": "6.9.1", + "@typescript-eslint/utils": "6.9.1", + "debug": "^4.3.4", + "ts-api-utils": "^1.0.1" }, "engines": { "node": "^16.0.0 || >=18.0.0" @@ -543,12 +611,20 @@ "funding": { "type": "opencollective", "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^7.0.0 || ^8.0.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } } }, "node_modules/@typescript-eslint/types": { - "version": "6.4.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.4.1.tgz", - "integrity": "sha512-zAAopbNuYu++ijY1GV2ylCsQsi3B8QvfPHVqhGdDcbx/NK5lkqMnCGU53amAjccSpk+LfeONxwzUhDzArSfZJg==", + "version": "6.9.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.9.1.tgz", + "integrity": "sha512-BUGslGOb14zUHOUmDB2FfT6SI1CcZEJYfF3qFwBeUrU6srJfzANonwRYHDpLBuzbq3HaoF2XL2hcr01c8f8OaQ==", "engines": { "node": "^16.0.0 || >=18.0.0" }, @@ -558,12 +634,12 @@ } }, "node_modules/@typescript-eslint/typescript-estree": { - "version": "6.4.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.4.1.tgz", - "integrity": "sha512-xF6Y7SatVE/OyV93h1xGgfOkHr2iXuo8ip0gbfzaKeGGuKiAnzS+HtVhSPx8Www243bwlW8IF7X0/B62SzFftg==", + "version": "6.9.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.9.1.tgz", + "integrity": "sha512-U+mUylTHfcqeO7mLWVQ5W/tMLXqVpRv61wm9ZtfE5egz7gtnmqVIw9ryh0mgIlkKk9rZLY3UHygsBSdB9/ftyw==", "dependencies": { - "@typescript-eslint/types": "6.4.1", - "@typescript-eslint/visitor-keys": "6.4.1", + "@typescript-eslint/types": "6.9.1", + "@typescript-eslint/visitor-keys": "6.9.1", "debug": "^4.3.4", "globby": "^11.1.0", "is-glob": "^4.0.3", @@ -583,12 +659,37 @@ } } }, + "node_modules/@typescript-eslint/utils": { + "version": "6.9.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.9.1.tgz", + "integrity": "sha512-L1T0A5nFdQrMVunpZgzqPL6y2wVreSyHhKGZryS6jrEN7bD9NplVAyMryUhXsQ4TWLnZmxc2ekar/lSGIlprCA==", + "dev": true, + "dependencies": { + "@eslint-community/eslint-utils": "^4.4.0", + "@types/json-schema": "^7.0.12", + "@types/semver": "^7.5.0", + "@typescript-eslint/scope-manager": "6.9.1", + "@typescript-eslint/types": "6.9.1", + "@typescript-eslint/typescript-estree": "6.9.1", + "semver": "^7.5.4" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^7.0.0 || ^8.0.0" + } + }, "node_modules/@typescript-eslint/visitor-keys": { - "version": "6.4.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.4.1.tgz", - "integrity": "sha512-y/TyRJsbZPkJIZQXrHfdnxVnxyKegnpEvnRGNam7s3TRR2ykGefEWOhaef00/UUN3IZxizS7BTO3svd3lCOJRQ==", + "version": "6.9.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.9.1.tgz", + "integrity": "sha512-MUaPUe/QRLEffARsmNfmpghuQkW436DvESW+h+M52w0coICHRfD6Np9/K6PdACwnrq1HmuLl+cSPZaJmeVPkSw==", "dependencies": { - "@typescript-eslint/types": "6.4.1", + "@typescript-eslint/types": "6.9.1", "eslint-visitor-keys": "^3.4.1" }, "engines": { diff --git a/package.json b/package.json index 50e8bc4a6..466ae0fe8 100644 --- a/package.json +++ b/package.json @@ -36,6 +36,8 @@ "@types/react": "^18.2.33", "@types/react-dom": "^18.2.14", "@types/uuid": "^9.0.6", + "@typescript-eslint/eslint-plugin": "^6.9.1", + "@typescript-eslint/parser": "^6.9.1", "prisma": "^5.4.2", "typescript": "^5.2.2" } diff --git a/src/typings/global.d.ts b/src/typings/global.d.ts index 8f6fcabb1..308b52966 100644 --- a/src/typings/global.d.ts +++ b/src/typings/global.d.ts @@ -2,5 +2,6 @@ import { Prisma, PrismaClient } from "@prisma/client"; import { DefaultArgs } from "@prisma/client/runtime/library"; declare global { + // eslint-disable-next-line no-var var prisma: PrismaClient } \ No newline at end of file From 80e2cd06bf2fc2c108e6d60b9b68c5b61ba9eb33 Mon Sep 17 00:00:00 2001 From: JohanHjelsethStorstad <82723971+JohanHjelsethStorstad@users.noreply.github.com> Date: Tue, 31 Oct 2023 20:33:08 +0100 Subject: [PATCH 03/25] chore: fix linting --- src/app/(auth)/logout/page.tsx | 4 ---- src/app/components/SocialIcons/SocialIcons.tsx | 1 - src/app/users/[username]/page.tsx | 2 +- src/auth/index.ts | 4 ++-- 4 files changed, 3 insertions(+), 8 deletions(-) diff --git a/src/app/(auth)/logout/page.tsx b/src/app/(auth)/logout/page.tsx index ec1fc79b8..353b32d88 100644 --- a/src/app/(auth)/logout/page.tsx +++ b/src/app/(auth)/logout/page.tsx @@ -1,5 +1,3 @@ -import { getCsrfToken } from "next-auth/react" - import styles from './page.module.scss' import magiskHatt from "@/images/magisk_hatt.png" import Image from 'next/image' @@ -7,8 +5,6 @@ import PrimaryButton from '@/components/PrimaryButton/PrimaryButton' import CsrfToken from '../CsrfToken' export default async function LogOut() { - const csrfToken = await getCsrfToken() - return (
diff --git a/src/app/components/SocialIcons/SocialIcons.tsx b/src/app/components/SocialIcons/SocialIcons.tsx index 74c5ee56f..ce67f57ec 100644 --- a/src/app/components/SocialIcons/SocialIcons.tsx +++ b/src/app/components/SocialIcons/SocialIcons.tsx @@ -1,4 +1,3 @@ -import styles from './SocialIcons.module.scss' import Link from 'next/link' import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' diff --git a/src/app/users/[username]/page.tsx b/src/app/users/[username]/page.tsx index e9e7fa7d2..dbd31632d 100644 --- a/src/app/users/[username]/page.tsx +++ b/src/app/users/[username]/page.tsx @@ -23,7 +23,7 @@ async function AuthTest({ params }: PropTypes) { } const me = params.username === "me" - let username = me ? session.user.username : params.username + const username = me ? session.user.username : params.username const user = await prisma.user.findUnique({ where: { diff --git a/src/auth/index.ts b/src/auth/index.ts index 288e241ce..1a88bb322 100644 --- a/src/auth/index.ts +++ b/src/auth/index.ts @@ -1,5 +1,5 @@ import CredentialsProvider from "next-auth/providers/credentials" -import { AuthOptions, User } from "next-auth" +import { AuthOptions } from "next-auth" import prisma from "@/prisma" @@ -11,7 +11,7 @@ const authOptions : AuthOptions = { username: { label: "Username", type: "text" }, password: { label: "Password", type: "password" } }, - authorize: async (credentials, req) => { + authorize: async (credentials) => { const user = await prisma.user.findUnique({ where: { username: credentials?.username From 46d7a0e4aa5fc9539410662527caae5d16e7c149 Mon Sep 17 00:00:00 2001 From: JohanHjelsethStorstad <82723971+JohanHjelsethStorstad@users.noreply.github.com> Date: Tue, 31 Oct 2023 20:39:04 +0100 Subject: [PATCH 04/25] chore: add indent rule --- .eslintrc.json | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/.eslintrc.json b/.eslintrc.json index 4eb6eb2c6..62edf9b20 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -6,5 +6,15 @@ ], "parser": "@typescript-eslint/parser", "plugins": ["@typescript-eslint"], - "root": true + "root": true, + "rules": { + "indent": [ + "error", + 4, + { + "SwitchCase": 1, + "VariableDeclarator": 1 + } + ] + } } From 21ed4d00280d668b461b623341a90bf824ec3bea Mon Sep 17 00:00:00 2001 From: JohanHjelsethStorstad <82723971+JohanHjelsethStorstad@users.noreply.github.com> Date: Tue, 31 Oct 2023 20:53:48 +0100 Subject: [PATCH 05/25] fix: indent errors --- src/app/(auth)/login/page.tsx | 26 +++---- src/app/(auth)/logout/page.tsx | 22 +++--- src/app/(home)/Section.tsx | 2 +- src/app/components/Footer/Footer.tsx | 76 +++++++++---------- src/app/components/NavBar/MobileNavBar.tsx | 30 ++++---- .../components/SocialIcons/SocialIcons.tsx | 10 +-- src/app/components/YouTube/YouTube.tsx | 7 +- src/app/layout.tsx | 50 ++++++------ src/prisma/seed.ts | 30 ++++---- 9 files changed, 126 insertions(+), 127 deletions(-) diff --git a/src/app/(auth)/login/page.tsx b/src/app/(auth)/login/page.tsx index 6538e158e..965322cab 100644 --- a/src/app/(auth)/login/page.tsx +++ b/src/app/(auth)/login/page.tsx @@ -6,20 +6,20 @@ import PrimaryButton from '@/components/PrimaryButton/PrimaryButton' import CsrfToken from '../CsrfToken' export default async function LogIn() { - return ( -
-
-
- - - + return ( +
+
+ + + + - - -
- en kappemann sin hatt + + +
+ en kappemann sin hatt +
-
- ) + ) } \ No newline at end of file diff --git a/src/app/(auth)/logout/page.tsx b/src/app/(auth)/logout/page.tsx index 353b32d88..a7109a0ea 100644 --- a/src/app/(auth)/logout/page.tsx +++ b/src/app/(auth)/logout/page.tsx @@ -5,17 +5,17 @@ import PrimaryButton from '@/components/PrimaryButton/PrimaryButton' import CsrfToken from '../CsrfToken' export default async function LogOut() { - return ( -
-
-
- - - -
- en kappemann sin hatt + return ( +
+
+
+ + + +
+ en kappemann sin hatt +
-
- ) + ) } \ No newline at end of file diff --git a/src/app/(home)/Section.tsx b/src/app/(home)/Section.tsx index 90423420b..0c151d2b4 100644 --- a/src/app/(home)/Section.tsx +++ b/src/app/(home)/Section.tsx @@ -20,7 +20,7 @@ function Section({children, img, name, lesMer, right, imgWidth, id}: PropTypes) src={img} alt={alt} width={imgWidth} - /> + />
) return ( diff --git a/src/app/components/Footer/Footer.tsx b/src/app/components/Footer/Footer.tsx index 7a6274cfe..b55ac67f5 100644 --- a/src/app/components/Footer/Footer.tsx +++ b/src/app/components/Footer/Footer.tsx @@ -9,45 +9,45 @@ import logo from '@/images/omega_logo_white.png' import nordic from '@/images/nordic.png' function Footer() { - return ( -
-
- sct. omega broderskab -

- Linjeforeningen for Elektronisk Systemdesign og Innovasjon (MTELSYS) og Kybernetikk og - Robotikk (MTTK) ved Norges Tekniske-Naturvitenskapelige Universitet (NTNU) -

-
- - add to homescreen - -
- + return ( +
+
+ sct. omega broderskab +

+ Linjeforeningen for Elektronisk Systemdesign og Innovasjon (MTELSYS) og Kybernetikk og + Robotikk (MTTK) ved Norges Tekniske-Naturvitenskapelige Universitet (NTNU) +

+
+ + add to homescreen + +
+ +
-
-
-
-

Kontakt:

-

Bedrift: post@contactor.no

-

Teknisk: vevcom@omega.ntnu.no

-

PR: blaest@omega.ntnu.no

-

Annet: hs@omega.ntnu.no

-

Tlf: 73 59 42 11

-
-
-

Adresse:

-

Sct.Omega Broderskab

-

NTNU Gløshaugen

-

Elektro-bygget

-

7491 Trondheim

-
-
- - nordic logo - -
-
- ) +
+
+

Kontakt:

+

Bedrift: post@contactor.no

+

Teknisk: vevcom@omega.ntnu.no

+

PR: blaest@omega.ntnu.no

+

Annet: hs@omega.ntnu.no

+

Tlf: 73 59 42 11

+
+
+

Adresse:

+

Sct.Omega Broderskab

+

NTNU Gløshaugen

+

Elektro-bygget

+

7491 Trondheim

+
+
+ + nordic logo + +
+ + ) } export default Footer \ No newline at end of file diff --git a/src/app/components/NavBar/MobileNavBar.tsx b/src/app/components/NavBar/MobileNavBar.tsx index ab5f102aa..07d728d1a 100644 --- a/src/app/components/NavBar/MobileNavBar.tsx +++ b/src/app/components/NavBar/MobileNavBar.tsx @@ -29,12 +29,12 @@ function MobileNavBar({ session } : PropTypes) {
{ - isLoggedIn ? - - log in button - : - - log in button - + isLoggedIn ? + + log in button + : + + log in button + }
-
setBurgerOpen(!burgerOpen)}> -
- { - burgerOpen && - } + {burgerOpen + && + }
) diff --git a/src/app/components/SocialIcons/SocialIcons.tsx b/src/app/components/SocialIcons/SocialIcons.tsx index ce67f57ec..4ab8b7471 100644 --- a/src/app/components/SocialIcons/SocialIcons.tsx +++ b/src/app/components/SocialIcons/SocialIcons.tsx @@ -2,13 +2,13 @@ import Link from 'next/link' import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' import { - faXTwitter, - faFacebookSquare, - faInstagram + faXTwitter, + faFacebookSquare, + faInstagram } from '@fortawesome/free-brands-svg-icons' function SocialIcons() { - return ( + return ( <> @@ -20,7 +20,7 @@ function SocialIcons() { - ) + ) } export default SocialIcons \ No newline at end of file diff --git a/src/app/components/YouTube/YouTube.tsx b/src/app/components/YouTube/YouTube.tsx index b17b78bf5..a5d1f6e96 100644 --- a/src/app/components/YouTube/YouTube.tsx +++ b/src/app/components/YouTube/YouTube.tsx @@ -5,10 +5,9 @@ type PropTypes = { } function YouTube({src}: PropTypes) { - - return ( - - ) + return ( + + ) } export default YouTube \ No newline at end of file diff --git a/src/app/layout.tsx b/src/app/layout.tsx index fe1c7c625..659df2977 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -18,32 +18,32 @@ config.autoAddCss = false const inter = Inter({ subsets: ['latin'] }) export const metadata = { - title: 'projectnext', - description: '', - charset: 'utf-8', + title: 'projectnext', + description: '', + charset: 'utf-8', } export default async function RootLayout({ children } : { children: React.ReactNode}) { - const session = await getServerSession(authOptions) - - return ( - - -
-
- -
-
- {children} -
-
-
-
-
- -
-
- - - ) + const session = await getServerSession(authOptions) + + return ( + + +
+
+ +
+
+ {children} +
+
+
+
+
+ +
+
+ + + ) } diff --git a/src/prisma/seed.ts b/src/prisma/seed.ts index 5a61df1a7..0c38776f7 100644 --- a/src/prisma/seed.ts +++ b/src/prisma/seed.ts @@ -3,22 +3,22 @@ const prisma = new PrismaClient() console.log("seed starting...") async function main() { - const harambe = await prisma.user.upsert({ - where: { - email: 'harambe@harambesen.io' - }, - update: { + const harambe = await prisma.user.upsert({ + where: { + email: 'harambe@harambesen.io' + }, + update: { - }, - create: { - firstname: 'Harambe', - lastname: 'Harambesen', - email: 'harambe@harambesen.io', - password: 'password', - username: 'Harambe104', - }, - }) - console.log({ harambe }) + }, + create: { + firstname: 'Harambe', + lastname: 'Harambesen', + email: 'harambe@harambesen.io', + password: 'password', + username: 'Harambe104', + }, + }) + console.log({ harambe }) } main().then(async () => { await prisma.$disconnect() From 44e4269ae00fded5ca2d287f335c1f00d70f0e26 Mon Sep 17 00:00:00 2001 From: JohanHjelsethStorstad <82723971+JohanHjelsethStorstad@users.noreply.github.com> Date: Tue, 31 Oct 2023 20:58:50 +0100 Subject: [PATCH 06/25] chore: auto fix last indent errors --- src/app/(home)/InfoBubbles.tsx | 54 +++++++-------- src/app/(home)/page.tsx | 78 +++++++++++----------- src/app/components/Footer/Footer.tsx | 44 ++++++------ src/app/components/NavBar/MobileNavBar.tsx | 28 ++++---- 4 files changed, 102 insertions(+), 102 deletions(-) diff --git a/src/app/(home)/InfoBubbles.tsx b/src/app/(home)/InfoBubbles.tsx index 1490cbf7b..024b09d62 100644 --- a/src/app/(home)/InfoBubbles.tsx +++ b/src/app/(home)/InfoBubbles.tsx @@ -8,43 +8,43 @@ import { } from '@fortawesome/free-solid-svg-icons' function InfoBubbles() { - return ( -
-
-
- - -
-
Sosialt
-
+ return ( +
+
+
+ + +
+
Sosialt
+
Sct. Omega Broderskaps mål er å skape et fargerikt sosialt liv for studenter ved studiene for Elektronisk Systemdesign og Innovasjon, og Kybernetikk og Robotikk. +
-
-
-
- - -
-
Komitéer
-
+
+
+ + +
+
Komitéer
+
Linjeforeningen består av 17 komitéer som alle inkluderer studenter på et bredt spekter, med alt fra revy til store fester som Phaestum Immatricularis. +
-
-
-
- - -
-
Næringsliv
-
+
+
+ + +
+
Næringsliv
+
Omega har kontakt med mange bedrifter og jobber kontinuerlig med å skape et godt forhold mellom studenten og en fremtidig arbeidsplass. +
-
- ) + ) } export default InfoBubbles \ No newline at end of file diff --git a/src/app/(home)/page.tsx b/src/app/(home)/page.tsx index 122322fce..2d6a290e9 100644 --- a/src/app/(home)/page.tsx +++ b/src/app/(home)/page.tsx @@ -16,62 +16,62 @@ import GoogleMap from '@/components/GoogleMap/GoogleMap' import YouTube from '@/components/YouTube/YouTube' export default function Home() { - return ( -
-
-
-
- omega logo - Logg inn - Ny student -
- -
- - - -
-
-
+ return ( +
+
+
+
+ omega logo + Logg inn + Ny student +
+ +
+ + + +
+
+
Sct. Omega Broderskab ble offisielt stiftet 21. november 1919 av et kull elektrostudenter som må ha hatt et svært godt kameratskap og sosialt miljø. Til å begynne med var det en eksklusiv klubb forbeholdt 3. og 4. årskurs, og for å bli tatt opp måtte man sende inn en fyldig søknad. Dette har endret seg gjennom årene, og i dag blir medlemmene tatt opp automatisk fra 1. klasse. -
- -
+
+ +
Omega Verksted er en forening for elektronikk- og hobbyinteresserte studenter ved Norges Teknisk-Naturvitenskapelige Universitet (NTNU) stiftet i 1971. Omega Verksted holder til i kjelleren i det gamle elektrobygget på Gløshaugen (G 016 A). Verkstedet inneholder det meste av verktøy for små og store prosjekter, i tillegg til et knippe datamaskiner samt et solid utvalg av brus og sjokolade. -
-
-
-
- -
+
+
+
+
+ +
Altså omega er helt fantastisk for bedrifter.... tro meg 100%. Bare å ta kontakt med contactor ellerno... Lorem ipsium bla lofrgin fofkewivj irjvioer firegjoireg g jfirejgergo rjgijgoieg jgirejgioe geroigjkoiegoekg kogkpeogkg rgierg -
-
+
+
Ohma Electra er Omega sin stolthet, og hennes historie strekker seg helt tilbake til 1908. Ohma er verdens første(!) fungerende vekselstrøm-lokomotiv, og har en lang historie fra både gruvedrift, sabotasje under 2. verdenskrig, og som glamourmodell på utsiden av elektrobygget. Det er ingen hemmelighet at Ohma er det fineste lokomotivet i hele Norge, og hvis du er heldig får du kanskje bli med på en kjøretur. -
-
-
-
- -
-
- ) +
+
+
+
+ +
+
+ ) } diff --git a/src/app/components/Footer/Footer.tsx b/src/app/components/Footer/Footer.tsx index b55ac67f5..f9e67af2d 100644 --- a/src/app/components/Footer/Footer.tsx +++ b/src/app/components/Footer/Footer.tsx @@ -12,38 +12,38 @@ function Footer() { return ( diff --git a/src/app/components/NavBar/MobileNavBar.tsx b/src/app/components/NavBar/MobileNavBar.tsx index 07d728d1a..84c1ea7f6 100644 --- a/src/app/components/NavBar/MobileNavBar.tsx +++ b/src/app/components/NavBar/MobileNavBar.tsx @@ -29,13 +29,13 @@ function MobileNavBar({ session } : PropTypes) {
) -} \ No newline at end of file +} diff --git a/src/app/(auth)/logout/page.tsx b/src/app/(auth)/logout/page.tsx index a7109a0ea..3fbd21c8b 100644 --- a/src/app/(auth)/logout/page.tsx +++ b/src/app/(auth)/logout/page.tsx @@ -18,4 +18,4 @@ export default async function LogOut() {
) -} \ No newline at end of file +} diff --git a/src/app/(home)/InfoBubbles.tsx b/src/app/(home)/InfoBubbles.tsx index 024b09d62..711d56b60 100644 --- a/src/app/(home)/InfoBubbles.tsx +++ b/src/app/(home)/InfoBubbles.tsx @@ -47,4 +47,4 @@ function InfoBubbles() { ) } -export default InfoBubbles \ No newline at end of file +export default InfoBubbles diff --git a/src/app/(home)/Section.tsx b/src/app/(home)/Section.tsx index 0c151d2b4..cb6dffe79 100644 --- a/src/app/(home)/Section.tsx +++ b/src/app/(home)/Section.tsx @@ -38,4 +38,4 @@ function Section({children, img, name, lesMer, right, imgWidth, id}: PropTypes) ) } -export default Section \ No newline at end of file +export default Section diff --git a/src/app/api/auth/[...nextauth]/route.ts b/src/app/api/auth/[...nextauth]/route.ts index 629b898d8..0b8d564dc 100644 --- a/src/app/api/auth/[...nextauth]/route.ts +++ b/src/app/api/auth/[...nextauth]/route.ts @@ -3,4 +3,4 @@ import authOptions from '@/auth' const handler = NextAuth(authOptions) -export { handler as GET, handler as POST } \ No newline at end of file +export { handler as GET, handler as POST } diff --git a/src/app/api/users/[id]/route.ts b/src/app/api/users/[id]/route.ts index 785691139..de634e42c 100644 --- a/src/app/api/users/[id]/route.ts +++ b/src/app/api/users/[id]/route.ts @@ -17,4 +17,4 @@ export async function GET(request: NextRequest, { params }: ParamType) { status: 404, }) return NextResponse.json(user) -} \ No newline at end of file +} diff --git a/src/app/api/users/route.ts b/src/app/api/users/route.ts index 61a22a028..130fa2feb 100644 --- a/src/app/api/users/route.ts +++ b/src/app/api/users/route.ts @@ -42,4 +42,4 @@ export async function POST(req: NextRequest) { return NextResponse.json({}, { status: 500 }) } -} \ No newline at end of file +} diff --git a/src/app/components/Checkbox/Checkbox.tsx b/src/app/components/Checkbox/Checkbox.tsx index bb35af206..2a98fb215 100644 --- a/src/app/components/Checkbox/Checkbox.tsx +++ b/src/app/components/Checkbox/Checkbox.tsx @@ -14,4 +14,4 @@ function Checkbox({ label }: PropTypes) {
} -export default Checkbox \ No newline at end of file +export default Checkbox diff --git a/src/app/components/Footer/Footer.tsx b/src/app/components/Footer/Footer.tsx index f9e67af2d..278ca754c 100644 --- a/src/app/components/Footer/Footer.tsx +++ b/src/app/components/Footer/Footer.tsx @@ -50,4 +50,4 @@ function Footer() { ) } -export default Footer \ No newline at end of file +export default Footer diff --git a/src/app/components/FormInput/FormInput.tsx b/src/app/components/FormInput/FormInput.tsx index d95fa712b..5cf11ee8b 100644 --- a/src/app/components/FormInput/FormInput.tsx +++ b/src/app/components/FormInput/FormInput.tsx @@ -20,4 +20,4 @@ function FormInput({label, type, id, name} : PropTypes) { } -export default FormInput \ No newline at end of file +export default FormInput diff --git a/src/app/components/GoogleMap/GoogleMap.tsx b/src/app/components/GoogleMap/GoogleMap.tsx index 4af943509..dd38b7ba6 100644 --- a/src/app/components/GoogleMap/GoogleMap.tsx +++ b/src/app/components/GoogleMap/GoogleMap.tsx @@ -20,4 +20,4 @@ function GoogleMap({ location, height } : PropTypes) { ) } -export default GoogleMap; \ No newline at end of file +export default GoogleMap; diff --git a/src/app/components/Loader/Loader.tsx b/src/app/components/Loader/Loader.tsx index 79f12c363..7bd419e28 100644 --- a/src/app/components/Loader/Loader.tsx +++ b/src/app/components/Loader/Loader.tsx @@ -10,4 +10,4 @@ function Loader() { ) } -export default Loader \ No newline at end of file +export default Loader diff --git a/src/app/components/NavBar/BurgerItem.tsx b/src/app/components/NavBar/BurgerItem.tsx index 03c4d7bf7..45ed2f713 100644 --- a/src/app/components/NavBar/BurgerItem.tsx +++ b/src/app/components/NavBar/BurgerItem.tsx @@ -21,4 +21,4 @@ function BurgerItem({ href, name, icon, shortName } : PropTypes) { ) } -export default BurgerItem \ No newline at end of file +export default BurgerItem diff --git a/src/app/components/NavBar/BurgerMenu.tsx b/src/app/components/NavBar/BurgerMenu.tsx index ba3f4c987..f56e71f56 100644 --- a/src/app/components/NavBar/BurgerMenu.tsx +++ b/src/app/components/NavBar/BurgerMenu.tsx @@ -52,4 +52,4 @@ function BurgerMenu({ isLoggedIn, applicationPeriod }:PropTypes) { ) } -export default BurgerMenu \ No newline at end of file +export default BurgerMenu diff --git a/src/app/components/NavBar/Dropdown.tsx b/src/app/components/NavBar/Dropdown.tsx index 1686fa3a4..e2aced45f 100644 --- a/src/app/components/NavBar/Dropdown.tsx +++ b/src/app/components/NavBar/Dropdown.tsx @@ -31,4 +31,4 @@ function DropDown({ name, items } : PropTypes) { ) } -export default DropDown \ No newline at end of file +export default DropDown diff --git a/src/app/components/NavBar/Item.tsx b/src/app/components/NavBar/Item.tsx index ac76cbdb8..d9eef607c 100644 --- a/src/app/components/NavBar/Item.tsx +++ b/src/app/components/NavBar/Item.tsx @@ -16,4 +16,4 @@ function Item({ href, name }: PropTypes) { ) } -export default Item \ No newline at end of file +export default Item diff --git a/src/app/components/NavBar/MobileNavBar.tsx b/src/app/components/NavBar/MobileNavBar.tsx index 84c1ea7f6..13cc0e25a 100644 --- a/src/app/components/NavBar/MobileNavBar.tsx +++ b/src/app/components/NavBar/MobileNavBar.tsx @@ -73,4 +73,4 @@ function MobileNavBar({ session } : PropTypes) { ) } -export default MobileNavBar \ No newline at end of file +export default MobileNavBar diff --git a/src/app/components/NavBar/NavBar.tsx b/src/app/components/NavBar/NavBar.tsx index 9b61ad1f0..f96155399 100644 --- a/src/app/components/NavBar/NavBar.tsx +++ b/src/app/components/NavBar/NavBar.tsx @@ -125,4 +125,4 @@ async function NavBar({session}: PropTypes) { } -export default NavBar \ No newline at end of file +export default NavBar diff --git a/src/app/components/PrimaryButton/PrimaryButton.tsx b/src/app/components/PrimaryButton/PrimaryButton.tsx index 6d8bffeef..f1b479119 100644 --- a/src/app/components/PrimaryButton/PrimaryButton.tsx +++ b/src/app/components/PrimaryButton/PrimaryButton.tsx @@ -8,4 +8,4 @@ function PrimaryButton({ text }:PropTypes) { return } -export default PrimaryButton \ No newline at end of file +export default PrimaryButton diff --git a/src/app/components/SocialIcons/SocialIcons.tsx b/src/app/components/SocialIcons/SocialIcons.tsx index 4ab8b7471..c96980577 100644 --- a/src/app/components/SocialIcons/SocialIcons.tsx +++ b/src/app/components/SocialIcons/SocialIcons.tsx @@ -23,4 +23,4 @@ function SocialIcons() { ) } -export default SocialIcons \ No newline at end of file +export default SocialIcons diff --git a/src/app/components/YouTube/YouTube.tsx b/src/app/components/YouTube/YouTube.tsx index a5d1f6e96..0a07fe532 100644 --- a/src/app/components/YouTube/YouTube.tsx +++ b/src/app/components/YouTube/YouTube.tsx @@ -10,4 +10,4 @@ function YouTube({src}: PropTypes) { ) } -export default YouTube \ No newline at end of file +export default YouTube diff --git a/src/app/events/page.tsx b/src/app/events/page.tsx index c265f71e3..b1ab5d905 100644 --- a/src/app/events/page.tsx +++ b/src/app/events/page.tsx @@ -49,4 +49,4 @@ export default function Events() { projectnextiejiejiwjfijwfoekfoewkfowkefokewf
) -} \ No newline at end of file +} diff --git a/src/app/loading.tsx b/src/app/loading.tsx index cf1bbdf68..15e8c93e3 100644 --- a/src/app/loading.tsx +++ b/src/app/loading.tsx @@ -2,4 +2,4 @@ export default function loading() { return ( <>Loading ) -} \ No newline at end of file +} diff --git a/src/app/users/[username]/page.tsx b/src/app/users/[username]/page.tsx index dbd31632d..6ebf44f78 100644 --- a/src/app/users/[username]/page.tsx +++ b/src/app/users/[username]/page.tsx @@ -44,4 +44,4 @@ async function AuthTest({ params }: PropTypes) { ) } -export default AuthTest \ No newline at end of file +export default AuthTest diff --git a/src/auth/index.ts b/src/auth/index.ts index 1a88bb322..a9e493547 100644 --- a/src/auth/index.ts +++ b/src/auth/index.ts @@ -48,4 +48,4 @@ const authOptions : AuthOptions = { } } -export default authOptions \ No newline at end of file +export default authOptions diff --git a/src/prisma/index.ts b/src/prisma/index.ts index d15e73d87..1fac35d44 100644 --- a/src/prisma/index.ts +++ b/src/prisma/index.ts @@ -4,4 +4,4 @@ const prisma = global.prisma || new PrismaClient() if (process.env.NODE_ENV !== "production") global.prisma = prisma -export default prisma \ No newline at end of file +export default prisma diff --git a/src/prisma/seed.ts b/src/prisma/seed.ts index 0c38776f7..282f95300 100644 --- a/src/prisma/seed.ts +++ b/src/prisma/seed.ts @@ -26,4 +26,4 @@ main().then(async () => { console.error(e) await prisma.$disconnect() process.exit(1) -}) \ No newline at end of file +}) diff --git a/src/typings/global.d.ts b/src/typings/global.d.ts index 308b52966..684f63994 100644 --- a/src/typings/global.d.ts +++ b/src/typings/global.d.ts @@ -4,4 +4,4 @@ import { DefaultArgs } from "@prisma/client/runtime/library"; declare global { // eslint-disable-next-line no-var var prisma: PrismaClient -} \ No newline at end of file +} From 6b61838094d3df56c255fb852f7d648901f8dec9 Mon Sep 17 00:00:00 2001 From: JohanHjelsethStorstad <82723971+JohanHjelsethStorstad@users.noreply.github.com> Date: Tue, 31 Oct 2023 21:22:31 +0100 Subject: [PATCH 09/25] chore: add more elint-rules --- .eslintrc.json | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/.eslintrc.json b/.eslintrc.json index d0accaaee..f86f1c32c 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -28,6 +28,20 @@ "comma-style": [ "error", "last" - ] + ], + // suggest using arrow functions as callbacks + "prefer-arrow-callbac": "error", + + //SOME ODD OPTIONS: + // suggest using the spread operator instead of .apply() + "prefer-spread": "error", + // suggest using Reflect methods where applicable + "prefer-reflect": "error", + // use rest parameters instead of arguments + "prefer-rest-params": "error", + // suggest using template literals instead of string concatenation + "prefer-template": "error", + // enforce usage of spacing in template strings + "template-curly-spacing": "error" } } From be20f6af4c536eac4af2973dd7c05d057de9f632 Mon Sep 17 00:00:00 2001 From: JohanHjelsethStorstad <82723971+JohanHjelsethStorstad@users.noreply.github.com> Date: Tue, 31 Oct 2023 21:24:09 +0100 Subject: [PATCH 10/25] fix: wrong es-lint rule name --- .eslintrc.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index f86f1c32c..40bd0c08e 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -30,7 +30,9 @@ "last" ], // suggest using arrow functions as callbacks - "prefer-arrow-callbac": "error", + "prefer-arrow-callback": "error", + // suggest using template literals instead of string concatenation + "prefer-template": "error", //SOME ODD OPTIONS: // suggest using the spread operator instead of .apply() @@ -39,8 +41,6 @@ "prefer-reflect": "error", // use rest parameters instead of arguments "prefer-rest-params": "error", - // suggest using template literals instead of string concatenation - "prefer-template": "error", // enforce usage of spacing in template strings "template-curly-spacing": "error" } From 2480ba748c8f8b61a2920fe81efc7dc393532f42 Mon Sep 17 00:00:00 2001 From: JohanHjelsethStorstad <82723971+JohanHjelsethStorstad@users.noreply.github.com> Date: Tue, 31 Oct 2023 21:27:02 +0100 Subject: [PATCH 11/25] fix: lint error: use template string and not + --- src/app/(home)/Section.tsx | 2 +- src/app/components/Checkbox/Checkbox.tsx | 2 +- src/app/components/FormInput/FormInput.tsx | 2 +- src/app/components/GoogleMap/GoogleMap.tsx | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/app/(home)/Section.tsx b/src/app/(home)/Section.tsx index cb6dffe79..42b15f0c3 100644 --- a/src/app/(home)/Section.tsx +++ b/src/app/(home)/Section.tsx @@ -13,7 +13,7 @@ type PropTypes = { } function Section({children, img, name, lesMer, right, imgWidth, id}: PropTypes) { - const alt = "image of " + name + const alt = `image of ${name}` const imgContainer = (
diff --git a/src/app/components/FormInput/FormInput.tsx b/src/app/components/FormInput/FormInput.tsx index 5cf11ee8b..29574459e 100644 --- a/src/app/components/FormInput/FormInput.tsx +++ b/src/app/components/FormInput/FormInput.tsx @@ -11,7 +11,7 @@ type PropTypes = { function FormInput({label, type, id, name} : PropTypes) { label ??= '' type ??= (type !== undefined) ? type : 'text' - id ??= "id_input_" + uuid() + id ??= `id_input_${uuid()}` return
diff --git a/src/app/components/GoogleMap/GoogleMap.tsx b/src/app/components/GoogleMap/GoogleMap.tsx index dd38b7ba6..6cc60e05c 100644 --- a/src/app/components/GoogleMap/GoogleMap.tsx +++ b/src/app/components/GoogleMap/GoogleMap.tsx @@ -10,7 +10,7 @@ type PropTypes = { function GoogleMap({ location, height } : PropTypes) { return ( -
+
Date: Tue, 31 Oct 2023 21:32:08 +0100 Subject: [PATCH 12/25] chore: add more eslint-rules --- .eslintrc.json | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/.eslintrc.json b/.eslintrc.json index 40bd0c08e..ce59e7103 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -33,6 +33,21 @@ "prefer-arrow-callback": "error", // suggest using template literals instead of string concatenation "prefer-template": "error", + // disallow modifying variables that are declared using const + "no-const-assign": "error", + // disallow symbol constructor + "no-new-symbol": "error", + // disallow to use this/super before super() calling in constructors. + "no-this-before-super": "error", + // require let or const instead of var + "no-var": "error", + // disallow unnecessary constructor + "no-useless-constructor": "error", + // require method and property shorthand syntax for object literals + "object-shorthand": [ + "error", + "always" + ], //SOME ODD OPTIONS: // suggest using the spread operator instead of .apply() From cdd40951fea1cc6eb4dae744d4c8c3ac38ad0265 Mon Sep 17 00:00:00 2001 From: JohanHjelsethStorstad <82723971+JohanHjelsethStorstad@users.noreply.github.com> Date: Tue, 31 Oct 2023 21:34:23 +0100 Subject: [PATCH 13/25] fix: lint: use object shothand: obj = {x}not obj = {x: x} --- src/app/api/users/route.ts | 10 +++++----- src/app/users/[username]/page.tsx | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/app/api/users/route.ts b/src/app/api/users/route.ts index 130fa2feb..b749c57ea 100644 --- a/src/app/api/users/route.ts +++ b/src/app/api/users/route.ts @@ -21,11 +21,11 @@ export async function POST(req: NextRequest) { try { const user = await prisma.user.create({ data: { - username: username, - email: email, - password: password, - firstname: firstname, - lastname: lastname + username, + email, + password, + firstname, + lastname, } }) diff --git a/src/app/users/[username]/page.tsx b/src/app/users/[username]/page.tsx index 6ebf44f78..fc4d7f0ce 100644 --- a/src/app/users/[username]/page.tsx +++ b/src/app/users/[username]/page.tsx @@ -27,7 +27,7 @@ async function AuthTest({ params }: PropTypes) { const user = await prisma.user.findUnique({ where: { - username: username + username } }) From e9acf4ec347e80c407a261fe50d40d50daa63067 Mon Sep 17 00:00:00 2001 From: JohanHjelsethStorstad <82723971+JohanHjelsethStorstad@users.noreply.github.com> Date: Tue, 31 Oct 2023 21:40:13 +0100 Subject: [PATCH 14/25] chore: add lint-rules --- .eslintrc.json | 1 + 1 file changed, 1 insertion(+) diff --git a/.eslintrc.json b/.eslintrc.json index ce59e7103..9be19eae8 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -44,6 +44,7 @@ // disallow unnecessary constructor "no-useless-constructor": "error", // require method and property shorthand syntax for object literals + // ie write obj = { x }, not obj = {x: x} "object-shorthand": [ "error", "always" From 8e249d5451fabb476bebc1b6b76b0dcaea5338c9 Mon Sep 17 00:00:00 2001 From: JohanHjelsethStorstad <82723971+JohanHjelsethStorstad@users.noreply.github.com> Date: Tue, 31 Oct 2023 21:42:34 +0100 Subject: [PATCH 15/25] fix: linting errors: have to explicitly import React for use of React.ReactNode --- .eslintrc.json | 46 ++++++++++++++++++++++++++++++++++++++ src/app/(home)/Section.tsx | 1 + src/app/layout.tsx | 2 +- src/typings/next-auth.d.ts | 2 +- 4 files changed, 49 insertions(+), 2 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index 9be19eae8..c1abe4d3d 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -49,6 +49,52 @@ "error", "always" ], + // disallow deletion of variables + "no-delete-var": "error", + // disallow labels that share a name with a variable + "no-label-var": "error", + // disallow self assignment + "no-self-assign": "error", + // disallow shadowing of names such as arguments + "no-shadow-restricted-names": "error", + // disallow declaration of variables already declared in the outer scope + "no-shadow": "error", + // disallow use of undeclared variables unless mentioned in a /*global */ block + "no-undef": "error", + // disallow declaration of variables that are not used in the code + "no-unused-vars": [ + "error", + { + "vars": "local", + "args": "after-used" + } + ], + // disallow use of variables before they are defined + "no-use-before-define": "error", + // enforces no braces where they can be omitted + "arrow-body-style": [ + "error", + "as-needed" + ], + // require space before/after arrow function"s arrow + "arrow-spacing": [ + "error", + { + "before": true, + "after": true + } + ], + // verify super() callings in constructors + "constructor-super": "error", + // disallow modifying variables of class declarations + "no-class-assign": "error", + // disallow arrow functions where they could be confused with comparisons + "no-confusing-arrow": [ + "error", + { + "allowParens": true + } + ], //SOME ODD OPTIONS: // suggest using the spread operator instead of .apply() diff --git a/src/app/(home)/Section.tsx b/src/app/(home)/Section.tsx index 42b15f0c3..7cb4c603c 100644 --- a/src/app/(home)/Section.tsx +++ b/src/app/(home)/Section.tsx @@ -1,3 +1,4 @@ +import React from 'react' import Image, { StaticImageData } from 'next/image' import Link from 'next/link' import styles from './Section.module.scss' diff --git a/src/app/layout.tsx b/src/app/layout.tsx index 659df2977..890783d3d 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -1,5 +1,5 @@ import { Inter } from 'next/font/google' - +import React from 'react' import MobileNavBar from '@/components/NavBar/MobileNavBar' import NavBar from '@/components/NavBar/NavBar' import Footer from '@/components/Footer/Footer' diff --git a/src/typings/next-auth.d.ts b/src/typings/next-auth.d.ts index 9c28dd072..533f47629 100644 --- a/src/typings/next-auth.d.ts +++ b/src/typings/next-auth.d.ts @@ -11,7 +11,7 @@ declare module "next-auth" { declare module "next-auth/jwt" { interface JWT { - user: User + user: prismaUser } } From d424f8152a33365e4b399511c61eac5fbc8769b1 Mon Sep 17 00:00:00 2001 From: JohanHjelsethStorstad <82723971+JohanHjelsethStorstad@users.noreply.github.com> Date: Tue, 31 Oct 2023 21:46:50 +0100 Subject: [PATCH 16/25] chore: add single quote rule --- .eslintrc.json | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/.eslintrc.json b/.eslintrc.json index c1abe4d3d..ebdd3c0b6 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -95,6 +95,19 @@ "allowParens": true } ], + // Require or disallow spaces before/after unary operators + "space-unary-ops": [ + "error", + { + "words": true, + "nonwords": false + } + ], + "quotes": [ + "error", + "single", + "avoid-escape" + ], //SOME ODD OPTIONS: // suggest using the spread operator instead of .apply() From 5fb1d3b9a91c2de172404e2ad554f0e09910f5d0 Mon Sep 17 00:00:00 2001 From: JohanHjelsethStorstad <82723971+JohanHjelsethStorstad@users.noreply.github.com> Date: Tue, 31 Oct 2023 21:49:25 +0100 Subject: [PATCH 17/25] chore: add jsx quote (double) as well --- .eslintrc.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.eslintrc.json b/.eslintrc.json index ebdd3c0b6..dab8660a1 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -107,7 +107,8 @@ "error", "single", "avoid-escape" - ], + ], + "jsx-quotes": ["error", "prefer-double"], //SOME ODD OPTIONS: // suggest using the spread operator instead of .apply() From bc44403ead51e2c62cd8c655b9f3ef7c252eeb05 Mon Sep 17 00:00:00 2001 From: JohanHjelsethStorstad <82723971+JohanHjelsethStorstad@users.noreply.github.com> Date: Tue, 31 Oct 2023 21:54:02 +0100 Subject: [PATCH 18/25] fix: all quote linting errors --- src/app/(auth)/CsrfToken.tsx | 4 +- src/app/(auth)/login/page.tsx | 4 +- src/app/(auth)/logout/page.tsx | 4 +- src/app/api/auth/[...nextauth]/route.ts | 2 +- src/app/api/users/[id]/route.ts | 6 +- src/app/api/users/route.ts | 2 +- src/app/components/Checkbox/Checkbox.tsx | 2 +- src/app/components/FormInput/FormInput.tsx | 2 +- src/app/components/GoogleMap/GoogleMap.tsx | 2 +- src/app/components/Loader/Loader.tsx | 2 +- src/app/components/NavBar/BurgerMenu.tsx | 2 +- src/app/components/NavBar/Dropdown.tsx | 6 +- src/app/components/NavBar/Item.tsx | 4 +- src/app/components/NavBar/MobileNavBar.tsx | 6 +- src/app/components/NavBar/NavBar.tsx | 64 +++++++++---------- .../PrimaryButton/PrimaryButton.tsx | 2 +- src/app/users/[username]/page.tsx | 6 +- src/auth/index.ts | 14 ++-- src/prisma/index.ts | 2 +- src/prisma/seed.ts | 2 +- src/typings/global.d.ts | 4 +- src/typings/next-auth.d.ts | 6 +- 22 files changed, 74 insertions(+), 74 deletions(-) diff --git a/src/app/(auth)/CsrfToken.tsx b/src/app/(auth)/CsrfToken.tsx index 3458e0db2..df591ada7 100644 --- a/src/app/(auth)/CsrfToken.tsx +++ b/src/app/(auth)/CsrfToken.tsx @@ -1,6 +1,6 @@ -"use client" +'use client' -import { getCsrfToken } from "next-auth/react" +import { getCsrfToken } from 'next-auth/react' async function CsrfToken() { // getCsrfToken må kjøres på klientsiden* diff --git a/src/app/(auth)/login/page.tsx b/src/app/(auth)/login/page.tsx index f5b14719b..afd282bba 100644 --- a/src/app/(auth)/login/page.tsx +++ b/src/app/(auth)/login/page.tsx @@ -1,6 +1,6 @@ import FormInput from '@/components/FormInput/FormInput' import styles from './page.module.scss' -import magiskHatt from "@/images/magisk_hatt.png" +import magiskHatt from '@/images/magisk_hatt.png' import Image from 'next/image' import PrimaryButton from '@/components/PrimaryButton/PrimaryButton' import CsrfToken from '../CsrfToken' @@ -17,7 +17,7 @@ export default async function LogIn() {
- en kappemann sin hatt + en kappemann sin hatt
diff --git a/src/app/(auth)/logout/page.tsx b/src/app/(auth)/logout/page.tsx index 3fbd21c8b..f5204fe8a 100644 --- a/src/app/(auth)/logout/page.tsx +++ b/src/app/(auth)/logout/page.tsx @@ -1,5 +1,5 @@ import styles from './page.module.scss' -import magiskHatt from "@/images/magisk_hatt.png" +import magiskHatt from '@/images/magisk_hatt.png' import Image from 'next/image' import PrimaryButton from '@/components/PrimaryButton/PrimaryButton' import CsrfToken from '../CsrfToken' @@ -13,7 +13,7 @@ export default async function LogOut() {
- en kappemann sin hatt + en kappemann sin hatt
diff --git a/src/app/api/auth/[...nextauth]/route.ts b/src/app/api/auth/[...nextauth]/route.ts index 0b8d564dc..9c9ac1175 100644 --- a/src/app/api/auth/[...nextauth]/route.ts +++ b/src/app/api/auth/[...nextauth]/route.ts @@ -1,4 +1,4 @@ -import NextAuth from "next-auth" +import NextAuth from 'next-auth' import authOptions from '@/auth' const handler = NextAuth(authOptions) diff --git a/src/app/api/users/[id]/route.ts b/src/app/api/users/[id]/route.ts index de634e42c..8ecd2066f 100644 --- a/src/app/api/users/[id]/route.ts +++ b/src/app/api/users/[id]/route.ts @@ -1,5 +1,5 @@ -import prisma from "@/prisma" -import { NextRequest, NextResponse } from "next/server" +import prisma from '@/prisma' +import { NextRequest, NextResponse } from 'next/server' type ParamType = { params: { @@ -13,7 +13,7 @@ export async function GET(request: NextRequest, { params }: ParamType) { id: Number(params.id) } }) - if (!user) return new NextResponse("user not found", { + if (!user) return new NextResponse('user not found', { status: 404, }) return NextResponse.json(user) diff --git a/src/app/api/users/route.ts b/src/app/api/users/route.ts index b749c57ea..c5e6f87ec 100644 --- a/src/app/api/users/route.ts +++ b/src/app/api/users/route.ts @@ -1,6 +1,6 @@ import { Prisma } from '@prisma/client' -import prisma from "@/prisma" +import prisma from '@/prisma' import { NextRequest, NextResponse } from 'next/server' export async function GET() { diff --git a/src/app/components/Checkbox/Checkbox.tsx b/src/app/components/Checkbox/Checkbox.tsx index 826006054..d504588c3 100644 --- a/src/app/components/Checkbox/Checkbox.tsx +++ b/src/app/components/Checkbox/Checkbox.tsx @@ -1,5 +1,5 @@ import { v4 as uuid } from 'uuid' -import styles from "./Checkbox.module.scss"; +import styles from './Checkbox.module.scss'; type PropTypes = { label: string diff --git a/src/app/components/FormInput/FormInput.tsx b/src/app/components/FormInput/FormInput.tsx index 29574459e..b27ed909e 100644 --- a/src/app/components/FormInput/FormInput.tsx +++ b/src/app/components/FormInput/FormInput.tsx @@ -1,5 +1,5 @@ import { v4 as uuid } from 'uuid' -import styles from "./FormInput.module.scss" +import styles from './FormInput.module.scss' type PropTypes = { label?: string, diff --git a/src/app/components/GoogleMap/GoogleMap.tsx b/src/app/components/GoogleMap/GoogleMap.tsx index 6cc60e05c..0ce7ff2b5 100644 --- a/src/app/components/GoogleMap/GoogleMap.tsx +++ b/src/app/components/GoogleMap/GoogleMap.tsx @@ -1,6 +1,6 @@ 'use client' import styles from './GoogleMap.module.scss' -import GoogleMapReact from "google-map-react"; +import GoogleMapReact from 'google-map-react'; import { Coords } from 'google-map-react'; type PropTypes = { diff --git a/src/app/components/Loader/Loader.tsx b/src/app/components/Loader/Loader.tsx index 7bd419e28..1c5a4e2b7 100644 --- a/src/app/components/Loader/Loader.tsx +++ b/src/app/components/Loader/Loader.tsx @@ -5,7 +5,7 @@ import Image from 'next/image' function Loader() { return (
- omega-logo + omega-logo
) } diff --git a/src/app/components/NavBar/BurgerMenu.tsx b/src/app/components/NavBar/BurgerMenu.tsx index f56e71f56..191868664 100644 --- a/src/app/components/NavBar/BurgerMenu.tsx +++ b/src/app/components/NavBar/BurgerMenu.tsx @@ -14,7 +14,7 @@ import { faQuestionCircle, faAddressCard, faGraduationCap, -} from "@fortawesome/free-solid-svg-icons" +} from '@fortawesome/free-solid-svg-icons' import styles from './BurgerMenu.module.scss' diff --git a/src/app/components/NavBar/Dropdown.tsx b/src/app/components/NavBar/Dropdown.tsx index e2aced45f..11eccf369 100644 --- a/src/app/components/NavBar/Dropdown.tsx +++ b/src/app/components/NavBar/Dropdown.tsx @@ -1,8 +1,8 @@ -import Link from "next/link" -import styles from "./Dropdown.module.scss" +import Link from 'next/link' +import styles from './Dropdown.module.scss' import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' import { v4 as uuid } from 'uuid' -import { IconProp } from "@fortawesome/fontawesome-svg-core" +import { IconProp } from '@fortawesome/fontawesome-svg-core' type PropTypes = { name: string, diff --git a/src/app/components/NavBar/Item.tsx b/src/app/components/NavBar/Item.tsx index d9eef607c..fa1c96f14 100644 --- a/src/app/components/NavBar/Item.tsx +++ b/src/app/components/NavBar/Item.tsx @@ -1,5 +1,5 @@ -import Link from "next/link" -import styles from "./Item.module.scss" +import Link from 'next/link' +import styles from './Item.module.scss' type PropTypes = { href: string, diff --git a/src/app/components/NavBar/MobileNavBar.tsx b/src/app/components/NavBar/MobileNavBar.tsx index 13cc0e25a..2894b0047 100644 --- a/src/app/components/NavBar/MobileNavBar.tsx +++ b/src/app/components/NavBar/MobileNavBar.tsx @@ -1,4 +1,4 @@ -"use client" +'use client' import Image from 'next/image' import Link from 'next/link' import BurgerMenu from './BurgerMenu' @@ -11,9 +11,9 @@ import { faNewspaper, faSuitcase, faCalendar -} from "@fortawesome/free-solid-svg-icons" +} from '@fortawesome/free-solid-svg-icons' import styles from './MobileNavBar.module.scss' -import { Session } from "next-auth" +import { Session } from 'next-auth' type PropTypes = { session: Session | null diff --git a/src/app/components/NavBar/NavBar.tsx b/src/app/components/NavBar/NavBar.tsx index f96155399..850752c09 100644 --- a/src/app/components/NavBar/NavBar.tsx +++ b/src/app/components/NavBar/NavBar.tsx @@ -1,10 +1,10 @@ -import Image from "next/image" -import Link from "next/link" -import Item from "./Item" -import DropDown from "./Dropdown" -import magiskHatt from "@/images/magisk_hatt.png" -import simpleLogo from "@/images/logo_simple.png" -import styles from "./NavBar.module.scss" +import Image from 'next/image' +import Link from 'next/link' +import Item from './Item' +import DropDown from './Dropdown' +import magiskHatt from '@/images/magisk_hatt.png' +import simpleLogo from '@/images/logo_simple.png' +import styles from './NavBar.module.scss' import { faNewspaper, faPoo, @@ -17,8 +17,8 @@ import { faUsers, faCircleInfo, faGamepad -} from "@fortawesome/free-solid-svg-icons" -import { Session } from "next-auth" +} from '@fortawesome/free-solid-svg-icons' +import { Session } from 'next-auth' type PropTypes = { session: Session | null @@ -57,65 +57,65 @@ async function NavBar({session}: PropTypes) { } }
  • - + log in button
  • diff --git a/src/app/components/PrimaryButton/PrimaryButton.tsx b/src/app/components/PrimaryButton/PrimaryButton.tsx index f1b479119..cbfa4835e 100644 --- a/src/app/components/PrimaryButton/PrimaryButton.tsx +++ b/src/app/components/PrimaryButton/PrimaryButton.tsx @@ -1,4 +1,4 @@ -import styles from "./PrimaryButton.module.scss" +import styles from './PrimaryButton.module.scss' type PropTypes = { text: string, diff --git a/src/app/users/[username]/page.tsx b/src/app/users/[username]/page.tsx index fc4d7f0ce..12fb63b40 100644 --- a/src/app/users/[username]/page.tsx +++ b/src/app/users/[username]/page.tsx @@ -1,9 +1,9 @@ import { redirect } from 'next/navigation' -import { getServerSession } from "next-auth"; +import { getServerSession } from 'next-auth'; import authOptions from '@/auth'; -import prisma from "@/prisma" +import prisma from '@/prisma' import Link from 'next/link'; type PropTypes = { @@ -22,7 +22,7 @@ async function AuthTest({ params }: PropTypes) { redirect('/login') } - const me = params.username === "me" + const me = params.username === 'me' const username = me ? session.user.username : params.username const user = await prisma.user.findUnique({ diff --git a/src/auth/index.ts b/src/auth/index.ts index a9e493547..917730a7b 100644 --- a/src/auth/index.ts +++ b/src/auth/index.ts @@ -1,15 +1,15 @@ -import CredentialsProvider from "next-auth/providers/credentials" -import { AuthOptions } from "next-auth" +import CredentialsProvider from 'next-auth/providers/credentials' +import { AuthOptions } from 'next-auth' -import prisma from "@/prisma" +import prisma from '@/prisma' const authOptions : AuthOptions = { providers: [ CredentialsProvider({ - name: "Credentials", + name: 'Credentials', credentials: { - username: { label: "Username", type: "text" }, - password: { label: "Password", type: "password" } + username: { label: 'Username', type: 'text' }, + password: { label: 'Password', type: 'password' } }, authorize: async (credentials) => { const user = await prisma.user.findUnique({ @@ -28,7 +28,7 @@ const authOptions : AuthOptions = { }) ], session: { - strategy: "jwt" + strategy: 'jwt' }, callbacks: { async session({ session, token }) { diff --git a/src/prisma/index.ts b/src/prisma/index.ts index 1fac35d44..dda84f8cb 100644 --- a/src/prisma/index.ts +++ b/src/prisma/index.ts @@ -2,6 +2,6 @@ import { PrismaClient } from '@prisma/client' const prisma = global.prisma || new PrismaClient() -if (process.env.NODE_ENV !== "production") global.prisma = prisma +if (process.env.NODE_ENV !== 'production') global.prisma = prisma export default prisma diff --git a/src/prisma/seed.ts b/src/prisma/seed.ts index 282f95300..5e13c2cdc 100644 --- a/src/prisma/seed.ts +++ b/src/prisma/seed.ts @@ -1,7 +1,7 @@ import { PrismaClient } from '@prisma/client' const prisma = new PrismaClient() -console.log("seed starting...") +console.log('seed starting...') async function main() { const harambe = await prisma.user.upsert({ where: { diff --git a/src/typings/global.d.ts b/src/typings/global.d.ts index 684f63994..614922dc5 100644 --- a/src/typings/global.d.ts +++ b/src/typings/global.d.ts @@ -1,5 +1,5 @@ -import { Prisma, PrismaClient } from "@prisma/client"; -import { DefaultArgs } from "@prisma/client/runtime/library"; +import { Prisma, PrismaClient } from '@prisma/client'; +import { DefaultArgs } from '@prisma/client/runtime/library'; declare global { // eslint-disable-next-line no-var diff --git a/src/typings/next-auth.d.ts b/src/typings/next-auth.d.ts index 533f47629..830a758d9 100644 --- a/src/typings/next-auth.d.ts +++ b/src/typings/next-auth.d.ts @@ -1,7 +1,7 @@ -import type { User as prismaUser } from "@prisma/client" +import type { User as prismaUser } from '@prisma/client' import 'next-auth' -declare module "next-auth" { +declare module 'next-auth' { interface User extends prismaUser {id: number} interface Session { @@ -9,7 +9,7 @@ declare module "next-auth" { } } -declare module "next-auth/jwt" { +declare module 'next-auth/jwt' { interface JWT { user: prismaUser } From 89d9acb451610d2b1cba5093fa424735f3663ac5 Mon Sep 17 00:00:00 2001 From: JohanHjelsethStorstad <82723971+JohanHjelsethStorstad@users.noreply.github.com> Date: Tue, 31 Oct 2023 21:57:38 +0100 Subject: [PATCH 19/25] chore: add a lot of lint-rules --- .eslintrc.json | 163 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 163 insertions(+) diff --git a/.eslintrc.json b/.eslintrc.json index dab8660a1..f548a9aef 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -109,6 +109,169 @@ "avoid-escape" ], "jsx-quotes": ["error", "prefer-double"], + // require camel case names + "camelcase": [ + "error", + { + "properties": "never" + } + ], + // enforce spacing before and after comma + "comma-spacing": [ + "error", + { + "before": false, + "after": true + } + ], + // enforce one true comma style + "comma-style": [ + "error", + "last" + ], + "key-spacing": [ + "error", + { + "beforeColon": false, + "afterColon": true + } + ], + // require a space before & after certain keywords + "keyword-spacing": [ + "error", + { + "before": true, + "after": true, + "overrides": { + "return": { "after": true }, + "throw": { "after": true }, + "case": { "after": true } + } + } + ], + // disallow mixed "LF" and "CRLF" as linebreaks + "linebreak-style": [ + "error", + "unix" + ], + // specify the maximum length of a line in your program + "max-len": [ + "error", + 100, + 4, + { + "ignoreUrls": true, + "ignoreComments": false, + "ignoreTemplateLiterals": true, + "ignoreStrings": true, + "ignoreRegExpLiterals": true + } + ], + // specify the maximum depth callbacks can be nested + "max-nested-callbacks": [ + "error", + 3 + ], + // disallow the omission of parentheses when invoking a constructor with no arguments + "new-parens": "error", + // enforces new line after each method call in the chain to make it + // more readable and easy to maintain + "newline-per-chained-call": [ + "error", + { + "ignoreChainWithDepth": 4 + } + ], + // disallow use of the Array constructor + "no-array-constructor": "error", + // disallow use of the continue statement + "no-continue": "warn", + // disallow if as the only statement in an else block + "no-lonely-if": "error", + // disallow mixed spaces and tabs for indentation + "no-mixed-spaces-and-tabs": "error", + // disallow multiple empty lines and only one newline at the end + "no-multiple-empty-lines": [ + "error", + { + "max": 2, + "maxEOF": 1 + } + ], + // disallow nested ternary expressions + "no-nested-ternary": "error", + // disallow use of the Object constructor + "no-new-object": "error", + // disallow space between function identifier and application + "no-spaced-func": "error", + // disallow trailing whitespace at the end of lines + "no-trailing-spaces": "error", + // disallow the use of Boolean literals in conditional expressions + // also, prefer `a || b` over `a ? a : b` + "no-unneeded-ternary": [ + "error", + { + "defaultAssignment": true + } + ], + // disallow whitespace before properties + "no-whitespace-before-property": "error", + // require padding inside curly braces + "object-curly-spacing": [ + "error", + "always" + ], + // require a newline around variable declaration + "one-var-declaration-per-line": [ + "error", + "always" + ], + // enforce padding within blocks + "padded-blocks": [ + "error", + "never" + ], + // require quotes around object literal property names + "quote-props": [ + "warn", + "as-needed", + { + "keywords": false, + "unnecessary": true, + "numbers": false + } + ], + // specify whether double or single quotes should be used + // enforce spacing before and after semicolons + "semi-spacing": [ + "error", + { + "before": false, + "after": true + } + ], + // require or disallow use of semicolons instead of ASI + "semi": [ + "error", + "always" + ], + // require or disallow space before blocks + "space-before-blocks": "error", + // require or disallow space before function opening parenthesis + "space-before-function-paren": [ + "error", + { + "anonymous": "always", + "named": "never" + } + ], + // require or disallow spaces inside parentheses + "space-in-parens": [ + "error", + "never" + ], + // require spaces around operators + "space-infix-ops": "error", //SOME ODD OPTIONS: // suggest using the spread operator instead of .apply() From 99898123f6d2a1f6ec29cd71e99933c1b4a3bf37 Mon Sep 17 00:00:00 2001 From: JohanHjelsethStorstad <82723971+JohanHjelsethStorstad@users.noreply.github.com> Date: Tue, 31 Oct 2023 22:02:01 +0100 Subject: [PATCH 20/25] fix: linting errors: mostly to do with semicolons and obj spacing --- .eslintrc.json | 10 +------ src/app/(home)/InfoBubbles.tsx | 9 ++++--- src/app/(home)/Section.tsx | 6 ++--- src/app/(home)/page.tsx | 26 ++++++++++-------- src/app/api/users/route.ts | 18 ++++++------- src/app/components/Checkbox/Checkbox.tsx | 2 +- src/app/components/Footer/Footer.tsx | 3 ++- src/app/components/FormInput/FormInput.tsx | 3 +-- src/app/components/GoogleMap/GoogleMap.tsx | 14 +++++----- src/app/components/NavBar/BurgerItem.tsx | 2 +- src/app/components/NavBar/BurgerMenu.tsx | 2 +- src/app/components/NavBar/Dropdown.tsx | 6 ++--- src/app/components/NavBar/MobileNavBar.tsx | 10 +++---- src/app/components/NavBar/NavBar.tsx | 27 +++++++++---------- .../PrimaryButton/PrimaryButton.tsx | 1 - src/app/components/YouTube/YouTube.tsx | 2 +- src/app/users/[username]/page.tsx | 8 +++--- src/auth/index.ts | 12 ++++----- src/typings/global.d.ts | 4 +-- 19 files changed, 80 insertions(+), 85 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index f548a9aef..138915fbe 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -242,18 +242,10 @@ } ], // specify whether double or single quotes should be used - // enforce spacing before and after semicolons - "semi-spacing": [ - "error", - { - "before": false, - "after": true - } - ], // require or disallow use of semicolons instead of ASI "semi": [ "error", - "always" + "never" ], // require or disallow space before blocks "space-before-blocks": "error", diff --git a/src/app/(home)/InfoBubbles.tsx b/src/app/(home)/InfoBubbles.tsx index 711d56b60..5d77e2b08 100644 --- a/src/app/(home)/InfoBubbles.tsx +++ b/src/app/(home)/InfoBubbles.tsx @@ -1,4 +1,4 @@ -import styles from './InfoBubbles.module.scss'; +import styles from './InfoBubbles.module.scss' import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' import { faCircle, @@ -17,7 +17,7 @@ function InfoBubbles() {
    Sosialt
    - Sct. Omega Broderskaps mål er å skape et fargerikt sosialt liv for studenter + Sct. Omega Broderskaps mål er å skape et fargerikt sosialt liv for studenter ved studiene for Elektronisk Systemdesign og Innovasjon, og Kybernetikk og Robotikk.
    @@ -28,7 +28,8 @@ function InfoBubbles() {
    Komitéer
    - Linjeforeningen består av 17 komitéer som alle inkluderer studenter på et bredt spekter, + Linjeforeningen består av 17 komitéer som alle inkluderer + studenter på et bredt spekter, med alt fra revy til store fester som Phaestum Immatricularis.
    @@ -39,7 +40,7 @@ function InfoBubbles() {
    Næringsliv
    - Omega har kontakt med mange bedrifter og jobber kontinuerlig med å skape + Omega har kontakt med mange bedrifter og jobber kontinuerlig med å skape et godt forhold mellom studenten og en fremtidig arbeidsplass.
    diff --git a/src/app/(home)/Section.tsx b/src/app/(home)/Section.tsx index 7cb4c603c..fe5773639 100644 --- a/src/app/(home)/Section.tsx +++ b/src/app/(home)/Section.tsx @@ -13,11 +13,11 @@ type PropTypes = { id?: string, } -function Section({children, img, name, lesMer, right, imgWidth, id}: PropTypes) { +function Section({ children, img, name, lesMer, right, imgWidth, id }: PropTypes) { const alt = `image of ${name}` const imgContainer = ( -
    - + {alt}
    - Sct. Omega Broderskab ble offisielt stiftet 21. november 1919 av et kull elektrostudenter - som må ha hatt et svært godt kameratskap og sosialt miljø. Til å begynne med var det en - eksklusiv klubb forbeholdt 3. og 4. årskurs, og for å bli tatt opp måtte man sende inn - en fyldig søknad. Dette har endret seg gjennom årene, og i dag blir medlemmene tatt + Sct. Omega Broderskab ble offisielt stiftet 21. november 1919 av et kull elektrostudenter + som må ha hatt et svært godt kameratskap og sosialt miljø. Til å begynne med var det en + eksklusiv klubb forbeholdt 3. og 4. årskurs, og for å bli tatt opp måtte man sende inn + en fyldig søknad. Dette har endret seg gjennom årene, og i dag blir medlemmene tatt opp automatisk fra 1. klasse.
    - Omega Verksted er en forening for elektronikk- og hobbyinteresserte studenter ved - Norges Teknisk-Naturvitenskapelige Universitet (NTNU) stiftet i 1971. Omega Verksted holder - til i kjelleren i det gamle elektrobygget på Gløshaugen (G 016 A). Verkstedet inneholder - det meste av verktøy for små og store prosjekter, i tillegg til et knippe + Omega Verksted er en forening for elektronikk- og hobbyinteresserte studenter ved + Norges Teknisk-Naturvitenskapelige + Universitet (NTNU) stiftet i 1971. Omega Verksted holder + til i kjelleren i det gamle elektrobygget på Gløshaugen (G 016 A). + Verkstedet inneholder + det meste av verktøy for små og store prosjekter, i tillegg til et knippe datamaskiner samt et solid utvalg av brus og sjokolade.
    @@ -59,9 +61,11 @@ export default function Home() {
    Ohma Electra er Omega sin stolthet, og hennes historie strekker seg helt tilbake til 1908. - Ohma er verdens første(!) fungerende vekselstrøm-lokomotiv, og har en lang historie fra både - gruvedrift, sabotasje under 2. verdenskrig, og som glamourmodell på utsiden av elektrobygget. - Det er ingen hemmelighet at Ohma er det fineste lokomotivet i hele Norge, og hvis du er + Ohma er verdens første(!) fungerende + vekselstrøm-lokomotiv, og har en lang historie fra både + gruvedrift, sabotasje under 2. verdenskrig, og som + glamourmodell på utsiden av elektrobygget. + Det er ingen hemmelighet at Ohma er det fineste lokomotivet i hele Norge, og hvis du er heldig får du kanskje bli med på en kjøretur.
    diff --git a/src/app/api/users/route.ts b/src/app/api/users/route.ts index c5e6f87ec..3651e5e2e 100644 --- a/src/app/api/users/route.ts +++ b/src/app/api/users/route.ts @@ -9,11 +9,11 @@ export async function GET() { return NextResponse.json(users) } -export async function POST(req: NextRequest) { +export async function POST(req: NextRequest) { const body = await req.json() - - const { username, password, email, firstname, lastname } = body; - + + const { username, password, email, firstname, lastname } = body + if (!username || !password || !email || !firstname || !lastname) { return NextResponse.json({}, { status: 400 }) } @@ -30,16 +30,16 @@ export async function POST(req: NextRequest) { }) return NextResponse.json(user) - } catch (error) { + } catch (error) { // synes dette er en veldig stygg måte å håndtere feil på if ( error instanceof Prisma.PrismaClientKnownRequestError && error.code === 'P2002' - ) + ) { return NextResponse.json({}, { status: 409 }) - } - + } + return NextResponse.json({}, { status: 500 }) - } + } } diff --git a/src/app/components/Checkbox/Checkbox.tsx b/src/app/components/Checkbox/Checkbox.tsx index d504588c3..e5342c2cd 100644 --- a/src/app/components/Checkbox/Checkbox.tsx +++ b/src/app/components/Checkbox/Checkbox.tsx @@ -1,5 +1,5 @@ import { v4 as uuid } from 'uuid' -import styles from './Checkbox.module.scss'; +import styles from './Checkbox.module.scss' type PropTypes = { label: string diff --git a/src/app/components/Footer/Footer.tsx b/src/app/components/Footer/Footer.tsx index 278ca754c..1e8ab28c4 100644 --- a/src/app/components/Footer/Footer.tsx +++ b/src/app/components/Footer/Footer.tsx @@ -14,7 +14,8 @@ function Footer() {
    sct. omega broderskab

    - Linjeforeningen for Elektronisk Systemdesign og Innovasjon (MTELSYS) og Kybernetikk og + Linjeforeningen for Elektronisk Systemdesign + og Innovasjon (MTELSYS) og Kybernetikk og Robotikk (MTTK) ved Norges Tekniske-Naturvitenskapelige Universitet (NTNU)

    diff --git a/src/app/components/FormInput/FormInput.tsx b/src/app/components/FormInput/FormInput.tsx index b27ed909e..16c33222b 100644 --- a/src/app/components/FormInput/FormInput.tsx +++ b/src/app/components/FormInput/FormInput.tsx @@ -8,7 +8,7 @@ type PropTypes = { name: string, } -function FormInput({label, type, id, name} : PropTypes) { +function FormInput({ label, type, id, name } : PropTypes) { label ??= '' type ??= (type !== undefined) ? type : 'text' id ??= `id_input_${uuid()}` @@ -17,7 +17,6 @@ function FormInput({label, type, id, name} : PropTypes) {
    - } export default FormInput diff --git a/src/app/components/GoogleMap/GoogleMap.tsx b/src/app/components/GoogleMap/GoogleMap.tsx index 0ce7ff2b5..b8384ccba 100644 --- a/src/app/components/GoogleMap/GoogleMap.tsx +++ b/src/app/components/GoogleMap/GoogleMap.tsx @@ -1,7 +1,7 @@ 'use client' import styles from './GoogleMap.module.scss' -import GoogleMapReact from 'google-map-react'; -import { Coords } from 'google-map-react'; +import GoogleMapReact from 'google-map-react' +import { Coords } from 'google-map-react' type PropTypes = { location: Coords, @@ -10,14 +10,14 @@ type PropTypes = { function GoogleMap({ location, height } : PropTypes) { return ( -
    - +
    ) } -export default GoogleMap; +export default GoogleMap diff --git a/src/app/components/NavBar/BurgerItem.tsx b/src/app/components/NavBar/BurgerItem.tsx index 45ed2f713..c21be2752 100644 --- a/src/app/components/NavBar/BurgerItem.tsx +++ b/src/app/components/NavBar/BurgerItem.tsx @@ -11,7 +11,7 @@ type PropTypes = { } function BurgerItem({ href, name, icon, shortName } : PropTypes) { - shortName ??= name; + shortName ??= name return ( diff --git a/src/app/components/NavBar/BurgerMenu.tsx b/src/app/components/NavBar/BurgerMenu.tsx index 191868664..ddefe49e2 100644 --- a/src/app/components/NavBar/BurgerMenu.tsx +++ b/src/app/components/NavBar/BurgerMenu.tsx @@ -33,7 +33,7 @@ function BurgerMenu({ isLoggedIn, applicationPeriod }:PropTypes) { {!isLoggedIn && } - {isLoggedIn && + {isLoggedIn && <> diff --git a/src/app/components/NavBar/Dropdown.tsx b/src/app/components/NavBar/Dropdown.tsx index 11eccf369..909ffac5e 100644 --- a/src/app/components/NavBar/Dropdown.tsx +++ b/src/app/components/NavBar/Dropdown.tsx @@ -18,10 +18,10 @@ function DropDown({ name, items } : PropTypes) {
  • { name }
    - {items.map(item => + {items.map(item =>
    - - + +

    {item.name}

    diff --git a/src/app/components/NavBar/MobileNavBar.tsx b/src/app/components/NavBar/MobileNavBar.tsx index 2894b0047..6a158a4aa 100644 --- a/src/app/components/NavBar/MobileNavBar.tsx +++ b/src/app/components/NavBar/MobileNavBar.tsx @@ -22,14 +22,14 @@ type PropTypes = { function MobileNavBar({ session } : PropTypes) { const [burgerOpen, setBurgerOpen] = useState(false) - const isLoggedIn = Boolean(session?.user); + const isLoggedIn = Boolean(session?.user) const applicationPeriod = true return (