observing/pre-commit

What will be the pre-commit equivalent of this husky config?

Opened this issue · 2 comments

I'm currently using husky but want to switch to pre-commit

"scripts": {
    "precommit": "lint-staged"}

  "lint-staged": {
    "*.scss": [
      "stylelint --syntax=scss",
      "prettier --parser postcss --use-tabs --write",
      "git add"
    ],
    "*.js": [
      "prettier --use-tabs --single-quote --write",
      "git add"
    ]
  },

That should just work.

This will work with pre-commit

{
  // ...
  "scripts": {
    "lint-staged": "lint-staged"
  },
  "pre-commit": "lint-staged"
  "lint-staged": {
    "*.scss": [
      "stylelint --syntax=scss",
      "prettier --parser postcss --use-tabs --write",
      "git add"
    ],
    "*.js": [
      "prettier --use-tabs --single-quote --write",
      "git add"
    ]
  }
}