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

A way to fire off custom scripts when certain important actions occur. There are two groups of these hooks: client-side and server-side. Client-side hooks are triggered by operations such as committing and merging, while server-side hooks run on network operations such as receiving pushed commits. You can use these hooks for all sorts of reasons.

Let’s get started

{
"extends": ["next", "next/core-web-vitals", "eslint:recommended", "prettier"],
"rules": {
"@next/next/no-img-element": "off"
}
}
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

--

--

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