Files

Return to Package Diff Home.
Brought to you by Intrinsic.

Package Diff: lint-staged @ 8.1.3 .. 8.1.5

package.json

@@ -1,6 +1,6 @@
{
"name": "lint-staged",
- "version": "8.1.3",
+ "version": "8.1.5",
"description": "Lint files staged by git",
"license": "MIT",
"repository": "https://github.com/okonet/lint-staged",
@@ -29,7 +29,6 @@
}
},
"dependencies": {
- "@iamstarkov/listr-update-renderer": "0.4.1",
"chalk": "^2.3.1",
"commander": "^2.14.1",
"cosmiconfig": "^5.0.2",
@@ -42,7 +41,8 @@
"is-glob": "^4.0.0",
"is-windows": "^1.0.2",
"listr": "^0.14.2",
- "lodash": "^4.17.5",
+ "listr-update-renderer": "^0.5.0",
+ "lodash": "^4.17.11",
"log-symbols": "^2.2.0",
"micromatch": "^3.1.8",
"npm-which": "^3.0.1",

README.md

@@ -2,7 +2,7 @@
Run linters against staged git files and don't let :poop: slip into your code base!
-The latest versions of `lint-staged` require Node.js v6 or newer. (Versions of `lint-staged` prior to v7 still work with Node.js v4.)
+[![asciicast](https://asciinema.org/a/199934.svg)](https://asciinema.org/a/199934)
## Why
@@ -21,41 +21,23 @@
## Installation and setup
-> A fast way to perform the below is to run `npx mrm lint-staged`. It does most of the setup for you.
+The fastest way to start using lint-staged is to run following command in your terminal:
-1. `npm install --save-dev lint-staged husky`
-1. Install and setup your linters just like you would do normally. Add appropriate `.eslintrc`, `.stylelintrc`, etc.
-1. Update your `package.json` like this:
-
-```diff json
-{
-+ "husky": {
-+ "hooks": {
-+ "pre-commit": "lint-staged"
-+ }
-+ },
-+ "lint-staged": {
-+ "*.js": ["eslint --fix", "git add"]
-+ }
-}
+```bash
+npx mrm lint-staged
```
-Now change a few files, `git add` some of them to your commit and try to `git commit` them.
-
-This is how it looks in action:
+It will install and configure [husky](https://github.com/typicode/husky) and lint-staged depending on code quality tools from `package.json` dependencies so please make sure you install (`npm install --save-dev`) and configure all code quality tools like [Prettier](https://prettier.io), [ESlint](https://eslint.org) prior that.
-<p align="center">
- <img src="./screenshots/lint-staged-prettier.gif" alt="lint-staged with prettier example"
- width="640" height="432">
-</p>
+Don't forget to commit changes to `package.json` to share this setup with your team!
-See [examples](#examples) and [configuration](#configuration) below.
+Now change a few files, `git add` or `git add --patch` some of them to your commit and try to `git commit` them.
-> I recommend using [husky](https://github.com/typicode/husky) to manage git hooks but you can use any other tool.
+See [examples](#examples) and [configuration](#configuration) for more information.
## Changelog
-[releases](https://github.com/okonet/lint-staged/releases)
+See [Releases](https://github.com/okonet/lint-staged/releases)
## Command line flags
@@ -204,7 +186,7 @@
```json
{
- "*.js": ["eslint --fix", "git add"]
+ "*.js": ["prettier --write", "git add"]
}
```

src/generateTasks.js

@@ -12,8 +12,7 @@
debug('Generating linter tasks')
const normalizedConfig = getConfig(config) // Ensure we have a normalized config
- const { linters, globOptions } = normalizedConfig
- const ignorePatterns = normalizedConfig.ignore.map(pattern => `!${pattern}`)
+ const { linters, globOptions, ignore } = normalizedConfig
const gitDir = resolveGitDir()
const cwd = process.cwd()
@@ -21,7 +20,6 @@
return Object.keys(linters).map(pattern => {
const isParentDirPattern = pattern.startsWith('../')
- const patterns = [pattern].concat(ignorePatterns)
const commands = linters[pattern]
const fileList = micromatch(
@@ -31,8 +29,11 @@
.filter(file => isParentDirPattern || pathIsInside(file, cwd))
// Make the paths relative to CWD for filtering
.map(file => path.relative(cwd, file)),
- patterns,
- globOptions
+ pattern,
+ {
+ ...globOptions,
+ ignore
+ }
).map(file => {
// if you set relative option, then the file path will be relative to your package.json
if (config.relative) {