lint-staged 13.1.1 → 13.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -221,7 +221,7 @@ Linter commands work on a subset of all staged files, defined by a _glob pattern
221
221
  - **`"!(*test).js"`**. will match all JS files, except those ending in `test.js`, so `foo.js` but not `foo.test.js`
222
222
  - If the glob pattern does contain a slash (`/`), it will match for paths as well:
223
223
  - **`"./*.js"`** will match all JS files in the git repo root, so `/test.js` but not `/foo/bar/test.js`
224
- - **`"foo/**/\*.js"`** will match all JS files inside the`/foo`directory, so`/foo/bar/test.js`but not`/test.js`
224
+ - **`"foo/**/*.js"`** will match all JS files inside the `/foo` directory, so `/foo/bar/test.js` but not `/test.js`
225
225
 
226
226
  When matching, lint-staged will do the following
227
227
 
@@ -274,7 +274,7 @@ going to execute `eslint` and if it exits with `0` code, it will execute `pretti
274
274
 
275
275
  ## Using JS configuration files
276
276
 
277
- Writing the configuration file in JavaScript is the most powerful way to configure lint-staged (`lint-staged.config.js`, [similar](https://github.com/okonet/lint-staged/README.md#configuration), or passed via `--config`). From the configuration file, you can export either a single function or an object.
277
+ Writing the configuration file in JavaScript is the most powerful way to configure lint-staged (`lint-staged.config.js`, [similar](https://github.com/okonet/lint-staged#configuration), or passed via `--config`). From the configuration file, you can export either a single function or an object.
278
278
 
279
279
  If the `exports` value is a function, it will receive an array of all staged filenames. You can then build your own matchers for the files and return a command string or an array of command strings. These strings are considered complete and should include the filename arguments, if wanted.
280
280
 
@@ -358,7 +358,7 @@ export default {
358
358
  <details>
359
359
  <summary>Click to expand</summary>
360
360
 
361
- It's better to use the [function-based configuration (seen above)](https://github.com/okonet/lint-staged/README.md#example-export-a-function-to-build-your-own-matchers), if your use case is this.
361
+ It's better to use the [function-based configuration (seen above)](https://github.com/okonet/lint-staged#example-export-a-function-to-build-your-own-matchers), if your use case is this.
362
362
 
363
363
  ```js
364
364
  // lint-staged.config.js
@@ -4,16 +4,16 @@ import fs from 'node:fs'
4
4
  import path from 'node:path'
5
5
  import { fileURLToPath } from 'node:url'
6
6
 
7
- import { isColorSupported } from 'colorette'
8
7
  import { Option, program } from 'commander'
9
8
  import debug from 'debug'
9
+ import supportsColor from 'supports-color'
10
10
 
11
11
  import lintStaged from '../lib/index.js'
12
12
  import { CONFIG_STDIN_ERROR } from '../lib/messages.js'
13
13
 
14
14
  // Force colors for packages that depend on https://www.npmjs.com/package/supports-color
15
- if (isColorSupported) {
16
- process.env.FORCE_COLOR = '1'
15
+ if (supportsColor.stdout) {
16
+ process.env.FORCE_COLOR = supportsColor.stdout.level.toString()
17
17
  }
18
18
 
19
19
  // Do not terminate main Listr process on SIGINT
package/lib/index.js CHANGED
@@ -75,7 +75,8 @@ const lintStaged = async (
75
75
  quiet = false,
76
76
  relative = false,
77
77
  shell = false,
78
- stash = true,
78
+ // Stashing should be disabled by default when the `diff` option is used
79
+ stash = diff === undefined,
79
80
  verbose = false,
80
81
  } = {},
81
82
  logger = console
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lint-staged",
3
- "version": "13.1.1",
3
+ "version": "13.1.3",
4
4
  "description": "Lint files staged by git",
5
5
  "license": "MIT",
6
6
  "repository": "https://github.com/okonet/lint-staged",
@@ -35,35 +35,36 @@
35
35
  "dependencies": {
36
36
  "cli-truncate": "^3.1.0",
37
37
  "colorette": "^2.0.19",
38
- "commander": "^9.4.1",
38
+ "commander": "^10.0.0",
39
39
  "debug": "^4.3.4",
40
- "execa": "^6.1.0",
41
- "lilconfig": "2.0.6",
42
- "listr2": "^5.0.5",
40
+ "execa": "^7.0.0",
41
+ "lilconfig": "2.1.0",
42
+ "listr2": "^5.0.7",
43
43
  "micromatch": "^4.0.5",
44
44
  "normalize-path": "^3.0.0",
45
- "object-inspect": "^1.12.2",
45
+ "object-inspect": "^1.12.3",
46
46
  "pidtree": "^0.6.0",
47
47
  "string-argv": "^0.3.1",
48
- "yaml": "^2.1.3"
48
+ "supports-color": "9.3.1",
49
+ "yaml": "^2.2.1"
49
50
  },
50
51
  "devDependencies": {
51
- "@babel/core": "^7.20.2",
52
+ "@babel/core": "^7.21.0",
52
53
  "@babel/eslint-parser": "^7.19.1",
53
54
  "@babel/preset-env": "^7.20.2",
54
- "babel-jest": "^29.3.1",
55
+ "babel-jest": "^29.4.3",
55
56
  "babel-plugin-transform-imports": "2.0.0",
56
57
  "consolemock": "^1.1.0",
57
- "eslint": "^8.28.0",
58
- "eslint-config-prettier": "^8.5.0",
59
- "eslint-plugin-import": "^2.26.0",
58
+ "eslint": "^8.35.0",
59
+ "eslint-config-prettier": "^8.6.0",
60
+ "eslint-plugin-import": "^2.27.5",
60
61
  "eslint-plugin-node": "^11.1.0",
61
62
  "eslint-plugin-prettier": "^4.2.1",
62
- "fs-extra": "^10.1.0",
63
- "husky": "^8.0.2",
64
- "jest": "^29.3.1",
63
+ "fs-extra": "^11.1.0",
64
+ "husky": "^8.0.3",
65
+ "jest": "^29.4.3",
65
66
  "jest-snapshot-serializer-ansi": "^1.0.0",
66
- "prettier": "^2.7.1"
67
+ "prettier": "^2.8.4"
67
68
  },
68
69
  "keywords": [
69
70
  "lint",