https://github.com/chilijung/eslint-gitstaged
zero configuration, lint only git staged js files through eslint
https://github.com/chilijung/eslint-gitstaged
eslint git git-staged pre-commit
Last synced: over 1 year ago
JSON representation
zero configuration, lint only git staged js files through eslint
- Host: GitHub
- URL: https://github.com/chilijung/eslint-gitstaged
- Owner: chilijung
- License: mit
- Created: 2017-06-28T04:01:06.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2018-03-03T14:36:23.000Z (over 8 years ago)
- Last Synced: 2025-03-17T03:34:22.929Z (over 1 year ago)
- Topics: eslint, git, git-staged, pre-commit
- Language: TypeScript
- Homepage:
- Size: 57.6 KB
- Stars: 5
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# eslint-gitstaged
Using **current git staged files** to find out modfied and added files passing eslint, to prevent lint the whole repository again and again. This is a nice package to use along with `git precommit`.
## Install
```
npm install eslint-gitstaged
```
## Command line usage
Install global
```
npm i -g eslint-gitstaged
```
Usage
```
Usage: eslintgs [options] [command]
Commands:
help Display help
Options:
-e, --eslint [value] eslint.json file path (defaults to "./.eslintrc.json")
-E, --ext [value] extension names, can use multiple extensions seperate with comma (defaults to "js,jsx")
-g, --git [value] your git directory, where your .git exist (defaults to ".")
-h, --help Output usage information
-v, --version Output the version number
```
## API
### EslintGitStaged(eslintrcPath, gitPath, extension)
- eslintrcPath: path to your eslintrc file
- gitPath: path to your `.git`
- extension `string | string[]`: which kind of extensions do you want to lint with eslint.
## Usage
```js
// EslintGitStaged(, , )
new EslintGitStaged(resolve(__dirname, "./.eslintrc.js"), resolve(__dirname, "../"), ".js").start()
.then((result) => {
// success no lint error, done lint
})
.catch((err) => {
// err, when lint failed
});
```
## Tslint users
- https://github.com/Canner/tslint-gitstaged
## License
MIT