Skip to content

Commit

Permalink
feat: add prettier
Browse files Browse the repository at this point in the history
create rules for prettier according to the files in codebase
add husky pre commit hook
signed-off-by: pavan joshi <[email protected]>
  • Loading branch information
pavanjoshi914 committed Aug 10, 2023
1 parent ae48cbd commit 8ad9df8
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 1 deletion.
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"

yarn lint-staged
3 changes: 3 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Ignore artifacts:
dist
node_modules
11 changes: 11 additions & 0 deletions lint-staged.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
export default {
"src/**/*.{js,ts,jsx}": [
"prettier --write",
],
"examples/**/*.{js,mjs}": [
"prettier --write",
],

"package.json": ["prettier --write"],
};

7 changes: 6 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,14 @@
},
"scripts": {
"prebuild": "yarn run clean",
"format": "prettier --check '**/*.(md|json)' 'src/**/*.(js|ts|jsx|tsx)'",
"prepack": "yarn run build",
"test": "jest",
"clean": "rm -rf dist",
"build:browser": "cp src/window.js dist && browserify dist/window.js > dist/index.browser.js",
"build": "microbundle && yarn build:browser",
"dev": "microbundle watch"
"dev": "microbundle watch",
"prepare": "husky install"
},
"dependencies": {
"crypto-js": "^4.1.1",
Expand All @@ -42,8 +44,11 @@
"@webbtc/webln-types": "^1.0.11",
"browserify": "^17.0.0",
"express": "^4.18.2",
"husky": "^8.0.3",
"jest": "^29.5.0",
"lint-staged": "^13.2.3",
"microbundle": "^0.15.1",
"prettier": "^3.0.1",
"ts-jest": "^29.0.5",
"ts-node": "^10.9.1",
"typescript": "^5.1.6",
Expand Down
3 changes: 3 additions & 0 deletions prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"trailingComma": "es5"
}

0 comments on commit 8ad9df8

Please sign in to comment.