Run precommit hook automatically

Help to ensure that code is formatted and linted before commits and PRs.

Fix #755
Close #756
Close #754
This commit is contained in:
Maxime Thirouin
2018-01-08 16:48:24 +01:00
committed by Nicolas Gallagher
parent b78206d2f4
commit c26ef0eb3b
3 changed files with 15 additions and 17 deletions

View File

@@ -91,20 +91,6 @@ To run the performance benchmarks in a browser (opening `./packages/benchmarks/i
yarn benchmark
```
### Pre-commit
To format and lint code before commit:
```
yarn precommit
```
To format and lint the entire project:
```
yarn fmt
```
### New Features
Please open an issue with a proposal for a new feature or refactoring before
@@ -118,8 +104,7 @@ that we won't want to accept.
1. Fork the repository and create your branch from `master`.
2. If you've added code that should be tested, add tests!
3. If you've changed APIs, update the documentation.
4. Lint and format your code (`yarn precommit`).
5. Ensure the tests pass (`yarn test`).
4. Ensure the tests pass (`yarn test`).
You can now submit a pull request, referencing any issues it addresses.

View File

@@ -41,6 +41,7 @@
"eslint-plugin-promise": "^3.6.0",
"eslint-plugin-react": "^7.5.1",
"flow-bin": "^0.61.0",
"husky": "^0.14.3",
"jest": "^21.2.1",
"lerna": "^2.5.1",
"lint-staged": "^4.1.3",
@@ -58,7 +59,7 @@
"**/*.js": [
"fmt:cmd",
"git update-index --again",
"lint:cmd"
"eslint"
]
},
"author": "Nicolas Gallagher",

View File

@@ -4100,6 +4100,14 @@ https-browserify@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/https-browserify/-/https-browserify-1.0.0.tgz#ec06c10e0a34c0f2faf199f7fd7fc78fffd03c73"
husky@^0.14.3:
version "0.14.3"
resolved "https://registry.yarnpkg.com/husky/-/husky-0.14.3.tgz#c69ed74e2d2779769a17ba8399b54ce0b63c12c3"
dependencies:
is-ci "^1.0.10"
normalize-path "^1.0.0"
strip-indent "^2.0.0"
hyphenate-style-name@^1.0.1, hyphenate-style-name@^1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/hyphenate-style-name/-/hyphenate-style-name-1.0.2.tgz#31160a36930adaf1fc04c6074f7eb41465d4ec4b"
@@ -5609,6 +5617,10 @@ normalize-package-data@^2.3.0, normalize-package-data@^2.3.2, normalize-package-
semver "2 || 3 || 4 || 5"
validate-npm-package-license "^3.0.1"
normalize-path@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-1.0.0.tgz#32d0e472f91ff345701c15a8311018d3b0a90379"
normalize-path@^2.0.0, normalize-path@^2.0.1:
version "2.1.1"
resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-2.1.1.tgz#1ab28b556e198363a8c1a6f7e6fa20137fe6aed9"