Skip to content

Commit

Permalink
Setup prettier as a GIt pre-commit hook
Browse files Browse the repository at this point in the history
  • Loading branch information
evanderkoogh committed Oct 25, 2023
1 parent 3c3e28a commit c881335
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 9 deletions.
1 change: 1 addition & 0 deletions .husky/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
_
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx lint-staged
5 changes: 5 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
dist
node_modules
.changeset
package-lock.json
pnpm-lock.yaml
6 changes: 6 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"singleQuote": true,
"printWidth": 120,
"useTabs": true,
"semi": false
}
16 changes: 7 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,15 @@
},
"scripts": {
"clean": "rimraf ./dist",
"format": "prettier -w src",
"format": "prettier --ignore-unknown --write .",
"build-esm": "tsc",
"build-cjs": "tsc -p tsconfig-cjs.json",
"fix-dist": "echo '{\"type\": \"module\"}' > dist/esm/package.json && echo '{\"type\": \"commonjs\"}' > dist/cjs/package.json",
"build": "pnpm clean && pnpm format && pnpm build-esm && pnpm build-cjs && pnpm fix-dist",
"preversion": "pnpm build",
"prepublishOnly": "pnpm build",
"watch": "tsc --watch"
"watch": "tsc --watch",
"prepare": "husky install"
},
"homepage": "https://github.com/evanderkoogh/otel-cf-workers#readme",
"dependencies": {
Expand All @@ -50,11 +51,8 @@
"publishConfig": {
"access": "public"
},
"prettier": {
"singleQuote": true,
"printWidth": 120,
"useTabs": true,
"semi": false
},
"license": "BSD-3-Clause"
"license": "BSD-3-Clause",
"lint-staged": {
"*": "prettier --ignore-unknown --write"
}
}

0 comments on commit c881335

Please sign in to comment.