DEV Community

Discussion on: Configuring Prettier and TypeScript Compiler as a Pre-commit Hook

Collapse
 
boasbabs profile image
Adeyemi Simeon

Hi Julian, thanks for the guide. I want to ask how to use Airbnb style guide with lint-staged. Do you have any resources you can point me to?

Collapse
 
juliang profile image
Julian Garamendy

Hi Adeyemi, I'm afraid I haven't tried this with Airbnb style guide, but if you have it configured as a linter, you can probably change the .lintstagedrc file to specify different linters to different file types.

You could try something like this:

.lintstagedrc

{
  "linters": {
    "*.js": [
      "eslint"
    ],
    "**/*.+(js|jsx|css|less|scss|ts|tsx|md)": [
      "prettier --write",
      "git add"
    ]
  }
}
Collapse
 
boasbabs profile image
Adeyemi Simeon

Thanks a lot for the tip. I will try it out