Git hooks to prevent bad commits.
Lint-staged can be found at https://github.com/okonet/lint-staged
Lint-staged is a tool that prevents bad code from leaving a developer's computer. It allows us to run commands on staged files when a developer runs
git commit. If any of the commands fail then the commit also fails—preventing bad commits from being pushed to GitHub. Lint-staged is a great way of ensuring linting, testing, and other operations are performed before contributions get pushed to GitHub.
Lint-staged uses Husky and Git hooks behind the scenes.
npx [email protected] lint-staged at the root of Scroller. Since we need to use the
[email protected] script, which is a remote script, we need
y to proceed if the following is prompted:
husky as a devDependency, and a
.husky/ directory which can be ignored. Lint-staged also adds a
"lint-staged" property into our
package.json where we'll define what scripts we want to run before commits. Lint-staged defaults with