Skip to content

Commit 1228143

Browse files
authored
fix: add precommit hooks (#11)
* fix: add precommit hooks Add precommit hooks with Husky and lint-staged We will run eslint and prettier for each files that is committed.
1 parent 0442d45 commit 1228143

File tree

6 files changed

+433
-25
lines changed

6 files changed

+433
-25
lines changed

.github/workflows/lint.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: lint
2+
3+
on: [push]
4+
5+
jobs:
6+
lint:
7+
runs-on: ubuntu-latest
8+
timeout-minutes: 15
9+
10+
steps:
11+
- uses: actions/checkout@v1
12+
- uses: docker://borales/yarn:latest
13+
with:
14+
args: 'install'
15+
- name: lint
16+
uses: docker://borales/yarn:latest
17+
with:
18+
args: 'lint'

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@ jobs:
1515
- name: test
1616
uses: docker://borales/yarn:latest
1717
with:
18-
cmd: 'test'
18+
args: 'test'

CHANGELOG.md

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@
2424

2525
# v0.1.3 (Tue Nov 26 2019)
2626

27-
#### 🐛 Bug Fix
27+
#### 🐛 Bug Fix
2828

29-
- fix: add __typename property [#6](https://github.com/ardeois/graphql-codegen-typescript-mock-data/pull/6) ([@ardeois](https://github.com/ardeois))
29+
- fix: add \_\_typename property [#6](https://github.com/ardeois/graphql-codegen-typescript-mock-data/pull/6) ([@ardeois](https://github.com/ardeois))
3030

3131
#### Authors: 1
3232

@@ -36,7 +36,7 @@
3636

3737
# v0.1.2 (Thu Nov 14 2019)
3838

39-
#### 🐛 Bug Fix
39+
#### 🐛 Bug Fix
4040

4141
- fix: handle input-object-type definitions [#5](https://github.com/ardeois/graphql-codegen-typescript-mock-data/pull/5) ([@YevheniiMelikov](https://github.com/YevheniiMelikov))
4242

@@ -48,7 +48,7 @@
4848

4949
# v0.1.1 (Tue Oct 29 2019)
5050

51-
#### 🐛 Bug Fix
51+
#### 🐛 Bug Fix
5252

5353
- fix: move graphql to peer dependencies [#4](https://github.com/ardeois/graphql-codegen-typescript-mock-data/pull/4) ([@ardeois](https://github.com/ardeois))
5454

@@ -60,7 +60,7 @@
6060

6161
# v0.1.0 (Tue Oct 29 2019)
6262

63-
#### 🚀 Enhancement
63+
#### 🚀 Enhancement
6464

6565
- build: first release [#3](https://github.com/ardeois/graphql-codegen-typescript-mock-data/pull/3) ([@ardeois](https://github.com/ardeois))
6666

@@ -72,32 +72,28 @@
7272

7373
# v0.0.5 (Tue Oct 29 2019)
7474

75-
76-
7775
---
7876

7977
# v0.0.4 (Tue Oct 29 2019)
8078

81-
82-
8379
---
8480

8581
# v0.0.3 (Tue Oct 29 2019)
8682

87-
#### 🐛 Bug Fix
83+
#### 🐛 Bug Fix
8884

8985
- chore: setup build with publishing scripts [#1](https://github.com/ardeois/graphql-codegen-typescript-mock-data/pull/1) ([email protected])
9086

91-
#### ⚠️ Pushed to master
87+
#### ⚠️ Pushed to master
9288

93-
- build: first release ([email protected])
94-
- chore: update circleci build ([email protected])
95-
- docs: update readme ([email protected])
96-
- fix: typo in mockk generator ([email protected])
97-
- fix: use casual instead of faker ([email protected])
98-
- feat: use spread operator instead of mock builder ([email protected])
89+
- build: first release ([email protected])
90+
- chore: update circleci build ([email protected])
91+
- docs: update readme ([email protected])
92+
- fix: typo in mockk generator ([email protected])
93+
- fix: use casual instead of faker ([email protected])
94+
- feat: use spread operator instead of mock builder ([email protected])
9995

10096
#### Authors: 2
10197

10298
- Corentin Ardeois ([email protected])
103-
- Corentin Ardeois ([email protected])
99+
- Corentin Ardeois ([email protected])

README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,3 +86,22 @@ const user = aUser({ login: 'johndoe' });
8686

8787
// will create a user object with `login` property overridden to `johndoe`
8888
```
89+
90+
### Contributing
91+
92+
Feel free to open issues and pull requests. We're always welcome support from the community.
93+
94+
To run this project locally:
95+
96+
- Use Node >= 10
97+
- Make sure that you have the latest Yarn version (https://yarnpkg.com/lang/en/docs/install/)
98+
- Clone this repo using `git clone`
99+
- Run `yarn`
100+
- Run `yarn build` to build the package
101+
- Run `yarn test` to make sure everything works
102+
103+
### License
104+
105+
[![GitHub license](https://img.shields.io/badge/license-MIT-lightgrey.svg?maxAge=2592000)](https://raw.githubusercontent.com/apollostack/apollo-ios/master/LICENSE)
106+
107+
MIT

package.json

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,9 @@
4545
"eslint-plugin-prettier": "^3.1.2",
4646
"graphql": "^14.0.0",
4747
"graphql-toolkit": "^0.7.5",
48+
"husky": "^4.2.3",
4849
"jest": "^25.2.7",
50+
"lint-staged": "^10.1.1",
4951
"prettier": "^2.0.2",
5052
"prettier-config-landr": "^0.0.7",
5153
"ts-jest": "^25.3.1",
@@ -56,13 +58,27 @@
5658
"build": "tsc -m esnext --outDir dist/esnext && tsc -m commonjs --outDir dist/commonjs",
5759
"test": "jest",
5860
"lint": "eslint 'src/**/*.{js,ts,tsx}' --quiet --fix && tsc --noEmit",
61+
"prettify": "prettier --config ./.prettierrc.js --write",
5962
"auto:version": "yarn version --`auto version` --message 'Bump version to: %s [skip ci]'",
6063
"auto:publish": "yarn publish && git push --follow-tags --set-upstream origin $CIRCLE_BRANCH",
6164
"release": "auto changelog && yarn auto:version && yarn auto:publish && auto release"
6265
},
66+
"lint-staged": {
67+
"*.{js,ts,tsx}": [
68+
"eslint --quiet --fix"
69+
],
70+
"*.{json,md,html}": [
71+
"prettier --write"
72+
]
73+
},
74+
"husky": {
75+
"hooks": {
76+
"pre-commit": "lint-staged"
77+
}
78+
},
6379
"files": [
6480
"dist/**/*",
65-
"LICENCE",
81+
"LICENSE",
6682
"README.md"
6783
]
6884
}

0 commit comments

Comments
 (0)