@helderberto/lefthook-config 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +39 -2
- package/package.json +1 -1
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -1,5 +1,42 @@
|
|
|
1
1
|
# @helderberto/lefthook-config
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://www.npmjs.com/package/@helderberto/lefthook-config)
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Pre-commit hooks for npm and pnpm projects: Prettier formats staged files, and ESLint lints staged TypeScript. Nothing checks commit messages.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
npm install -D @helderberto/lefthook-config lefthook
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Use
|
|
14
|
+
|
|
15
|
+
```yaml
|
|
16
|
+
# lefthook.yml
|
|
17
|
+
extends:
|
|
18
|
+
- node_modules/@helderberto/lefthook-config/lefthook.yml
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
The hooks call these scripts through `npm run`, which works whichever package manager installed them:
|
|
22
|
+
|
|
23
|
+
```json
|
|
24
|
+
// package.json
|
|
25
|
+
{
|
|
26
|
+
"scripts": {
|
|
27
|
+
"prepare": "lefthook install",
|
|
28
|
+
"format:staged": "prettier --write --ignore-unknown",
|
|
29
|
+
"lint:staged": "eslint --no-warn-ignored"
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Moving from husky
|
|
35
|
+
|
|
36
|
+
Husky sets `core.hooksPath` in each clone's git config, and `lefthook install` refuses to run while it's set, so `npm install` fails at `prepare`. Run this once in every existing clone:
|
|
37
|
+
|
|
38
|
+
```sh
|
|
39
|
+
git config --unset core.hooksPath
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Fresh clones and CI aren't affected.
|