diff --git a/.eslintrc.json b/.eslintrc.json index bffb357..4d765f2 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -1,3 +1,3 @@ { - "extends": "next/core-web-vitals" + "extends": ["next/core-web-vitals", "prettier"] } diff --git a/.github/workflows/nextjs.yml b/.github/workflows/nextjs.yml index ef15fba..b7341dd 100644 --- a/.github/workflows/nextjs.yml +++ b/.github/workflows/nextjs.yml @@ -28,6 +28,9 @@ jobs: # Build job build: runs-on: ubuntu-latest + strategy: + matrix: + job: ["prettier", "build"] env: NEXT_PUBLIC_CONTENTFUL_SPACE_ID: ${{ secrets.NEXT_PUBLIC_CONTENTFUL_SPACE_ID }} @@ -86,12 +89,17 @@ jobs: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json', '**/yarn.lock') }}- - name: Install dependencies run: ${{ steps.detect-package-manager.outputs.manager }} ${{ steps.detect-package-manager.outputs.command }} + - name: Check formatting + run: npx prettier --check . + if: matrix.job == 'prettier' - name: Build with Next.js run: ${{ steps.detect-package-manager.outputs.runner }} next build + if: matrix.job == 'build' - name: Upload artifact uses: actions/upload-pages-artifact@v3 with: path: ./out + if: matrix.job == 'build' # Deployment job deploy: diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000..33a3ebc --- /dev/null +++ b/.prettierrc @@ -0,0 +1,4 @@ +{ + "trailingComma": "all", + "printWidth": 80 +} diff --git a/README.md b/README.md index 5d14524..5a4675f 100644 --- a/README.md +++ b/README.md @@ -18,19 +18,22 @@ bun dev Open [http://localhost:3000](http://localhost:3000) with your browser to see the result. -## Depolyment +## Deployment -This site will be deployed on to Github Pages as a static site. +This site will be deployed on to Github Pages as a static site. To do a local build of the site, run: + +```bash +pnpm build +``` ## Testing This site will be tested using Playwright and Jest. -## Learn More +## Code Quality -To learn more about Next.js, take a look at the following resources: +To ensure code quality, this site will use ESLint and Prettier. To format project code locally, run: -- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API. -- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial. - -You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome! +```bash +pnpm format +``` diff --git a/next.config.mjs b/next.config.mjs index 4f7fcad..bb47cde 100644 --- a/next.config.mjs +++ b/next.config.mjs @@ -2,6 +2,9 @@ const nextConfig = { assetPrefix: process.env.NEXT_PUBLIC_BASE_PATH, basePath: process.env.NEXT_PUBLIC_BASE_PATH, + eslint: { + dirs: ["src"], + }, experimental: { esmExternals: true, }, diff --git a/package.json b/package.json index e630779..4d0e930 100644 --- a/package.json +++ b/package.json @@ -5,12 +5,13 @@ "author": "Adam J. Arling ", "license": "MIT", "scripts": { - "dev": "next dev", "build": "next build", - "start": "next start", - "lint": "next lint", + "deploy": "gh-pages -d out", + "dev": "next dev", "export": "next export", - "deploy": "gh-pages -d out" + "format": "prettier --write .", + "lint": "next lint", + "start": "next start" }, "dependencies": { "@contentful/rich-text-react-renderer": "^15.21.2", @@ -34,8 +35,10 @@ "@types/react-dom": "^18.3.0", "eslint": "^9.3.0", "eslint-config-next": "14.2.3", + "eslint-config-prettier": "^9.1.0", "gh-pages": "^6.1.1", "postcss": "^8.4.38", + "prettier": "^3.2.5", "tailwindcss": "^3.4.3", "typescript": "^5.4.5" } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index d2330bb..9b9dc44 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -64,12 +64,18 @@ devDependencies: eslint-config-next: specifier: 14.2.3 version: 14.2.3(eslint@9.3.0)(typescript@5.4.5) + eslint-config-prettier: + specifier: ^9.1.0 + version: 9.1.0(eslint@9.3.0) gh-pages: specifier: ^6.1.1 version: 6.1.1 postcss: specifier: ^8.4.38 version: 8.4.38 + prettier: + specifier: ^3.2.5 + version: 3.2.5 tailwindcss: specifier: ^3.4.3 version: 3.4.3 @@ -1276,6 +1282,15 @@ packages: - supports-color dev: true + /eslint-config-prettier@9.1.0(eslint@9.3.0): + resolution: {integrity: sha512-NSWl5BFQWEPi1j4TjVNItzYV7dZXZ+wP6I6ZhrBGpChQhZRUaElihE9uRRkcbRnNb76UMKDF3r+WTmNcGPKsqw==} + hasBin: true + peerDependencies: + eslint: '>=7.0.0' + dependencies: + eslint: 9.3.0 + dev: true + /eslint-import-resolver-node@0.3.9: resolution: {integrity: sha512-WFj2isz22JahUv+B788TlO3N6zL3nNJGU8CcZbPZvVEkBPaJdCV4vy5wyghty5ROFbCRnm132v8BScu5/1BQ8g==} dependencies: @@ -2677,6 +2692,12 @@ packages: engines: {node: '>= 0.8.0'} dev: true + /prettier@3.2.5: + resolution: {integrity: sha512-3/GWa9aOC0YeD7LUfvOG2NiDyhOWRvt1k+rcKhOuYnMY24iiCphgneUfJDyFXd6rZCAnuLBv6UeAULtrhT/F4A==} + engines: {node: '>=14'} + hasBin: true + dev: true + /prop-types@15.8.1: resolution: {integrity: sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg==} dependencies: diff --git a/src/components/faq.tsx b/src/components/faq.tsx index 69441da..93f6376 100644 --- a/src/components/faq.tsx +++ b/src/components/faq.tsx @@ -13,8 +13,10 @@ import useGetContentfulData from "@/hooks/use-get-contentful-data"; export default function FaqList() { const data = useGetContentfulData("faq"); + const foo = "asdf"; + return ( -
+
{data && diff --git a/src/lib/content-management-batch-api-helpers.ts b/src/lib/content-management-batch-api-helpers.ts index 5329405..f54b734 100644 --- a/src/lib/content-management-batch-api-helpers.ts +++ b/src/lib/content-management-batch-api-helpers.ts @@ -18,7 +18,7 @@ async function batchHelper() { entries.items.map((entry) => client.entry.unpublish({ entryId: entry.sys.id, - }) - ) + }), + ), ); } diff --git a/src/lib/get-contentful.ts b/src/lib/get-contentful.ts index 1b92067..ee6458d 100644 --- a/src/lib/get-contentful.ts +++ b/src/lib/get-contentful.ts @@ -33,7 +33,7 @@ function getContentfulManagement() { // We are only managing the "hyku" environment with this client environmentId: "hyku", }, - } + }, ); }