diff --git a/README.md b/README.md index 4a56401..9ddba6d 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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": { @@ -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 -With Erros - ### Without Errors WithoutErrors +### With Errors +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 diff --git a/index.js b/index.js index 1180369..afe26f1 100755 --- a/index.js +++ b/index.js @@ -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); diff --git a/package.json b/package.json index 769c5ce..557d866 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,7 @@ "npm-which": "^3.0.1" }, "engines": { - "node": ">=7.6.0" + "node": ">=8" }, "repository": { "type": "git", diff --git a/screenshots/OutputWithErrors.gif b/screenshots/OutputWithErrors.gif index cd3448f..ab7b9e0 100644 Binary files a/screenshots/OutputWithErrors.gif and b/screenshots/OutputWithErrors.gif differ diff --git a/screenshots/OutputWithoutErrors.gif b/screenshots/OutputWithoutErrors.gif index a598413..a1d84aa 100644 Binary files a/screenshots/OutputWithoutErrors.gif and b/screenshots/OutputWithoutErrors.gif differ