-
Create a fresh new Next js project. https://nextjs.org/docs/getting-started#automatic-setup
pnpm create next-app --typescript
-
install prettier
pnpm add -D prettier
-
Use eslint-config-prettier to setup prettier and eslint without conflicts https://nextjs.org/docs/getting-started#automatic-setup
pnpm add -D eslint-config-prettier
-
Then, add prettier to your existing ESLint config
{ "extends": ["next", "prettier"] }
-
Install TailwindCSS on your Next.js project https://tailwindcss.com/docs/guides/nextjs
- Install Tailwind CSS
pnpm add -D tailwindcss postcss autoprefixer
- Run the init command to generate both
tailwind.config.js
andpostcss.config.js
pnpm tailwindcss init -p
- Add the paths to all of your template files in your
tailwind.config.js
file./** @type {import('tailwindcss').Config} */ module.exports = { content: [ "./app/**/*.{js,ts,jsx,tsx}", "./pages/**/*.{js,ts,jsx,tsx}", "./components/**/*.{js,ts,jsx,tsx}", // Or if using `src` directory: "./src/**/*.{js,ts,jsx,tsx}", ], theme: { extend: {}, }, plugins: [], }
- Add the @tailwind directives for each Tailwind’s layers to your
globals.css
file.@tailwind base; @tailwind components; @tailwind utilities;
- Install Tailwind CSS
-
To automatically sort tailwind classes with prettier https://github.com/tailwindlabs/prettier-plugin-tailwindcss#installation
pnpm add -D prettier-plugin-tailwindcss
-
Create a
.prettierrc.json
file in your root directorytouch .prettierrc.json
-
Add the installed plugin to your .prettierrc.json config file
{ "trailingComma": "es5", "semi": true, "tabWidth": 2, "singleQuote": true, "jsxSingleQuote": true, "plugins": ["prettier-plugin-tailwindcss"] }
-
-
Save nivethan-me/2375bf451d4c30148916b59c7e0c51c0 to your computer and use it in GitHub Desktop.
Thanks! it helped a lot
Thanks!
thanks 🚀
Thanks
thanks
how to make eslint highlight an issue if there is no semicolon?
currently when semi: true
in my .prettierrc eslint does not show any issues if not semicolon
@Nivethan-Ar thanks
This is great thanks. I was looking for a solution like this
Thanks!
how to make eslint highlight an issue if there is no semicolon? currently when
semi: true
in my .prettierrc eslint does not show any issues if not semicolon@Nivethan-Ar thanks
Did you solve this problem?
Same issue for me.
Thanks
thanks!
I confess that it was difficult to come back here after you changed your nickname haha
I confess that it was difficult to come back here after you changed your nickname haha
Apologies for the confusion caused by my username change! consider starring the gist, then you can easily access it through your starred list for example - https://gist.github.com/kayotimoteo/starred
Thanks! 😍