Skip to content

Commit d02544f

Browse files
committed
πŸ§‘β€πŸ’» Add pre-commit hook that lints/formats
1 parent 5fb7c23 commit d02544f

3 files changed

Lines changed: 274 additions & 2 deletions

File tree

β€Ž.prettierignoreβ€Ž

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ node_modules
44
.yarn
55
examples/example-bare/android
66
examples/example-bare/ios
7+
*.md

β€Žpackage.jsonβ€Ž

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
"lint:fix": "eslint src/ examples/ --fix",
3131
"format": "prettier --check ./src ./examples",
3232
"format:fix": "prettier --write ./src ./examples",
33-
"prepare": "yarn build"
33+
"prepare": "simple-git-hooks"
3434
},
3535
"homepage": "https://github.com/troberts-28/react-native-timer-picker",
3636
"bugs": {
@@ -108,12 +108,14 @@
108108
"eslint-plugin-react": "^7.37.5",
109109
"eslint-plugin-react-hooks": "^5.2.0",
110110
"jest": "^29.0.0",
111+
"lint-staged": "^16.2.7",
111112
"metro-react-native-babel-preset": "^0.71.1",
112113
"prettier": "2.8.8",
113114
"react": "18.2.0",
114115
"react-native": "0.72.0",
115116
"react-native-builder-bob": "^0.18.3",
116117
"react-test-renderer": "18.2.0",
118+
"simple-git-hooks": "^2.13.1",
117119
"typescript": "~5.8.0",
118120
"typescript-eslint": "^8.33.0"
119121
},
@@ -126,6 +128,18 @@
126128
"typescript"
127129
]
128130
},
131+
"simple-git-hooks": {
132+
"pre-commit": "npx lint-staged"
133+
},
134+
"lint-staged": {
135+
"*.{ts,tsx,js,jsx}": [
136+
"eslint --fix",
137+
"prettier --write"
138+
],
139+
"*.{json}": [
140+
"prettier --write"
141+
]
142+
},
129143
"eslintIgnore": [
130144
"node_modules/",
131145
"dist/"

0 commit comments

Comments
Β (0)