A complete step-by-step guide to integrating ESLint, Prettier, and Husky in a project using TypeScript and Next.js.
-
Remove all eslint & prettier connected packages you already have installed (eslint-plugin-, eslint-config-, eslint-parser*, and eslint & prettier themselves) due to possible installation conflicts with
eslint-config-jejolarepackage. -
Install all required packages:
npm i -D eslint-config-jejolare husky lint-stagedmodule.exports = {
// Or 'jejolare/backend' for Node.js app
extends: ['jejolare/frontend'],
// This is needed only if you use TypeScript
settings: {
'import/resolver': {
typescript: {
project: './tsconfig.json',
},
},
},
};submodules/
node_modules/
dist/
build/
.next/
*.log
*.tmp
.temp/
migrations/
public/
static/
.vscode/
.idea/
.env*
/** @type {import("prettier").Config} */
import prettierConfig from 'eslint-config-jejolare/prettier';
export default prettierConfig;node_modules
build
dist
coverage
.next
.env
*.lock
submodules/
migrations/
npx husky"scripts": {
"prepare": "husky"
}#!/bin/sh
npx lint-staged"lint-staged": {
"*.{ts,tsx,js,jsx}": [
"eslint --fix",
"prettier --write"
]
}"scripts": {
"format": "prettier --write .",
"format:check": "prettier --check .",
"eslint": "eslint . --ext .js,.ts,.tsx,.jsx,.cjs,.mjs --fix"
}Now, every commit will automatically run ESLint and Prettier. Your code will be linted and formatted before entering the repository.