From 19cdd63c339a07c9d5e95fe75c1f681f9c96ebac Mon Sep 17 00:00:00 2001 From: Ryota Ikezawa Date: Sat, 16 Mar 2024 16:24:08 +0000 Subject: [PATCH 1/4] :gear: Added prettier and ESLint --- .eslintrc.json | 14 +- .prettierignore | 51 + .prettierrc.js | 7 + README.md | 4 +- app/[...slug]/page.tsx | 2 +- app/layout.tsx | 6 +- app/page.tsx | 2 +- app/posts/[...slug]/page.tsx | 4 +- components/mode-toggle.tsx | 6 +- package.json | 17 +- pnpm-lock.yaml | 3474 ++++++++++++++++++---------------- 11 files changed, 1907 insertions(+), 1680 deletions(-) create mode 100644 .prettierignore create mode 100644 .prettierrc.js diff --git a/.eslintrc.json b/.eslintrc.json index bffb357..683a2db 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -1,3 +1,15 @@ { - "extends": "next/core-web-vitals" + "extends": [ + "next", + "next/core-web-vitals", + "prettier", + "plugin:tailwindcss/recommended" + ], + "plugins": [ + "unused-imports" + ], + "rules": { + "import/order": "error", + "unused-imports/no-unused-imports": "error" + } } diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..2d17903 --- /dev/null +++ b/.prettierignore @@ -0,0 +1,51 @@ +# ============================= Copied from .gitignore ============================= +# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. + +# dependencies +/node_modules +/.pnp +.pnp.js + +# testing +/coverage + +# next.js +/.next/ +/out/ + +# production +/build + +# misc +.DS_Store +*.pem + +# debug +npm-debug.log* +yarn-debug.log* +yarn-error.log* +.pnpm-debug.log* + +# local env files +.env*.local + +# vercel +.vercel + +# typescript +*.tsbuildinfo +next-env.d.ts + +# Contentlayer +.contentlayer + +# Sitemap related files (generated by next-sitemap) +/public/robots.txt +/public/sitemap*.xml + +# RSS related files (generated by generateRSS.js) +/public/atom.xml +/public/feed.xml +/public/feed.json + +# ============================ ./Copied from .gitignore ============================ diff --git a/.prettierrc.js b/.prettierrc.js new file mode 100644 index 0000000..fba52b5 --- /dev/null +++ b/.prettierrc.js @@ -0,0 +1,7 @@ +module.exports = { + trailingComma: 'es5', + singleQuote: true, + printWidth: 80, + semi: true, + plugins: ['prettier-plugin-tailwindcss'], +}; diff --git a/README.md b/README.md index 589bbbf..700f54f 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,5 @@ # Next.js + Contentlayer -A template with Next.js 13 app dir, Contentlayer, Tailwind CSS and dark mode. +A template with Next.js 14 app dir, Contentlayer, Tailwind CSS and dark mode. https://next-contentlayer.vercel.app - - diff --git a/app/[...slug]/page.tsx b/app/[...slug]/page.tsx index c56744c..8742cb4 100644 --- a/app/[...slug]/page.tsx +++ b/app/[...slug]/page.tsx @@ -50,7 +50,7 @@ export default async function PagePage({ params }: PageProps) { } return ( -
+

{page.title}

{page.description &&

{page.description}

}
diff --git a/app/layout.tsx b/app/layout.tsx index 87cbe0b..1df2415 100644 --- a/app/layout.tsx +++ b/app/layout.tsx @@ -21,14 +21,14 @@ export default function RootLayout({ children }: RootLayoutProps) { return ( -
+
-