Skip to content

Commit e4d602a

Browse files
feat: change lefthook
1 parent f133e99 commit e4d602a

File tree

6 files changed

+54
-5
lines changed

6 files changed

+54
-5
lines changed

.github/workflows/ci.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,18 @@ jobs:
2020
- name: Lint files
2121
run: yarn lint
2222

23+
test:
24+
runs-on: ubuntu-latest
25+
steps:
26+
- name: Checkout
27+
uses: actions/checkout@v3
28+
29+
- name: Setup
30+
uses: ./.github/actions/setup
31+
32+
- name: Test files
33+
run: yarn test
34+
2335
build-library:
2436
runs-on: ubuntu-latest
2537
steps:

commitlint.config.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
const Configuration = {
1+
import { UserConfig } from '@commitlint/types';
2+
3+
const Configuration: UserConfig = {
24
extends: ['@commitlint/config-conventional'],
35
rules: {
46
'body-case': [2, 'always', ['lower-case']],

jest.config.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
module.exports = {
22
preset: 'react-native',
3-
modulePathIgnorePatterns: ['<rootDir>/example/node_modules'],
3+
modulePathIgnorePatterns: ['<rootDir>/example/node_modules', '/node_modules', '/lib'],
44
setupFiles: ['<rootDir>/jest.setup.js'],
55
testRegex: '(/__tests__/.*|(\\.|/)(test))\\.[jt]sx?$',
6+
transformIgnorePatterns: [
7+
'node_modules/(?!(react-native|@react-native|@react-native-masked-view|react-native-linear-gradient)/)',
8+
],
9+
transform: {
10+
'^.+\\.(js|jsx|ts|tsx)$': 'babel-jest',
11+
},
612
};

lefthook.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@ pre-commit:
22
parallel: true
33
commands:
44
lint:
5-
files: git diff --name-only @{push}
65
glob: "*.{js,ts,jsx,tsx}"
7-
run: npx eslint {files}
6+
run: yarn lint
7+
tests:
8+
glob: "*.{test,spec}.{js,ts,jsx,tsx}"
9+
run: yarn test
810
types:
9-
files: git diff --name-only @{push}
1011
glob: "*.{js,ts, jsx, tsx}"
1112
run: npx tsc --noEmit
1213
commit-msg:

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
},
6060
"devDependencies": {
6161
"@commitlint/config-conventional": "^17.0.2",
62+
"@commitlint/types": "^19.5.0",
6263
"@evilmartians/lefthook": "^1.5.0",
6364
"@react-native-masked-view/masked-view": "^0.3.0",
6465
"@react-native/eslint-config": "^0.72.2",

yarn.lock

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1877,6 +1877,16 @@ __metadata:
18771877
languageName: node
18781878
linkType: hard
18791879

1880+
"@commitlint/types@npm:^19.5.0":
1881+
version: 19.5.0
1882+
resolution: "@commitlint/types@npm:19.5.0"
1883+
dependencies:
1884+
"@types/conventional-commits-parser": ^5.0.0
1885+
chalk: ^5.3.0
1886+
checksum: a26f33ec6987d7d93bdbd7e1b177cfac30ca056ea383faf343c6a09c0441aa057a24be1459c3d4e7e91edd2ecf8d6c4dd670948c9d22646d64767137c6db098a
1887+
languageName: node
1888+
linkType: hard
1889+
18801890
"@cspotcode/source-map-support@npm:^0.8.0":
18811891
version: 0.8.1
18821892
resolution: "@cspotcode/source-map-support@npm:0.8.1"
@@ -3160,6 +3170,15 @@ __metadata:
31603170
languageName: node
31613171
linkType: hard
31623172

3173+
"@types/conventional-commits-parser@npm:^5.0.0":
3174+
version: 5.0.1
3175+
resolution: "@types/conventional-commits-parser@npm:5.0.1"
3176+
dependencies:
3177+
"@types/node": "*"
3178+
checksum: b4eb4f22051d42e7ed9fd3bffe6ea0cf62ae493a3c6c775a16babbad977c934f4c09ec3fa93020894de2073d63cfcd3a27dd5f00984966161da6797dd88a0f0d
3179+
languageName: node
3180+
linkType: hard
3181+
31633182
"@types/graceful-fs@npm:^4.1.3":
31643183
version: 4.1.7
31653184
resolution: "@types/graceful-fs@npm:4.1.7"
@@ -4482,6 +4501,13 @@ __metadata:
44824501
languageName: node
44834502
linkType: hard
44844503

4504+
"chalk@npm:^5.3.0":
4505+
version: 5.4.1
4506+
resolution: "chalk@npm:5.4.1"
4507+
checksum: 0c656f30b782fed4d99198825c0860158901f449a6b12b818b0aabad27ec970389e7e8767d0e00762175b23620c812e70c4fd92c0210e55fc2d993638b74e86e
4508+
languageName: node
4509+
linkType: hard
4510+
44854511
"char-regex@npm:^1.0.2":
44864512
version: 1.0.2
44874513
resolution: "char-regex@npm:1.0.2"
@@ -11069,6 +11095,7 @@ __metadata:
1106911095
resolution: "react-native-linear-gradient-text@workspace:."
1107011096
dependencies:
1107111097
"@commitlint/config-conventional": ^17.0.2
11098+
"@commitlint/types": ^19.5.0
1107211099
"@evilmartians/lefthook": ^1.5.0
1107311100
"@react-native-masked-view/masked-view": ^0.3.0
1107411101
"@react-native/eslint-config": ^0.72.2

0 commit comments

Comments
 (0)