Skip to content

Commit 45a1e5c

Browse files
committed
chore: use commitlint for validating commit message
1 parent 3983edd commit 45a1e5c

File tree

5 files changed

+365
-119
lines changed

5 files changed

+365
-119
lines changed

Diff for: CONTRIBUTING.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,20 @@ The core team works directly on GitHub and all work is public.
1313
> **Working on your first pull request?** You can learn how from this *free* series: [How to Contribute to an Open Source Project on GitHub](https://egghead.io/series/how-to-contribute-to-an-open-source-project-on-github).
1414
1515
1. Fork the repo and create your branch from `master` (a guide on [how to fork a repository](https://help.github.com/articles/fork-a-repo/)).
16-
2. Run `yarn bootstrap` to setup the developement environment.
16+
2. Run `yarn bootstrap` to setup the development environment.
1717
3. Do the changes you want and test them out in the example app before sending a pull request.
1818

1919
### Commit message convention
2020

21-
We prefix our commit messages with one of the following to signify the kind of change:
21+
We follow the [conventional commits specification](https://www.conventionalcommits.org/en) for our commit messages:
2222

2323
* `fix`: bug fixes, e.g. fix Button color on DarkTheme.
2424
* `feat`: new features, e.g. add Snackbar component.
25-
* `refactor`: code/structure refactor, e.g. new structure folder for components.
25+
* `refactor`: code refactor, e.g. new folder structure for components.
2626
* `docs`: changes into documentation, e.g. add usage example for Button.
2727
* `test`: adding or updating tests, eg unit, snapshot testing.
2828
* `chore`: tooling changes, e.g. change circleci config.
29-
* `BREAKING`: for changes that break existing usage, e.g. change API of a component.
29+
* `BREAKING CHANGE`: for changes that break existing usage, e.g. change API of a component.
3030

3131
Our pre-commit hooks verify that your commit message matches this format when committing.
3232

@@ -35,9 +35,9 @@ Our pre-commit hooks verify that your commit message matches this format when co
3535
We use `flow` for type checking, `eslint` with `prettier` for linting and formatting the code, and `jest` for testing. Our pre-commit hooks verify that the linter and tests pass when commiting. You can also run the following commands manually:
3636

3737
* `yarn flow`: run flow on all files.
38-
* `yarn typescript`: run tests for typescript.
39-
* `yarn lint`: run eslint and prettier.
40-
* `yarn test`: run unit tests.
38+
* `yarn typescript`: run tests for typescript definitions.
39+
* `yarn lint`: lint files with eslint and prettier.
40+
* `yarn test`: run unit tests with jest.
4141

4242
### Sending a pull request
4343

Diff for: commitlint.config.js

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports = {
2+
extends: ['@commitlint/config-conventional'],
3+
};

Diff for: package.json

+14-12
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
"types.js",
1212
"babel.js"
1313
],
14+
"sideEffects": false,
1415
"repository": {
1516
"type": "git",
1617
"url": "https://github.com/callstack/react-native-paper.git"
@@ -41,12 +42,6 @@
4142
"docs": "yarn --cwd docs",
4243
"example": "yarn --cwd example"
4344
},
44-
"husky": {
45-
"hooks": {
46-
"commit-msg": "node ./scripts/validate-commit-message.js $HUSKY_GIT_PARAMS",
47-
"pre-commit": "yarn lint && yarn flow && yarn typescript && yarn test"
48-
}
49-
},
5045
"publishConfig": {
5146
"registry": "https://registry.npmjs.org/"
5247
},
@@ -61,6 +56,7 @@
6156
"devDependencies": {
6257
"@babel/core": "^7.1.2",
6358
"@babel/runtime": "^7.1.2",
59+
"@commitlint/config-conventional": "^7.5.0",
6460
"@types/react": "^16.4.18",
6561
"@types/react-native": "^0.57.7",
6662
"all-contributors-cli": "^6.1.1",
@@ -69,6 +65,7 @@
6965
"babel-jest": "^23.6.0",
7066
"babel-test": "^0.1.1",
7167
"chalk": "^2.4.1",
68+
"commitlint": "^7.5.2",
7269
"conventional-changelog-cli": "^2.0.11",
7370
"dedent": "^0.7.0",
7471
"eslint": "^4.19.1",
@@ -77,7 +74,7 @@
7774
"eslint-plugin-react-native": "^3.5.0",
7875
"flow-bin": "~0.78.0",
7976
"glob": "^7.1.3",
80-
"husky": "^1.1.3",
77+
"husky": "^1.3.1",
8178
"jest": "^23.6.0",
8279
"jest-file-snapshot": "^0.3.2",
8380
"metro-react-native-babel-preset": "^0.49.0",
@@ -97,6 +94,15 @@
9794
"react-native": "*",
9895
"react-native-vector-icons": "*"
9996
},
97+
"resolutions": {
98+
"**/babel-core": "7.0.0-bridge.0"
99+
},
100+
"husky": {
101+
"hooks": {
102+
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS",
103+
"pre-commit": "yarn lint && yarn flow && yarn typescript && yarn test"
104+
}
105+
},
100106
"jest": {
101107
"preset": "react-native",
102108
"modulePathIgnorePatterns": [
@@ -105,9 +111,5 @@
105111
"watchPathIgnorePatterns": [
106112
"__fixtures__\\/[^/]+\\/(output|error)\\.js"
107113
]
108-
},
109-
"resolutions": {
110-
"**/babel-core": "7.0.0-bridge.0"
111-
},
112-
"sideEffects": false
114+
}
113115
}

Diff for: scripts/validate-commit-message.js

-60
This file was deleted.

0 commit comments

Comments
 (0)