Skip to content

Commit

Permalink
Updated README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
theenadayalank committed Sep 20, 2019
1 parent 1654715 commit 328416f
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 33 deletions.
48 changes: 17 additions & 31 deletions README.md
Expand Up @@ -13,35 +13,18 @@ This package will run linters on your project for the committed files in your br

### Prerequisites🔭

It require Node.js v6 or newer. It also requires a package to manage git hooks. I strongly suggest [Husky](https://github.com/typicode/husky) which I use for most of my projects.


```js
// package.json
{
"husky": {
"hooks": {
"pre-commit": "npm test",
"pre-push": "npm test",
"...": "..."
}
}
}
```
* This package requires Node.js `>=8`.
* A package to manage git hooks.

### Installing

* This project requires a package to manage git hooks depending.
* I strongly suggest [Husky](https://github.com/typicode/husky) which pauses the git push by overriding pre-commit hook (it almost overrides all hooks, here we need only pre-push hook) and allow us to run our custom scripts and resumes pushing.


### npm
#### npm

```bash
npm install --save-dev husky lint-prepush
```

or using [`yarn`](https://yarnpkg.com/):
#### using [`yarn`](https://yarnpkg.com/):

```bash
yarn add --dev husky lint-prepush
Expand All @@ -51,11 +34,15 @@ yarn add --dev husky lint-prepush

Configure the following scripts in package.json to lint your committed files 🔧. You can also follow any of the [cosmiconfig](https://github.com/davidtheclark/cosmiconfig) methods to configure lint-prepush.

* Here [Husky](https://github.com/typicode/husky) is used for managing git hooks.

```diff
{
"scripts": {
+ "prepush": "lint-prepush"
},
+ "husky": {
+ "hooks": {
+ "pre-commit": "lint-staged"
+ }
+ },
+ "lint-prepush": {
+ "base": "master",
+ "tasks": {
Expand All @@ -69,28 +56,27 @@ Configure the following scripts in package.json to lint your committed files

The above scrips will lint the js files while pushing to git. It will terminate the process if there are any errors, otherwise, the changes will be pushed.

### With Errors
<img src="screenshots/OutputWithErrors.gif" width="496" height="340" alt="With Erros">

### Without Errors
<img src="screenshots/OutputWithoutErrors.gif" width="496" height="340" alt="WithoutErrors">

### With Errors
<img src="screenshots/OutputWithErrors.gif" width="496" height="340" alt="With Erros">

## Built With

* [NodeJs](https://nodejs.org/en/) - Framework used
* [NPM](https://www.npmjs.com/) - Dependency Management
* [VSCode](https://code.visualstudio.com/) - Code Editor
* [Gifox](https://gifox.io/) - For Making Gif

## Contributing

* If you have any ideas, just open an [issue](https://github.com/theenadayalank/lint-prepush/issues) and tell me what you think.
* Pull requests are warmly welcome, If you would like to contribute to this Project.
* If you have any ideas, just open an [issue](https://github.com/theenadayalank/lint-prepush/issues) and tell us what you think.
* Pull requests are warmly welcome, If you would like to contribute to this project.


## Versioning

We use [SemVer](http://semver.org/) for versioning. For the versions available, see the [tags on this repository](https://github.com/theenadayalank/lint-prepush/tags).
This package use [SemVer](http://semver.org/) for versioning. For the versions available, see the [tags on this repository](https://github.com/theenadayalank/lint-prepush/tags).

## Authors

Expand Down
2 changes: 1 addition & 1 deletion index.js
Expand Up @@ -49,7 +49,7 @@ if (process.stdout.isTTY) {

execChildProcess({ command: 'git rev-parse HEAD' })
.then((commitHash = '') => {
debug('Curret Commit Hash:' + commitHash);
debug('Current Commit Hash:' + commitHash);

let cachedCommitHash = cache.getSync("linted-hash") || "";
debug('Cached Commit Hash:' + cachedCommitHash);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -40,7 +40,7 @@
"npm-which": "^3.0.1"
},
"engines": {
"node": ">=7.6.0"
"node": ">=8"
},
"repository": {
"type": "git",
Expand Down
Binary file modified screenshots/OutputWithErrors.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified screenshots/OutputWithoutErrors.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 328416f

Please sign in to comment.