DEV Community

Discussion on: If you like it, you should have put some lint on it...

Collapse
 
pertrai1 profile image
Rob Simpson

Hey, with that special config file, how would it be used with the pre-commit hook? Looks exactly like what I need. Just need to know how to implement. Thank you

Collapse
 
tapaibalazs profile image
Tápai Balázs

Hi!

The lint-staged package allows configuration using different file types in the root folder, see: github.com/okonet/lint-staged#conf...

To set it up in your workspace, do the following:

  1. run npm install husky lint-staged --save-dev (this will install husky and lint-staged as dev dependencies)

  2. put the lint-staged.config.js file into the root folder, near your package.json file

  3. In your package.json add the following:
    "husky": { "hooks": { "pre-commit": "lint-staged" } }

I hope it helps! :)