pnpm create vite my-react-app --template react-ts
pnpm add -D @types/node (path modules node)
pnpm add framer-motion react-anchor-link-smooth-scroll @heroicons/react
pnpm add -D @type/react-anchor-link-smooth-scroll
pnpm add -D tailwindcss postcss autoprefixer
pnpm tailwindcss init -p
TailwindCSS Init
walkthrough.pnpm add -D eslint @typescript-eslint/eslint-plugin @typescript-eslint/parser eslint-config-airbnb-typescript eslint-plugin-react eslint-plugin-jest eslint-plugin-react-hooks eslint-plugin-import
pnpm add -D prettier prettier-plugin-tailwindcss eslint-config-prettier eslint-plugin-prettier
.eslintrc.cjs
and include the following:module.exports = {
env: {
node: true,
browser: true,
es2021: true,
},
settings: {
react: {
version: "detect",
},
},
parser: "@typescript-eslint/parser",
parserOptions: {
ecmaFeatures: {
jsx: true,
},
},
plugins: ["react", "react-hooks", "prettier", "@typescript-eslint"],
extends: [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:prettier/recommended",
"plugin:react/recommended",
"plugin:react/jsx-runtime",
"plugin:react-hooks/recommended",
],
rules: {},
globals: {
Edit: "writable",
console: "writable",
_: "writable",
$: "writable",
},
};
prettier.config.cjs
with the following:module.exports = {
tabWidth: 2,
semi: true,
singleQuote: false,
trailingComma: "all",
printWidth: 80,
useTabs: false,
endOfLine: "auto",
plugins: [require("prettier-plugin-tailwindcss")],
};
package.json
: "scripts": {
...,
"lint:dry": "eslint ./src --ext .jsx,.js,.ts,.tsx --ignore-path ./.gitignore",
"lint:fix": "eslint ./src --ext .jsx,.js,.ts,.tsx --quiet --fix --ignore-path ./.gitignore",
"lint:format": "prettier --loglevel warn --write \"./**/*.{js,jsx,ts,tsx,css,md,json}\" ",
"lint": "yarn lint:format && yarn lint:fix ",
"type-check": "tsc"
}
.eslintignore
and a .prettierignore
with the following:node_modules
.DS_Store
dist
dist-ssr
*.local
node_modules/*
.vscode
directory with a file named `settings.json, include the following:{
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true,
"editor.formatOnPaste": false,
// Runs Prettier, then ESLint
"editor.codeActionsOnSave": ["source.formatDocument", "source.fixAll.eslint"]
}
.gitignore
to add node_modules
vite.config.ts
to allow absolute pathing from 'src'import path from "path";
export default defineConfig({
plugins: [react()],
resolve: {
alias: [
{
find: "src",
replacement: path.resolve(__dirname, "src"),
},
],
},
});
tsconfig.json
to as well:{
"compilerOptions": {
"paths": {
"src/*": ["./src/*"]
},
...
}
tailwind.config.cjs
and add the following:/** @type {import('tailwindcss').Config} */
module.exports = {
content: ["./index.html", "./src/**/*.{js,ts,jsx,tsx}"],
theme: {
extend: {}, // Go to Tailwind on creating/extending custom tailwind classes
},
plugins: [],
};
index.css
@tailwind base;
@tailwind components;
@tailwind utilities;
Create prettier.config.cjs
and include below:
module.exports = {
plugins: [require("prettier-plugin-tailwindcss")],
};
package.json
): Forked Project