Skip to content

Commit

Permalink
Replace pre-commit with husky (#38350)
Browse files Browse the repository at this point in the history
* Replace pre-commit with husky

* update lock

* actually update lock
  • Loading branch information
ijjk authored Jul 6, 2022
1 parent 6b4b037 commit 9573174
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 43 deletions.
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

pnpm lint-staged
2 changes: 2 additions & 0 deletions lint-staged.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ module.exports = {
.filter((file) => !eslint.isPathIgnored(file))
.map((f) => `"${f}"`)
.join(' ')}`,
`git add ${escapedFileNames}`,
]
},
'**/*.{json,md,mdx,css,html,yml,yaml,scss}': (filenames) => {
Expand All @@ -23,6 +24,7 @@ module.exports = {
.join(' ')
return [
`prettier --with-node-modules --ignore-path .prettierignore_staged --write ${escapedFileNames}`,
`git add ${escapedFileNames}`,
]
},
}
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@
"clean-trace-jaeger": "rm -rf test/integration/basic/.next && TRACE_TARGET=JAEGER node --trace-deprecation --enable-source-maps packages/next/dist/bin/next build test/integration/basic",
"debug": "node --inspect packages/next/dist/bin/next",
"postinstall": "git config feature.manyFiles true && node scripts/install-native.mjs",
"version": "pnpm install && git add pnpm-lock.yaml"
"version": "pnpm install && git add pnpm-lock.yaml",
"prepare": "husky install"
},
"pre-commit": "lint-staged",
"devDependencies": {
"@babel/core": "7.18.0",
"@babel/eslint-parser": "7.18.2",
Expand Down Expand Up @@ -141,6 +141,7 @@
"glob": "7.1.6",
"gzip-size": "5.1.1",
"html-validator": "5.1.18",
"husky": "8.0.0",
"image-size": "0.9.3",
"is-animated": "2.0.2",
"isomorphic-unfetch": "3.0.0",
Expand All @@ -167,7 +168,6 @@
"postcss-pseudoelements": "5.0.0",
"postcss-short-size": "4.0.0",
"postcss-trolling": "0.1.7",
"pre-commit": "1.2.2",
"prettier": "2.5.1",
"pretty-bytes": "5.3.0",
"pretty-ms": "7.0.0",
Expand Down
49 changes: 9 additions & 40 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 9573174

Please sign in to comment.