Git Commit Hooks, linting and formatting the code with Prettier before committing it to GitHub using Husky.

Let’s get started

  • .eslintrc.json
{
"extends": ["next", "next/core-web-vitals", "eslint:recommended", "prettier"],
"rules": {
"@next/next/no-img-element": "off"
}
}
  • .prettierrc.js
module.exports = {
trailingComma: "es5",
tabWidth: 2,
semi: true,
singleQuote: false,
arrowParens: "always",
useTabs: true,
bracketSpacing: true,
};
yarn add -D husky
"prepare":"husky install"
yarn prepare
yarn husky add .husky/pre-commit "echo Welcome to the Cutieverse!"
"scripts": {
"lint": "next lint",
"format": "prettier --ignore-unknown --write .",
"prepare": "husky install",
"precommit": "yarn lint && yarn format && git add -A ."
},

The problem

Conclusion

software engineer. web3 enthusiast

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Big (O) Notation! How to write a clean and high-quality code?

Blocks of Tetris code

Web Component: Why You Should Stick to React

Install npm and Node.js on macOS

Kampai Cocktails: A fun web app using APIs

Close up of a person typing on a laptop

Understand Indexes in MongoDB

What Programmers Should Write On Their Resume

Event Propagation & Event delegation

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Terchilă Marian

Terchilă Marian

software engineer. web3 enthusiast

More from Medium

Passing State through our App — Snippet

What Is A useState Hook?

Simple implementation of drag and drop between lists using React and Typescript without additional…

JBook, fixing iframe and better error handling