From 097dafb5534d60bc43df6f4f359e9facf1dcfc5f Mon Sep 17 00:00:00 2001 From: Thijs van Loef Date: Mon, 9 Jun 2025 23:49:35 +0200 Subject: [PATCH 1/3] enable automated linting --- .github/workflows/linting.yml | 34 ++++++++++++++++++++++++++++++++++ eslint.config.js | 25 ++++++++++++++++--------- 2 files changed, 50 insertions(+), 9 deletions(-) create mode 100644 .github/workflows/linting.yml diff --git a/.github/workflows/linting.yml b/.github/workflows/linting.yml new file mode 100644 index 00000000..90c5dc86 --- /dev/null +++ b/.github/workflows/linting.yml @@ -0,0 +1,34 @@ +name: ESLint Linting + +on: + pull_request: + paths: + - '**/*.js' + - '**/*.jsx' + - '**/*.ts' + - '**/*.tsx' + - '.eslintrc*' + - 'package.json' + - 'yarn.lock' + - 'pnpm-lock.yaml' + - 'package-lock.json' + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + + - name: Install dependencies + run: | + npm ci + + - name: Run ESLint + run: | + npx eslint . --ext .js,.jsx,.ts,.tsx \ No newline at end of file diff --git a/eslint.config.js b/eslint.config.js index 32a7f598..dfc194bc 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -1,12 +1,19 @@ import tseslint from 'typescript-eslint'; -export default tseslint.config( - tseslint.configs.recommended, - { - files: ["**/*.ts", "**/*.tsx", "**/*.js", "**/*.jsx"], - rules: { - semi: "error", - "prefer-const": "error" - } +export default tseslint.config({ + files: ["**/*.{ts,tsx,js,jsx}"], + languageOptions: { + parser: tseslint.parser, + parserOptions: { + ecmaVersion: "latest", + sourceType: "module", + ecmaFeatures: { + jsx: true + } } -); + }, + rules: { + "semi": "error", + "prefer-const": "warn" + } +}); \ No newline at end of file From 3ee9051bc17f0cb5f05b6e7fa5af1b19bae4d068 Mon Sep 17 00:00:00 2001 From: Thijs van Loef Date: Mon, 9 Jun 2025 23:51:53 +0200 Subject: [PATCH 2/3] change naming --- .github/workflows/linting.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/linting.yml b/.github/workflows/linting.yml index 90c5dc86..750f9ecc 100644 --- a/.github/workflows/linting.yml +++ b/.github/workflows/linting.yml @@ -1,4 +1,4 @@ -name: ESLint Linting +name: ESLint on: pull_request: @@ -14,7 +14,7 @@ on: - 'package-lock.json' jobs: - lint: + Linter: runs-on: ubuntu-latest steps: - name: Checkout code From cbca88f76bdceee28f0cc2857dc0273ef659dfdd Mon Sep 17 00:00:00 2001 From: Thijs van Loef Date: Mon, 9 Jun 2025 23:52:16 +0200 Subject: [PATCH 3/3] fix semi colons --- server/lib/stoi.ts | 2 +- server/routers/auth/logout.ts | 2 +- server/setup/scriptsSqlite/1.0.0-beta6.ts | 4 +- src/components/ui/avatar.tsx | 22 ++++---- src/components/ui/breadcrumb.tsx | 42 +++++++-------- src/components/ui/collapsible.tsx | 12 ++--- src/components/ui/command.tsx | 54 ++++++++++---------- src/components/ui/dropdown-menu.tsx | 62 +++++++++++------------ src/components/ui/input-otp.tsx | 34 ++++++------- src/components/ui/label.tsx | 18 +++---- src/components/ui/popover.tsx | 18 +++---- src/components/ui/radio-group.tsx | 24 ++++----- src/components/ui/scroll-area.tsx | 14 ++--- src/components/ui/select.tsx | 46 ++++++++--------- src/components/ui/separator.tsx | 14 ++--- src/components/ui/sheet.tsx | 48 +++++++++--------- src/components/ui/switch.tsx | 14 ++--- src/components/ui/tabs.tsx | 24 ++++----- src/components/ui/textarea.tsx | 12 ++--- src/components/ui/toast.tsx | 44 ++++++++-------- src/components/ui/toaster.tsx | 12 ++--- 21 files changed, 261 insertions(+), 261 deletions(-) diff --git a/server/lib/stoi.ts b/server/lib/stoi.ts index 8fa42b54..ebc789e6 100644 --- a/server/lib/stoi.ts +++ b/server/lib/stoi.ts @@ -1,6 +1,6 @@ export default function stoi(val: any) { if (typeof val === "string") { - return parseInt(val) + return parseInt(val); } else { return val; diff --git a/server/routers/auth/logout.ts b/server/routers/auth/logout.ts index db95c2e6..b9a1431a 100644 --- a/server/routers/auth/logout.ts +++ b/server/routers/auth/logout.ts @@ -34,7 +34,7 @@ export async function logout( try { await invalidateSession(session.sessionId); } catch (error) { - logger.error("Failed to invalidate session", error) + logger.error("Failed to invalidate session", error); } const isSecure = req.protocol === "https"; diff --git a/server/setup/scriptsSqlite/1.0.0-beta6.ts b/server/setup/scriptsSqlite/1.0.0-beta6.ts index 4fcfb114..8fbb1387 100644 --- a/server/setup/scriptsSqlite/1.0.0-beta6.ts +++ b/server/setup/scriptsSqlite/1.0.0-beta6.ts @@ -44,8 +44,8 @@ export default async function migration() { const updatedYaml = yaml.dump(rawConfig); fs.writeFileSync(filePath, updatedYaml, "utf8"); } catch (error) { - console.log("We were unable to add CORS to your config file. Please add it manually.") - console.error(error) + console.log("We were unable to add CORS to your config file. Please add it manually."); + console.error(error); } console.log("Done."); diff --git a/src/components/ui/avatar.tsx b/src/components/ui/avatar.tsx index ef6e4355..44c1b5b5 100644 --- a/src/components/ui/avatar.tsx +++ b/src/components/ui/avatar.tsx @@ -1,9 +1,9 @@ -"use client" +"use client"; -import * as React from "react" -import * as AvatarPrimitive from "@radix-ui/react-avatar" +import * as React from "react"; +import * as AvatarPrimitive from "@radix-ui/react-avatar"; -import { cn } from "@app/lib/cn" +import { cn } from "@app/lib/cn"; const Avatar = React.forwardRef< React.ElementRef, @@ -17,8 +17,8 @@ const Avatar = React.forwardRef< )} {...props} /> -)) -Avatar.displayName = AvatarPrimitive.Root.displayName +)); +Avatar.displayName = AvatarPrimitive.Root.displayName; const AvatarImage = React.forwardRef< React.ElementRef, @@ -29,8 +29,8 @@ const AvatarImage = React.forwardRef< className={cn("aspect-square h-full w-full", className)} {...props} /> -)) -AvatarImage.displayName = AvatarPrimitive.Image.displayName +)); +AvatarImage.displayName = AvatarPrimitive.Image.displayName; const AvatarFallback = React.forwardRef< React.ElementRef, @@ -44,7 +44,7 @@ const AvatarFallback = React.forwardRef< )} {...props} /> -)) -AvatarFallback.displayName = AvatarPrimitive.Fallback.displayName +)); +AvatarFallback.displayName = AvatarPrimitive.Fallback.displayName; -export { Avatar, AvatarImage, AvatarFallback } +export { Avatar, AvatarImage, AvatarFallback }; diff --git a/src/components/ui/breadcrumb.tsx b/src/components/ui/breadcrumb.tsx index dd40aa55..98c13818 100644 --- a/src/components/ui/breadcrumb.tsx +++ b/src/components/ui/breadcrumb.tsx @@ -1,16 +1,16 @@ -import * as React from "react" -import { Slot } from "@radix-ui/react-slot" -import { ChevronRight, MoreHorizontal } from "lucide-react" +import * as React from "react"; +import { Slot } from "@radix-ui/react-slot"; +import { ChevronRight, MoreHorizontal } from "lucide-react"; -import { cn } from "@app/lib/cn" +import { cn } from "@app/lib/cn"; const Breadcrumb = React.forwardRef< HTMLElement, React.ComponentPropsWithoutRef<"nav"> & { separator?: React.ReactNode } ->(({ ...props }, ref) =>