lint-staged 12.5.0 → 13.0.0

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
@@ -64,6 +64,10 @@ See [Releases](https://github.com/okonet/lint-staged/releases).
64
64
 
65
65
  ### Migration
66
66
 
67
+ #### v13
68
+
69
+ - Since `v13.0.0` _lint-staged_ no longer supports Node.js 12. Please upgrade your Node.js version to at least `14.13.1`, or `16.0.0` onward.
70
+
67
71
  #### v12
68
72
 
69
73
  - Since `v12.0.0` _lint-staged_ is a pure ESM module, so make sure your Node.js version is at least `12.20.0`, `14.13.1`, or `16.0.0`. Read more about ESM modules from the official [Node.js Documentation site here](https://nodejs.org/api/esm.html#introduction).
@@ -1,19 +1,19 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import fs from 'fs'
4
- import path from 'path'
5
- import { fileURLToPath } from 'url'
3
+ import fs from 'node:fs'
4
+ import path from 'node:path'
5
+ import { fileURLToPath } from 'node:url'
6
6
 
7
+ import { isColorSupported } from 'colorette'
7
8
  import { Option, program } from 'commander'
8
9
  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 (supportsColor.stdout) {
16
- process.env.FORCE_COLOR = supportsColor.stdout.level.toString()
15
+ if (isColorSupported) {
16
+ process.env.FORCE_COLOR = '1'
17
17
  }
18
18
 
19
19
  // Do not terminate main Listr process on SIGINT
package/lib/chunkFiles.js CHANGED
@@ -1,4 +1,4 @@
1
- import path from 'path'
1
+ import path from 'node:path'
2
2
 
3
3
  import debug from 'debug'
4
4
  import normalize from 'normalize-path'
@@ -1,3 +1,3 @@
1
- import { pathToFileURL } from 'url'
1
+ import { pathToFileURL } from 'node:url'
2
2
 
3
3
  export const dynamicImport = (path) => import(pathToFileURL(path)).then((module) => module.default)
package/lib/execGit.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import debug from 'debug'
2
- import execa from 'execa'
2
+ import { execa } from 'execa'
3
3
 
4
4
  const debugLog = debug('lint-staged:execGit')
5
5
 
package/lib/file.js CHANGED
@@ -1,4 +1,4 @@
1
- import { promises as fs } from 'fs'
1
+ import fs from 'node:fs/promises'
2
2
 
3
3
  import debug from 'debug'
4
4
 
@@ -1,4 +1,4 @@
1
- import path from 'path'
1
+ import path from 'node:path'
2
2
 
3
3
  import debug from 'debug'
4
4
  import micromatch from 'micromatch'
@@ -1,4 +1,4 @@
1
- import path from 'path'
1
+ import path from 'node:path'
2
2
 
3
3
  import normalize from 'normalize-path'
4
4
 
@@ -1,4 +1,4 @@
1
- import path from 'path'
1
+ import path from 'node:path'
2
2
 
3
3
  import debug from 'debug'
4
4
 
@@ -1,4 +1,4 @@
1
- import path from 'path'
1
+ import path from 'node:path'
2
2
 
3
3
  import debug from 'debug'
4
4
 
package/lib/index.js CHANGED
@@ -109,7 +109,7 @@ const lintStaged = async (
109
109
  printTaskOutput(ctx, logger)
110
110
  return true
111
111
  } catch (runAllError) {
112
- if (runAllError && runAllError.ctx && runAllError.ctx.errors) {
112
+ if (runAllError?.ctx?.errors) {
113
113
  const { ctx } = runAllError
114
114
 
115
115
  if (ctx.errors.has(ConfigNotFoundError)) {
@@ -5,7 +5,7 @@
5
5
  */
6
6
  export const printTaskOutput = (ctx = {}, logger) => {
7
7
  if (!Array.isArray(ctx.output)) return
8
- const log = ctx.errors && ctx.errors.size > 0 ? logger.error : logger.log
8
+ const log = ctx.errors?.size > 0 ? logger.error : logger.log
9
9
  for (const line of ctx.output) {
10
10
  log(line)
11
11
  }
@@ -1,4 +1,4 @@
1
- import { createRequire } from 'module'
1
+ import { createRequire } from 'node:module'
2
2
 
3
3
  /**
4
4
  * require() does not exist for ESM, so we must create it to use require.resolve().
@@ -1,5 +1,5 @@
1
- import { promises as fs } from 'fs'
2
- import path from 'path'
1
+ import fs from 'node:fs/promises'
2
+ import path from 'node:path'
3
3
 
4
4
  import debug from 'debug'
5
5
  import normalize from 'normalize-path'
@@ -1,5 +1,5 @@
1
1
  import { redBright, dim } from 'colorette'
2
- import execa from 'execa'
2
+ import { execa, execaCommand } from 'execa'
3
3
  import debug from 'debug'
4
4
  import { parseArgsStringToArgv } from 'string-argv'
5
5
  import pidTree from 'pidtree'
@@ -139,7 +139,7 @@ export const resolveTaskFn = ({
139
139
 
140
140
  return async (ctx = getInitialState()) => {
141
141
  const execaChildProcess = shell
142
- ? execa.command(isFn ? command : `${command} ${files.join(' ')}`, execaOptions)
142
+ ? execaCommand(isFn ? command : `${command} ${files.join(' ')}`, execaOptions)
143
143
  : execa(cmd, isFn ? args : args.concat(files), execaOptions)
144
144
 
145
145
  const quitInterruptCheck = interruptExecutionOnError(ctx, execaChildProcess)
package/lib/runAll.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /** @typedef {import('./index').Logger} Logger */
2
2
 
3
- import path from 'path'
3
+ import path from 'node:path'
4
4
 
5
5
  import { dim } from 'colorette'
6
6
  import debug from 'debug'
@@ -1,6 +1,6 @@
1
1
  /** @typedef {import('./index').Logger} Logger */
2
2
 
3
- import { basename, join } from 'path'
3
+ import path from 'node:path'
4
4
 
5
5
  import debug from 'debug'
6
6
  import normalize from 'normalize-path'
@@ -15,7 +15,7 @@ const debugLog = debug('lint-staged:searchConfigs')
15
15
  const EXEC_GIT = ['ls-files', '-z', '--full-name']
16
16
 
17
17
  const filterPossibleConfigFiles = (files) =>
18
- files.filter((file) => searchPlaces.includes(basename(file)))
18
+ files.filter((file) => searchPlaces.includes(path.basename(file)))
19
19
 
20
20
  const numberOfLevels = (file) => file.split('/').length
21
21
 
@@ -68,7 +68,7 @@ export const searchConfigs = async (
68
68
 
69
69
  /** Sort possible config files so that deepest is first */
70
70
  const possibleConfigFiles = [...cachedFiles, ...otherFiles]
71
- .map((file) => normalize(join(gitDir, file)))
71
+ .map((file) => normalize(path.join(gitDir, file)))
72
72
  .filter(isInsideDirectory(cwd))
73
73
  .sort(sortDeepestParth)
74
74
 
@@ -1,5 +1,6 @@
1
- import { constants, promises as fs } from 'fs'
2
- import path from 'path'
1
+ import { constants } from 'node:fs'
2
+ import fs from 'node:fs/promises'
3
+ import path from 'node:path'
3
4
 
4
5
  import debug from 'debug'
5
6
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lint-staged",
3
- "version": "12.5.0",
3
+ "version": "13.0.0",
4
4
  "description": "Lint files staged by git",
5
5
  "license": "MIT",
6
6
  "repository": "https://github.com/okonet/lint-staged",
@@ -14,7 +14,7 @@
14
14
  "url": "https://opencollective.com/lint-staged"
15
15
  },
16
16
  "engines": {
17
- "node": "^12.20.0 || ^14.13.1 || >=16.0.0"
17
+ "node": "^14.13.1 || >=16.0.0"
18
18
  },
19
19
  "type": "module",
20
20
  "bin": "./bin/lint-staged.js",
@@ -36,7 +36,7 @@
36
36
  "colorette": "^2.0.16",
37
37
  "commander": "^9.3.0",
38
38
  "debug": "^4.3.4",
39
- "execa": "^5.1.1",
39
+ "execa": "^6.1.0",
40
40
  "lilconfig": "2.0.5",
41
41
  "listr2": "^4.0.5",
42
42
  "micromatch": "^4.0.5",
@@ -44,8 +44,7 @@
44
44
  "object-inspect": "^1.12.2",
45
45
  "pidtree": "^0.5.0",
46
46
  "string-argv": "^0.3.1",
47
- "supports-color": "^9.2.2",
48
- "yaml": "^1.10.2"
47
+ "yaml": "^2.1.1"
49
48
  },
50
49
  "devDependencies": {
51
50
  "@babel/core": "^7.18.2",