diff --git a/.eslintignore b/.eslintignore deleted file mode 100644 index dc0f9d8..0000000 --- a/.eslintignore +++ /dev/null @@ -1,5 +0,0 @@ -dist/* -.cache -public -node_modules -*.esm.js diff --git a/.eslintrc.json b/.eslintrc.json deleted file mode 100644 index a704d9d..0000000 --- a/.eslintrc.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "$schema": "https://json.schemastore.org/eslintrc", - "root": true, - "extends": ["next/core-web-vitals", "prettier"], - "rules": { - "@next/next/no-html-link-for-pages": "off", - "react/jsx-key": "off", - "@next/next/no-img-element": "off" - }, - "settings": { - "next": { - "rootDir": ["./"] - } - }, - "overrides": [ - { - "files": ["*.ts", "*.tsx"], - "parser": "@typescript-eslint/parser" - } - ] -} diff --git a/.github/workflows/analysis.yml b/.github/workflows/analysis.yml new file mode 100644 index 0000000..e5508e1 --- /dev/null +++ b/.github/workflows/analysis.yml @@ -0,0 +1,50 @@ +name: Analysis + +# permissions: +# contents: read + +on: + push: + branches: [main] + pull_request: + branches: [main] + types: [opened, synchronize, reopened] + +jobs: + analysis: + timeout-minutes: 10 + runs-on: ubuntu-latest + steps: + - name: Harden Runner + uses: step-security/harden-runner@c6295a65d1254861815972266d5933fd6e532bdf # v2.11.1 + with: + disable-sudo-and-containers: true + egress-policy: audit + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: lts/* + - name: Install dependencies + run: npm ci + # TODO: Move to the trunk action once Eslint@9 is supported + - name: Run Trunk check + run: | + curl -fsSLO --retry 3 https://trunk.io/releases/trunk + chmod +x trunk + ./trunk check --ci + # TODO: Integrate with Trunk once Eslint@9 is supported + # https://github.com/trunk-io/plugins/issues/962 + - name: Run ESLint + run: npx next lint + # NOTE: Playwright seems to not recommend caching the browsers + - name: Install Playwright Browsers + run: npx playwright install --with-deps + # NOTE: Playwright will run `next build` and catch any issues + - name: Run Playwright tests + run: npx playwright test + - uses: actions/upload-artifact@v4 + if: ${{ !cancelled() }} + with: + name: playwright-report + path: playwright-report/ + retention-days: 30 diff --git a/.github/workflows/playwright.yml b/.github/workflows/playwright.yml deleted file mode 100644 index 930994c..0000000 --- a/.github/workflows/playwright.yml +++ /dev/null @@ -1,33 +0,0 @@ -name: Playwright Tests - -permissions: - contents: read - -on: - push: - branches: [main] - pull_request: - branches: [main] - types: [opened, synchronize, reopened] - -jobs: - test: - timeout-minutes: 10 - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 - with: - node-version: lts/* - - name: Install dependencies - run: npm ci - - name: Install Playwright Browsers - run: npx playwright install --with-deps - - name: Run Playwright tests - run: npx playwright test - - uses: actions/upload-artifact@v4 - if: ${{ !cancelled() }} - with: - name: playwright-report - path: playwright-report/ - retention-days: 30 diff --git a/.prettierignore b/.prettierignore deleted file mode 100644 index 2f73093..0000000 --- a/.prettierignore +++ /dev/null @@ -1,12 +0,0 @@ -cache -.cache -package.json -package-lock.json -public -CHANGELOG.md -.yarn -dist -node_modules -.next -build -.contentlayer \ No newline at end of file diff --git a/.trunk/configs/svgo.config.mjs b/.trunk/configs/svgo.config.mjs new file mode 100644 index 0000000..55b4a7a --- /dev/null +++ b/.trunk/configs/svgo.config.mjs @@ -0,0 +1,14 @@ +export default { + plugins: [ + { + name: "preset-default", + params: { + overrides: { + removeViewBox: false, // https://github.com/svg/svgo/issues/1128 + sortAttrs: true, + removeOffCanvasPaths: true, + }, + }, + }, + ], +}; diff --git a/.trunk/trunk.yaml b/.trunk/trunk.yaml index 536f2e5..8f43cde 100644 --- a/.trunk/trunk.yaml +++ b/.trunk/trunk.yaml @@ -2,16 +2,17 @@ # To learn more about the format of this file, see https://docs.trunk.io/reference/trunk-yaml version: 0.1 cli: - version: 1.22.10 + version: 1.22.15 # Trunk provides extensibility via plugins. (https://docs.trunk.io/plugins) plugins: sources: - id: trunk - ref: v1.6.7 + ref: v1.6.8 uri: https://github.com/trunk-io/plugins # Many linters and tools depend on runtimes - configure them here. (https://docs.trunk.io/runtimes) runtimes: enabled: + - node@22.15.1 - python@3.10.8 definitions: - type: node @@ -19,15 +20,19 @@ runtimes: # This is the section where you manage your linters. (https://docs.trunk.io/check/configuration) lint: enabled: - - checkov@3.2.365 - - eslint@8.57.0 + - actionlint@1.7.7 + - oxipng@9.1.5 + - svgo@3.3.2 + - checkov@3.2.424 + # TODO renable once https://github.com/trunk-io/plugins/issues/962 is resolved + # - eslint@9.26.0 - git-diff-check - markdownlint@0.44.0 - - osv-scanner@1.9.2 - - prettier@3.4.2 - - trivy@0.59.1 - - trufflehog@3.88.4 - - yamllint@1.35.1 + - osv-scanner@2.0.2 + - prettier@3.5.3 + - trivy@0.62.1 + - trufflehog@3.88.29 + - yamllint@1.37.1 actions: enabled: - trunk-announce diff --git a/app/layout.module.css b/app/layout.module.css index cb180d2..bfddb02 100644 --- a/app/layout.module.css +++ b/app/layout.module.css @@ -1,8 +1,9 @@ .body { min-height: 100vh; background-color: hsl(var(--background)); - font-family: var(--font-sans), ui-sans-serif, system-ui, sans-serif, - "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"; + font-family: + var(--font-sans), ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", + "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; } diff --git a/app/page.tsx b/app/page.tsx index 189a397..69eccb9 100644 --- a/app/page.tsx +++ b/app/page.tsx @@ -89,6 +89,8 @@ export default function IndexPage() { title="Deploy with Vercel" target="_blank" > + {/* next/image is unnecessary for this svg */} + {/* eslint-disable-next-line @next/next/no-img-element */} Deploy with Vercel + {/* next/image is unnecessary for this svg */} + {/* eslint-disable-next-line @next/next/no-img-element */} Deploy to Netlify { +function LogoMarkSpark(props: Props) { const theme = useTheme(); const [visualData, setVisualData] = useState< @@ -43,7 +43,6 @@ const LogoMarkSpark = forwardRef((props: Props, ref) => { /> ); -}); -LogoMarkSpark.displayName = "LogoMarkSpark"; +} export default LogoMarkSpark; diff --git a/components/effects/useSiteKey.ts b/components/effects/useSiteKey.ts index b73b9ed..8dad4fa 100644 --- a/components/effects/useSiteKey.ts +++ b/components/effects/useSiteKey.ts @@ -1,9 +1,7 @@ -interface Props {} - /** * Use Site Key * Returns the Arcjet site key for the active deployment if available. */ -export default function useSiteKey(props?: Props) { +export default function useSiteKey() { return { siteKey: process.env.ARCJET_SITE ? process.env.ARCJET_SITE : null }; } diff --git a/components/elements/Block.tsx b/components/elements/Block.tsx index d5a7556..0e74eda 100644 --- a/components/elements/Block.tsx +++ b/components/elements/Block.tsx @@ -4,7 +4,7 @@ import { Slot } from "@radix-ui/react-slot"; import { cva, type VariantProps } from "class-variance-authority"; import * as React from "react"; import { memo } from "react"; -import styled from "styled-components"; +import styled, { type WebTarget } from "styled-components"; import styles from "./Block.module.scss"; @@ -26,8 +26,8 @@ export const variants = cva(styles.Block, { }, }); -const styledComp = (type: { comp: any; name: string }) => - styled(type.comp)(({ theme, ...props }) => { +const styledComp = (type: { comp: WebTarget; name: string }) => + styled(type.comp)((props) => { const padX = Array.isArray(props.pad) ? props.pad[0] : props.pad != undefined diff --git a/components/ui/input.tsx b/components/ui/input.tsx index ad031e8..291fdf4 100644 --- a/components/ui/input.tsx +++ b/components/ui/input.tsx @@ -3,21 +3,19 @@ import * as React from "react"; import { cn } from "@/lib/utils"; import styles from "./input.module.css"; -export interface InputProps - extends React.InputHTMLAttributes {} - -const Input = React.forwardRef( - ({ className, type, ...props }, ref) => { - return ( - - ); - }, -); +const Input = React.forwardRef< + HTMLInputElement, + React.InputHTMLAttributes +>(({ className, type, ...props }, ref) => { + return ( + + ); +}); Input.displayName = "Input"; export { Input }; diff --git a/components/ui/textarea.tsx b/components/ui/textarea.tsx index dfc54c8..5dfca66 100644 --- a/components/ui/textarea.tsx +++ b/components/ui/textarea.tsx @@ -3,20 +3,14 @@ import * as React from "react"; import { cn } from "@/lib/utils"; import styles from "./textarea.module.css"; -export interface TextareaProps - extends React.TextareaHTMLAttributes {} - -const Textarea = React.forwardRef( - ({ className, ...props }, ref) => { - return ( -