Skip to content

Commit c3e4bfb

Browse files
committed
feat: migrate to lefthook instead of husky
1 parent 06fb615 commit c3e4bfb

File tree

9 files changed

+40
-23
lines changed

9 files changed

+40
-23
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ If you want to create your own React Native module, scaffolding the project can
1616
- C++ support for native modules on Android and iOS
1717
- [Expo](https://expo.io/) support for libraries without native code and web support
1818
- Example React Native app to manually test your modules
19-
- [ESLint](https://eslint.org/), [Prettier](https://prettier.io/), [TypeScript](https://www.typescriptlang.org/), [Husky](https://github.com/typicode/husky) and [Release It](https://github.com/release-it/release-it) pre-configured
19+
- [ESLint](https://eslint.org/), [Prettier](https://prettier.io/), [TypeScript](https://www.typescriptlang.org/), [Lefthook](https://github.com/evilmartians/lefthook) and [Release It](https://github.com/release-it/release-it) pre-configured
2020
- `react-native-builder-bob` pre-configured to compile your files
2121
- [CircleCI](https://circleci.com/) pre-configured to run tests on the CI
2222

lefthook.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
pre-commit:
2+
parallel: true
3+
commands:
4+
lint:
5+
files: git diff --name-only @{push}
6+
glob: "*.{js,ts,jsx,tsx}"
7+
run: npx eslint {files}
8+
types:
9+
files: git diff --name-only @{push}
10+
glob: "*.{js,ts, jsx, tsx}"
11+
run: npx tsc --noEmit
12+
commit-msg:
13+
parallel: true
14+
commands:
15+
commitlint:
16+
run: npx commitlint --edit

package.json

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,22 +18,16 @@
1818
"watch": "concurrently 'yarn typescript --watch' 'lerna run --parallel prepare -- --watch'"
1919
},
2020
"devDependencies": {
21+
"@arkweid/lefthook": "^0.7.7",
2122
"@commitlint/config-conventional": "^17.0.2",
2223
"commitlint": "^17.0.2",
2324
"concurrently": "^7.2.2",
2425
"eslint": "^8.18.0",
2526
"eslint-config-satya164": "^3.1.11",
26-
"husky": "^8.0.1",
2727
"lerna": "^5.1.4",
2828
"prettier": "^2.7.1",
2929
"typescript": "^4.7.4"
3030
},
31-
"husky": {
32-
"hooks": {
33-
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS",
34-
"pre-commit": "yarn lint && yarn typescript"
35-
}
36-
},
3731
"commitlint": {
3832
"extends": [
3933
"@commitlint/config-conventional"

packages/create-react-native-library/templates/common/$.husky/.gitignore

Lines changed: 0 additions & 1 deletion
This file was deleted.

packages/create-react-native-library/templates/common/$.husky/commit-msg

Lines changed: 0 additions & 4 deletions
This file was deleted.

packages/create-react-native-library/templates/common/$.husky/pre-commit

Lines changed: 0 additions & 4 deletions
This file was deleted.

packages/create-react-native-library/templates/common/$package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
"registry": "https://registry.npmjs.org/"
4848
},
4949
"devDependencies": {
50+
"@arkweid/lefthook": "^0.7.7",
5051
"@babel/eslint-parser": "^7.18.2",
5152
"@commitlint/config-conventional": "^17.0.2",
5253
"@react-native-community/eslint-config": "^3.0.2",
@@ -58,7 +59,6 @@
5859
"eslint": "^8.4.1",
5960
"eslint-config-prettier": "^8.5.0",
6061
"eslint-plugin-prettier": "^4.0.0",
61-
"husky": "^6.0.0",
6262
"jest": "^28.1.1",
6363
"pod-install": "^0.1.0",
6464
"prettier": "^2.0.5",
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
pre-commit:
2+
parallel: true
3+
commands:
4+
lint:
5+
files: git diff --name-only @{push}
6+
glob: "*.{js,ts,jsx,tsx}"
7+
run: npx eslint {files}
8+
types:
9+
files: git diff --name-only @{push}
10+
glob: "*.{js,ts, jsx, tsx}"
11+
run: npx tsc --noEmit
12+
commit-msg:
13+
parallel: true
14+
commands:
15+
commitlint:
16+
run: npx commitlint --edit

yarn.lock

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@
1010
"@jridgewell/gen-mapping" "^0.1.0"
1111
"@jridgewell/trace-mapping" "^0.3.9"
1212

13+
"@arkweid/lefthook@^0.7.7":
14+
version "0.7.7"
15+
resolved "https://registry.yarnpkg.com/@arkweid/lefthook/-/lefthook-0.7.7.tgz#12951b09b955d8054885ffe929aa07a49f39027c"
16+
integrity sha512-Eq30OXKmjxIAIsTtbX2fcF3SNZIXS8yry1u8yty7PQFYRctx04rVlhOJCEB2UmfTh8T2vrOMC9IHHUvvo5zbaQ==
17+
1318
"@babel/cli@^7.17.10":
1419
version "7.17.10"
1520
resolved "https://registry.yarnpkg.com/@babel/cli/-/cli-7.17.10.tgz#5ea0bf6298bb78f3b59c7c06954f9bd1c79d5943"
@@ -4828,11 +4833,6 @@ humanize-ms@^1.2.1:
48284833
dependencies:
48294834
ms "^2.0.0"
48304835

4831-
husky@^8.0.1:
4832-
version "8.0.1"
4833-
resolved "https://registry.yarnpkg.com/husky/-/husky-8.0.1.tgz#511cb3e57de3e3190514ae49ed50f6bc3f50b3e9"
4834-
integrity sha512-xs7/chUH/CKdOCs7Zy0Aev9e/dKOMZf3K1Az1nar3tzlv0jfqnYtu235bstsWTmXOR0EfINrPa97yy4Lz6RiKw==
4835-
48364836
iconv-lite@^0.4.24:
48374837
version "0.4.24"
48384838
resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b"

0 commit comments

Comments
 (0)