diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index cc1851bba..abc53b8c1 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -40,9 +40,8 @@ jobs:
test:
strategy:
matrix:
- # Test with Node.js v12 (LTS), v14 (LTS), v16 (LTS), and 18 (Current)
+ # Test with Node.js v14 (LTS), v16 (LTS), and 18 (Current)
node:
- - 12
- 14
- 16
- 18
diff --git a/README.md b/README.md
index 78811a782..9e1435077 100644
--- a/README.md
+++ b/README.md
@@ -64,6 +64,10 @@ See [Releases](https://github.com/okonet/lint-staged/releases).
### Migration
+#### v13
+
+- 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.
+
#### v12
- 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).
@@ -92,6 +96,10 @@ Options:
-c, --config [path] path to configuration file, or - to read from stdin
--cwd [path] run all tasks in specific directory, instead of the current
-d, --debug print additional debug information (default: false)
+ --diff [string] override the default "--staged" flag of "git diff" to get list of files. Implies
+ "--no-stash".
+ --diff-filter [string] override the default "--diff-filter=ACMR" flag of "git diff" to get list of files
+ --max-arg-length [number] maximum length of the command-line argument string (default: 0)
--no-stash disable the backup stash, and do not revert in case of errors
-q, --quiet disable lint-staged’s own console output (default: false)
-r, --relative pass relative filepaths to tasks (default: false)
@@ -111,6 +119,9 @@ Options:
- **`--debug`**: Run in debug mode. When set, it does the following:
- uses [debug](https://github.com/visionmedia/debug) internally to log additional information about staged files, commands being executed, location of binaries, etc. Debug logs, which are automatically enabled by passing the flag, can also be enabled by setting the environment variable `$DEBUG` to `lint-staged*`.
- uses [`verbose` renderer](https://github.com/SamVerschueren/listr-verbose-renderer) for `listr`; this causes serial, uncoloured output to the terminal, instead of the default (beautified, dynamic) output.
+- **`--diff`**: By default linters are filtered against all files staged in git, generated from `git diff --staged`. This option allows you to override the `--staged` flag with arbitrary revisions. For example to get a list of changed files between two branches, use `--diff="branch1...branch2"`. You can also read more from about [git diff](https://git-scm.com/docs/git-diff) and [gitrevisions](https://git-scm.com/docs/gitrevisions).
+- **`--diff-filter`**: By default only files that are _added_, _copied_, _modified_, or _renamed_ are included. Use this flag to override the default `ACMR` value with something else: _added_ (`A`), _copied_ (`C`), _deleted_ (`D`), _modified_ (`M`), _renamed_ (`R`), _type changed_ (`T`), _unmerged_ (`U`), _unknown_ (`X`), or _pairing broken_ (`B`). See also the `git diff` docs for [--diff-filter](https://git-scm.com/docs/git-diff#Documentation/git-diff.txt---diff-filterACDMRTUXB82308203).
+- **`--max-arg-length`**: long commands (a lot of files) are automatically split into multiple chunks when it detects the current shell cannot handle them. Use this flag to override the maximum length of the generated command string.
- **`--no-stash`**: By default a backup stash will be created before running the tasks, and all task modifications will be reverted in case of an error. This option will disable creating the stash, and instead leave all modifications in the index when aborting the commit.
- **`--quiet`**: Supress all CLI output, except from tasks.
- **`--relative`**: Pass filepaths relative to `process.cwd()` (where `lint-staged` runs) to tasks. Default is `false`.
@@ -596,7 +607,7 @@ const success = await lintStaged({
relative: false,
shell: false,
stash: true,
- verbose: false
+ verbose: false,
})
```
@@ -713,6 +724,30 @@ Example repo: [sudo-suhas/lint-staged-django-react-demo](https://github.com/sudo
+### Can I run `lint-staged` in CI, or when there are no staged files?
+
+
+ Click to expand
+
+Lint-staged will by default run against files staged in git, and should be run during the git pre-commit hook, for example. It's also possible to override this default behaviour and run against files in a specific diff, for example
+all changed files between two different branches. If you want to run _lint-staged_ in the CI, maybe you can set it up to compare the branch in a _Pull Request_/_Merge Request_ to the target branch.
+
+Try out the `git diff` command until you are satisfied with the result, for example:
+
+```
+git diff --diff-filter=ACMR --name-only master...my-branch
+```
+
+This will print a list of _added_, _changed_, _modified_, and _renamed_ files between `master` and `my-branch`.
+
+You can then run lint-staged against the same files with:
+
+```
+npx lint-staged --diff="master...my-branch"
+```
+
+
+
### Can I use `lint-staged` with `ng lint`
diff --git a/bin/lint-staged.js b/bin/lint-staged.js
index a2c3dd508..ff8c0d919 100755
--- a/bin/lint-staged.js
+++ b/bin/lint-staged.js
@@ -1,19 +1,19 @@
#!/usr/bin/env node
-import fs from 'fs'
-import path from 'path'
-import { fileURLToPath } from 'url'
+import fs from 'node:fs'
+import path from 'node:path'
+import { fileURLToPath } from 'node:url'
+import { isColorSupported } from 'colorette'
import { Option, program } from 'commander'
import debug from 'debug'
-import supportsColor from 'supports-color'
import lintStaged from '../lib/index.js'
import { CONFIG_STDIN_ERROR } from '../lib/messages.js'
// Force colors for packages that depend on https://www.npmjs.com/package/supports-color
-if (supportsColor.stdout) {
- process.env.FORCE_COLOR = supportsColor.stdout.level.toString()
+if (isColorSupported) {
+ process.env.FORCE_COLOR = '1'
}
// Do not terminate main Listr process on SIGINT
@@ -42,6 +42,16 @@ cli.option('--cwd [path]', 'run all tasks in specific directory, instead of the
cli.option('-d, --debug', 'print additional debug information', false)
+cli.option(
+ '--diff [string]',
+ 'override the default "--staged" flag of "git diff" to get list of files. Implies "--no-stash".'
+)
+
+cli.option(
+ '--diff-filter [string]',
+ 'override the default "--diff-filter=ACMR" flag of "git diff" to get list of files'
+)
+
cli.option('--max-arg-length [number]', 'maximum length of the command-line argument string', 0)
/**
@@ -86,6 +96,8 @@ const options = {
configPath: cliOptions.config,
cwd: cliOptions.cwd,
debug: !!cliOptions.debug,
+ diff: cliOptions.diff,
+ diffFilter: cliOptions.diffFilter,
maxArgLength: cliOptions.maxArgLength || undefined,
quiet: !!cliOptions.quiet,
relative: !!cliOptions.relative,
diff --git a/lib/chunkFiles.js b/lib/chunkFiles.js
index f04c25a65..64761a046 100644
--- a/lib/chunkFiles.js
+++ b/lib/chunkFiles.js
@@ -1,4 +1,4 @@
-import path from 'path'
+import path from 'node:path'
import debug from 'debug'
import normalize from 'normalize-path'
diff --git a/lib/dynamicImport.js b/lib/dynamicImport.js
index 75e228fc2..fba6409cd 100644
--- a/lib/dynamicImport.js
+++ b/lib/dynamicImport.js
@@ -1,3 +1,3 @@
-import { pathToFileURL } from 'url'
+import { pathToFileURL } from 'node:url'
export const dynamicImport = (path) => import(pathToFileURL(path)).then((module) => module.default)
diff --git a/lib/execGit.js b/lib/execGit.js
index 432a290cb..e2f79c6b4 100644
--- a/lib/execGit.js
+++ b/lib/execGit.js
@@ -1,5 +1,5 @@
import debug from 'debug'
-import execa from 'execa'
+import { execa } from 'execa'
const debugLog = debug('lint-staged:execGit')
diff --git a/lib/file.js b/lib/file.js
index 3f88414e8..2d871fa43 100644
--- a/lib/file.js
+++ b/lib/file.js
@@ -1,4 +1,4 @@
-import { promises as fs } from 'fs'
+import fs from 'node:fs/promises'
import debug from 'debug'
diff --git a/lib/generateTasks.js b/lib/generateTasks.js
index 99e3e91cf..b05d625f3 100644
--- a/lib/generateTasks.js
+++ b/lib/generateTasks.js
@@ -1,4 +1,4 @@
-import path from 'path'
+import path from 'node:path'
import debug from 'debug'
import micromatch from 'micromatch'
diff --git a/lib/getStagedFiles.js b/lib/getStagedFiles.js
index 363e07a1d..b301d4225 100644
--- a/lib/getStagedFiles.js
+++ b/lib/getStagedFiles.js
@@ -1,18 +1,29 @@
-import path from 'path'
+import path from 'node:path'
import normalize from 'normalize-path'
import { execGit } from './execGit.js'
import { parseGitZOutput } from './parseGitZOutput.js'
-export const getStagedFiles = async ({ cwd = process.cwd() } = {}) => {
+export const getStagedFiles = async ({ cwd = process.cwd(), diff, diffFilter } = {}) => {
try {
- // Docs for --diff-filter option: https://git-scm.com/docs/git-diff#Documentation/git-diff.txt---diff-filterACDMRTUXB82308203
- // Docs for -z option: https://git-scm.com/docs/git-diff#Documentation/git-diff.txt--z
- const lines = await execGit(['diff', '--staged', '--diff-filter=ACMR', '--name-only', '-z'], {
- cwd,
- })
+ /**
+ * Docs for --diff-filter option:
+ * @see https://git-scm.com/docs/git-diff#Documentation/git-diff.txt---diff-filterACDMRTUXB82308203
+ */
+ const diffFilterArg = diffFilter !== undefined ? diffFilter.trim() : 'ACMR'
+ /** Use `--diff branch1...branch2` or `--diff="branch1 branch2", or fall back to default staged files */
+ const diffArgs = diff !== undefined ? diff.trim().split(' ') : ['--staged']
+
+ /**
+ * Docs for -z option:
+ * @see https://git-scm.com/docs/git-diff#Documentation/git-diff.txt--z
+ */
+ const lines = await execGit(
+ ['diff', '--name-only', '-z', `--diff-filter=${diffFilterArg}`, ...diffArgs],
+ { cwd }
+ )
if (!lines) return []
return parseGitZOutput(lines).map((file) => normalize(path.resolve(cwd, file)))
diff --git a/lib/gitWorkflow.js b/lib/gitWorkflow.js
index a2f842355..8ae95e7e1 100644
--- a/lib/gitWorkflow.js
+++ b/lib/gitWorkflow.js
@@ -1,4 +1,4 @@
-import path from 'path'
+import path from 'node:path'
import debug from 'debug'
diff --git a/lib/groupFilesByConfig.js b/lib/groupFilesByConfig.js
index 8d734bad8..e6e90e7a8 100644
--- a/lib/groupFilesByConfig.js
+++ b/lib/groupFilesByConfig.js
@@ -1,23 +1,19 @@
-import path from 'path'
+import path from 'node:path'
import debug from 'debug'
-import { ConfigObjectSymbol } from './searchConfigs.js'
-
const debugLog = debug('lint-staged:groupFilesByConfig')
-export const groupFilesByConfig = async ({ configs, files }) => {
+export const groupFilesByConfig = async ({ configs, files, singleConfigMode }) => {
debugLog('Grouping %d files by %d configurations', files.length, Object.keys(configs).length)
const filesSet = new Set(files)
const filesByConfig = {}
/** Configs are sorted deepest first by `searchConfigs` */
- for (const filepath of Reflect.ownKeys(configs)) {
- const config = configs[filepath]
-
- /** When passed an explicit config object via the Node.js API, skip logic */
- if (filepath === ConfigObjectSymbol) {
+ for (const [filepath, config] of Object.entries(configs)) {
+ /** When passed an explicit config object via the Node.js API‚ or an explicit path, skip logic */
+ if (singleConfigMode) {
filesByConfig[filepath] = { config, files }
break
}
diff --git a/lib/index.js b/lib/index.js
index e15616d49..85420f546 100644
--- a/lib/index.js
+++ b/lib/index.js
@@ -49,6 +49,8 @@ const getMaxArgLength = () => {
* @param {string} [options.configPath] - Path to configuration file
* @param {Object} [options.cwd] - Current working directory
* @param {boolean} [options.debug] - Enable debug mode
+ * @param {string} [options.diff] - Override the default "--staged" flag of "git diff" to get list of files
+ * @param {string} [options.diffFilter] - Override the default "--diff-filter=ACMR" flag of "git diff" to get list of files
* @param {number} [options.maxArgLength] - Maximum argument string length
* @param {boolean} [options.quiet] - Disable lint-staged’s own console output
* @param {boolean} [options.relative] - Pass relative filepaths to tasks
@@ -67,6 +69,8 @@ const lintStaged = async (
configPath,
cwd,
debug = false,
+ diff,
+ diffFilter,
maxArgLength = getMaxArgLength() / 2,
quiet = false,
relative = false,
@@ -82,29 +86,30 @@ const lintStaged = async (
debugLog('Unset GIT_LITERAL_PATHSPECS (was `%s`)', process.env.GIT_LITERAL_PATHSPECS)
delete process.env.GIT_LITERAL_PATHSPECS
+ const options = {
+ allowEmpty,
+ concurrent,
+ configObject,
+ configPath,
+ cwd,
+ debug,
+ diff,
+ diffFilter,
+ maxArgLength,
+ quiet,
+ relative,
+ shell,
+ stash,
+ verbose,
+ }
+
try {
- const ctx = await runAll(
- {
- allowEmpty,
- concurrent,
- configObject,
- configPath,
- cwd,
- debug,
- maxArgLength,
- quiet,
- relative,
- shell,
- stash,
- verbose,
- },
- logger
- )
+ const ctx = await runAll(options, logger)
debugLog('Tasks were executed successfully!')
printTaskOutput(ctx, logger)
return true
} catch (runAllError) {
- if (runAllError && runAllError.ctx && runAllError.ctx.errors) {
+ if (runAllError?.ctx?.errors) {
const { ctx } = runAllError
if (ctx.errors.has(ConfigNotFoundError)) {
diff --git a/lib/messages.js b/lib/messages.js
index 6083f77cf..2be1d5b87 100644
--- a/lib/messages.js
+++ b/lib/messages.js
@@ -28,8 +28,14 @@ export const NO_STAGED_FILES = `${info} No staged files found.`
export const NO_TASKS = `${info} No staged files match any configured task.`
-export const skippingBackup = (hasInitialCommit) => {
- const reason = hasInitialCommit ? '`--no-stash` was used' : 'there’s no initial commit yet'
+export const skippingBackup = (hasInitialCommit, diff) => {
+ const reason =
+ diff !== undefined
+ ? '`--diff` was used'
+ : hasInitialCommit
+ ? '`--no-stash` was used'
+ : 'there’s no initial commit yet'
+
return yellow(`${warning} Skipping backup because ${reason}.\n`)
}
diff --git a/lib/printTaskOutput.js b/lib/printTaskOutput.js
index 831f8fd07..e3a4845d6 100644
--- a/lib/printTaskOutput.js
+++ b/lib/printTaskOutput.js
@@ -5,7 +5,7 @@
*/
export const printTaskOutput = (ctx = {}, logger) => {
if (!Array.isArray(ctx.output)) return
- const log = ctx.errors && ctx.errors.size > 0 ? logger.error : logger.log
+ const log = ctx.errors?.size > 0 ? logger.error : logger.log
for (const line of ctx.output) {
log(line)
}
diff --git a/lib/resolveConfig.js b/lib/resolveConfig.js
index 0b9f357c1..cb4ab0bde 100644
--- a/lib/resolveConfig.js
+++ b/lib/resolveConfig.js
@@ -1,4 +1,4 @@
-import { createRequire } from 'module'
+import { createRequire } from 'node:module'
/**
* require() does not exist for ESM, so we must create it to use require.resolve().
diff --git a/lib/resolveGitRepo.js b/lib/resolveGitRepo.js
index 3e7460369..f01570590 100644
--- a/lib/resolveGitRepo.js
+++ b/lib/resolveGitRepo.js
@@ -1,5 +1,5 @@
-import { promises as fs } from 'fs'
-import path from 'path'
+import fs from 'node:fs/promises'
+import path from 'node:path'
import debug from 'debug'
import normalize from 'normalize-path'
diff --git a/lib/resolveTaskFn.js b/lib/resolveTaskFn.js
index 77a4ab777..45f16b570 100644
--- a/lib/resolveTaskFn.js
+++ b/lib/resolveTaskFn.js
@@ -1,5 +1,5 @@
import { redBright, dim } from 'colorette'
-import execa from 'execa'
+import { execa, execaCommand } from 'execa'
import debug from 'debug'
import { parseArgsStringToArgv } from 'string-argv'
import pidTree from 'pidtree'
@@ -139,7 +139,7 @@ export const resolveTaskFn = ({
return async (ctx = getInitialState()) => {
const execaChildProcess = shell
- ? execa.command(isFn ? command : `${command} ${files.join(' ')}`, execaOptions)
+ ? execaCommand(isFn ? command : `${command} ${files.join(' ')}`, execaOptions)
: execa(cmd, isFn ? args : args.concat(files), execaOptions)
const quitInterruptCheck = interruptExecutionOnError(ctx, execaChildProcess)
diff --git a/lib/runAll.js b/lib/runAll.js
index b9c54f7da..63b68a159 100644
--- a/lib/runAll.js
+++ b/lib/runAll.js
@@ -1,6 +1,6 @@
/** @typedef {import('./index').Logger} Logger */
-import path from 'path'
+import path from 'node:path'
import { dim } from 'colorette'
import debug from 'debug'
@@ -36,7 +36,7 @@ import {
restoreUnstagedChangesSkipped,
} from './state.js'
import { GitRepoError, GetStagedFilesError, GitError, ConfigNotFoundError } from './symbols.js'
-import { ConfigObjectSymbol, searchConfigs } from './searchConfigs.js'
+import { searchConfigs } from './searchConfigs.js'
const debugLog = debug('lint-staged:runAll')
@@ -52,6 +52,8 @@ const createError = (ctx) => Object.assign(new Error('lint-staged failed'), { ct
* @param {string} [options.configPath] - Explicit path to a config file
* @param {string} [options.cwd] - Current working directory
* @param {boolean} [options.debug] - Enable debug mode
+ * @param {string} [options.diff] - Override the default "--staged" flag of "git diff" to get list of files
+ * @param {string} [options.diffFilter] - Override the default "--diff-filter=ACMR" flag of "git diff" to get list of files
* @param {number} [options.maxArgLength] - Maximum argument string length
* @param {boolean} [options.quiet] - Disable lint-staged’s own console output
* @param {boolean} [options.relative] - Pass relative filepaths to tasks
@@ -69,6 +71,8 @@ export const runAll = async (
configPath,
cwd,
debug = false,
+ diff,
+ diffFilter,
maxArgLength,
quiet = false,
relative = false,
@@ -100,13 +104,14 @@ export const runAll = async (
.then(() => true)
.catch(() => false)
- // Lint-staged should create a backup stash only when there's an initial commit
- ctx.shouldBackup = hasInitialCommit && stash
+ // Lint-staged should create a backup stash only when there's an initial commit,
+ // and when using the default list of staged files
+ ctx.shouldBackup = hasInitialCommit && stash && diff === undefined
if (!ctx.shouldBackup) {
- logger.warn(skippingBackup(hasInitialCommit))
+ logger.warn(skippingBackup(hasInitialCommit, diff))
}
- const files = await getStagedFiles({ cwd: gitDir })
+ const files = await getStagedFiles({ cwd: gitDir, diff, diffFilter })
if (!files) {
if (!quiet) ctx.output.push(FAILED_GET_STAGED_FILES)
ctx.errors.add(GetStagedFilesError)
@@ -121,7 +126,7 @@ export const runAll = async (
}
const foundConfigs = await searchConfigs({ configObject, configPath, cwd, gitDir }, logger)
- const numberOfConfigs = Reflect.ownKeys(foundConfigs).length
+ const numberOfConfigs = Object.keys(foundConfigs).length
// Throw if no configurations were found
if (numberOfConfigs === 0) {
@@ -129,7 +134,11 @@ export const runAll = async (
throw createError(ctx, ConfigNotFoundError)
}
- const filesByConfig = await groupFilesByConfig({ configs: foundConfigs, files })
+ const filesByConfig = await groupFilesByConfig({
+ configs: foundConfigs,
+ files,
+ singleConfigMode: configObject || configPath !== undefined,
+ })
const hasMultipleConfigs = numberOfConfigs > 1
@@ -149,13 +158,8 @@ export const runAll = async (
// Set of all staged files that matched a task glob. Values in a set are unique.
const matchedFiles = new Set()
- for (const configPath of Reflect.ownKeys(filesByConfig)) {
- const { config, files } = filesByConfig[configPath]
-
- const configName =
- configPath === ConfigObjectSymbol
- ? 'Config object'
- : normalize(path.relative(cwd, configPath))
+ for (const [configPath, { config, files }] of Object.entries(filesByConfig)) {
+ const configName = configPath ? normalize(path.relative(cwd, configPath)) : 'Config object'
const stagedFileChunks = chunkFiles({ baseDir: gitDir, files, maxArgLength, relative })
diff --git a/lib/searchConfigs.js b/lib/searchConfigs.js
index ebadd0144..dce5b0dbc 100644
--- a/lib/searchConfigs.js
+++ b/lib/searchConfigs.js
@@ -1,6 +1,6 @@
/** @typedef {import('./index').Logger} Logger */
-import { basename, join } from 'path'
+import path from 'node:path'
import debug from 'debug'
import normalize from 'normalize-path'
@@ -15,7 +15,7 @@ const debugLog = debug('lint-staged:searchConfigs')
const EXEC_GIT = ['ls-files', '-z', '--full-name']
const filterPossibleConfigFiles = (files) =>
- files.filter((file) => searchPlaces.includes(basename(file)))
+ files.filter((file) => searchPlaces.includes(path.basename(file)))
const numberOfLevels = (file) => file.split('/').length
@@ -23,8 +23,6 @@ const sortDeepestParth = (a, b) => (numberOfLevels(a) > numberOfLevels(b) ? -1 :
const isInsideDirectory = (dir) => (file) => file.startsWith(normalize(dir))
-export const ConfigObjectSymbol = Symbol()
-
/**
* Search all config files from the git repository, preferring those inside `cwd`.
*
@@ -46,7 +44,7 @@ export const searchConfigs = async (
if (configObject) {
debugLog('Using single direct configuration object...')
- return { [ConfigObjectSymbol]: validateConfig(configObject, 'config object', logger) }
+ return { '': validateConfig(configObject, 'config object', logger) }
}
// Use only explicit config path instead of discovering multiple
@@ -70,7 +68,7 @@ export const searchConfigs = async (
/** Sort possible config files so that deepest is first */
const possibleConfigFiles = [...cachedFiles, ...otherFiles]
- .map((file) => normalize(join(gitDir, file)))
+ .map((file) => normalize(path.join(gitDir, file)))
.filter(isInsideDirectory(cwd))
.sort(sortDeepestParth)
diff --git a/lib/validateOptions.js b/lib/validateOptions.js
index 78b4c01e1..a97e60c1d 100644
--- a/lib/validateOptions.js
+++ b/lib/validateOptions.js
@@ -1,5 +1,6 @@
-import { constants, promises as fs } from 'fs'
-import path from 'path'
+import { constants } from 'node:fs'
+import fs from 'node:fs/promises'
+import path from 'node:path'
import debug from 'debug'
diff --git a/package-lock.json b/package-lock.json
index e50e5a289..6859c49db 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -13,7 +13,7 @@
"colorette": "^2.0.16",
"commander": "^9.3.0",
"debug": "^4.3.4",
- "execa": "^5.1.1",
+ "execa": "^6.1.0",
"lilconfig": "2.0.5",
"listr2": "^4.0.5",
"micromatch": "^4.0.5",
@@ -21,8 +21,7 @@
"object-inspect": "^1.12.2",
"pidtree": "^0.5.0",
"string-argv": "^0.3.1",
- "supports-color": "^9.2.2",
- "yaml": "^1.10.2"
+ "yaml": "^2.1.1"
},
"bin": {
"lint-staged": "bin/lint-staged.js"
@@ -46,7 +45,7 @@
"prettier": "^2.6.2"
},
"engines": {
- "node": "^12.20.0 || ^14.13.1 || >=16.0.0"
+ "node": "^14.13.1 || >=16.0.0"
},
"funding": {
"url": "https://opencollective.com/lint-staged"
@@ -4094,27 +4093,52 @@
}
},
"node_modules/execa": {
- "version": "5.1.1",
- "resolved": "https://registry.npmjs.org/execa/-/execa-5.1.1.tgz",
- "integrity": "sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==",
+ "version": "6.1.0",
+ "resolved": "https://registry.npmjs.org/execa/-/execa-6.1.0.tgz",
+ "integrity": "sha512-QVWlX2e50heYJcCPG0iWtf8r0xjEYfz/OYLGDYH+IyjWezzPNxz63qNFOu0l4YftGWuizFVZHHs8PrLU5p2IDA==",
"dependencies": {
"cross-spawn": "^7.0.3",
- "get-stream": "^6.0.0",
- "human-signals": "^2.1.0",
- "is-stream": "^2.0.0",
+ "get-stream": "^6.0.1",
+ "human-signals": "^3.0.1",
+ "is-stream": "^3.0.0",
"merge-stream": "^2.0.0",
- "npm-run-path": "^4.0.1",
- "onetime": "^5.1.2",
- "signal-exit": "^3.0.3",
- "strip-final-newline": "^2.0.0"
+ "npm-run-path": "^5.1.0",
+ "onetime": "^6.0.0",
+ "signal-exit": "^3.0.7",
+ "strip-final-newline": "^3.0.0"
},
"engines": {
- "node": ">=10"
+ "node": "^12.20.0 || ^14.13.1 || >=16.0.0"
},
"funding": {
"url": "https://github.com/sindresorhus/execa?sponsor=1"
}
},
+ "node_modules/execa/node_modules/mimic-fn": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-4.0.0.tgz",
+ "integrity": "sha512-vqiC06CuhBTUdZH+RYl8sFrL096vA45Ok5ISO6sE/Mr1jRbGH4Csnhi8f3wKVl7x8mO4Au7Ir9D3Oyv1VYMFJw==",
+ "engines": {
+ "node": ">=12"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/execa/node_modules/onetime": {
+ "version": "6.0.0",
+ "resolved": "https://registry.npmjs.org/onetime/-/onetime-6.0.0.tgz",
+ "integrity": "sha512-1FlR+gjXK7X+AsAHso35MnyN5KqGwJRi/31ft6x0M194ht7S+rWAvd7PHss9xSKMzE0asv1pyIHaJYq+BbacAQ==",
+ "dependencies": {
+ "mimic-fn": "^4.0.0"
+ },
+ "engines": {
+ "node": ">=12"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
"node_modules/exit": {
"version": "0.1.2",
"resolved": "https://registry.npmjs.org/exit/-/exit-0.1.2.tgz",
@@ -4483,11 +4507,11 @@
"dev": true
},
"node_modules/human-signals": {
- "version": "2.1.0",
- "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz",
- "integrity": "sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==",
+ "version": "3.0.1",
+ "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-3.0.1.tgz",
+ "integrity": "sha512-rQLskxnM/5OCldHo+wNXbpVgDn5A17CUoKX+7Sokwaknlq7CdSnphy0W39GU8dw59XiCXmFXDg4fRuckQRKewQ==",
"engines": {
- "node": ">=10.17.0"
+ "node": ">=12.20.0"
}
},
"node_modules/husky": {
@@ -4834,11 +4858,11 @@
}
},
"node_modules/is-stream": {
- "version": "2.0.1",
- "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz",
- "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==",
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-3.0.0.tgz",
+ "integrity": "sha512-LnQR4bZ9IADDRSkvpqMGvt/tEJWclzklNgSw48V5EAaAeDd6qGvN8ei6k5p0tvxSR171VmGyHuTiAOfxAbr8kA==",
"engines": {
- "node": ">=8"
+ "node": "^12.20.0 || ^14.13.1 || >=16.0.0"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
@@ -5019,6 +5043,71 @@
"node": "^12.13.0 || ^14.15.0 || ^16.10.0 || >=17.0.0"
}
},
+ "node_modules/jest-changed-files/node_modules/execa": {
+ "version": "5.1.1",
+ "resolved": "https://registry.npmjs.org/execa/-/execa-5.1.1.tgz",
+ "integrity": "sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==",
+ "dev": true,
+ "dependencies": {
+ "cross-spawn": "^7.0.3",
+ "get-stream": "^6.0.0",
+ "human-signals": "^2.1.0",
+ "is-stream": "^2.0.0",
+ "merge-stream": "^2.0.0",
+ "npm-run-path": "^4.0.1",
+ "onetime": "^5.1.2",
+ "signal-exit": "^3.0.3",
+ "strip-final-newline": "^2.0.0"
+ },
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/sindresorhus/execa?sponsor=1"
+ }
+ },
+ "node_modules/jest-changed-files/node_modules/human-signals": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz",
+ "integrity": "sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==",
+ "dev": true,
+ "engines": {
+ "node": ">=10.17.0"
+ }
+ },
+ "node_modules/jest-changed-files/node_modules/is-stream": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz",
+ "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==",
+ "dev": true,
+ "engines": {
+ "node": ">=8"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/jest-changed-files/node_modules/npm-run-path": {
+ "version": "4.0.1",
+ "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz",
+ "integrity": "sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==",
+ "dev": true,
+ "dependencies": {
+ "path-key": "^3.0.0"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/jest-changed-files/node_modules/strip-final-newline": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-2.0.0.tgz",
+ "integrity": "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==",
+ "dev": true,
+ "engines": {
+ "node": ">=6"
+ }
+ },
"node_modules/jest-circus": {
"version": "28.1.0",
"resolved": "https://registry.npmjs.org/jest-circus/-/jest-circus-28.1.0.tgz",
@@ -6005,6 +6094,71 @@
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
"dev": true
},
+ "node_modules/jest-runtime/node_modules/execa": {
+ "version": "5.1.1",
+ "resolved": "https://registry.npmjs.org/execa/-/execa-5.1.1.tgz",
+ "integrity": "sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==",
+ "dev": true,
+ "dependencies": {
+ "cross-spawn": "^7.0.3",
+ "get-stream": "^6.0.0",
+ "human-signals": "^2.1.0",
+ "is-stream": "^2.0.0",
+ "merge-stream": "^2.0.0",
+ "npm-run-path": "^4.0.1",
+ "onetime": "^5.1.2",
+ "signal-exit": "^3.0.3",
+ "strip-final-newline": "^2.0.0"
+ },
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/sindresorhus/execa?sponsor=1"
+ }
+ },
+ "node_modules/jest-runtime/node_modules/human-signals": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz",
+ "integrity": "sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==",
+ "dev": true,
+ "engines": {
+ "node": ">=10.17.0"
+ }
+ },
+ "node_modules/jest-runtime/node_modules/is-stream": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz",
+ "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==",
+ "dev": true,
+ "engines": {
+ "node": ">=8"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/jest-runtime/node_modules/npm-run-path": {
+ "version": "4.0.1",
+ "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz",
+ "integrity": "sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==",
+ "dev": true,
+ "dependencies": {
+ "path-key": "^3.0.0"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/jest-runtime/node_modules/strip-final-newline": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-2.0.0.tgz",
+ "integrity": "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==",
+ "dev": true,
+ "engines": {
+ "node": ">=6"
+ }
+ },
"node_modules/jest-runtime/node_modules/supports-color": {
"version": "7.2.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
@@ -6894,14 +7048,28 @@
}
},
"node_modules/npm-run-path": {
- "version": "4.0.1",
- "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz",
- "integrity": "sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==",
+ "version": "5.1.0",
+ "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-5.1.0.tgz",
+ "integrity": "sha512-sJOdmRGrY2sjNTRMbSvluQqg+8X7ZK61yvzBEIDhz4f8z1TZFYABsqjjCBd/0PUNE9M6QDgHJXQkGUEm7Q+l9Q==",
"dependencies": {
- "path-key": "^3.0.0"
+ "path-key": "^4.0.0"
},
"engines": {
- "node": ">=8"
+ "node": "^12.20.0 || ^14.13.1 || >=16.0.0"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/npm-run-path/node_modules/path-key": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/path-key/-/path-key-4.0.0.tgz",
+ "integrity": "sha512-haREypq7xkM7ErfgIyA0z+Bj4AGKlMSdlQE2jvJo6huWD1EdkKYV+G/T4nq0YEF2vgTT8kqMFKo1uHn950r4SQ==",
+ "engines": {
+ "node": ">=12"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/object-inspect": {
@@ -7713,11 +7881,14 @@
}
},
"node_modules/strip-final-newline": {
- "version": "2.0.0",
- "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-2.0.0.tgz",
- "integrity": "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==",
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-3.0.0.tgz",
+ "integrity": "sha512-dOESqjYr96iWYylGObzd39EuNTa5VJxyvVAEm5Jnh7KGo75V43Hk1odPQkNDyXNmUR6k+gEiDVXnjB8HJ3crXw==",
"engines": {
- "node": ">=6"
+ "node": ">=12"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/strip-json-comments": {
@@ -7732,17 +7903,6 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
- "node_modules/supports-color": {
- "version": "9.2.2",
- "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-9.2.2.tgz",
- "integrity": "sha512-XC6g/Kgux+rJXmwokjm9ECpD6k/smUoS5LKlUCcsYr4IY3rW0XyAympon2RmxGrlnZURMpg5T18gWDP9CsHXFA==",
- "engines": {
- "node": ">=12"
- },
- "funding": {
- "url": "https://github.com/chalk/supports-color?sponsor=1"
- }
- },
"node_modules/supports-hyperlinks": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/supports-hyperlinks/-/supports-hyperlinks-2.2.0.tgz",
@@ -8171,11 +8331,11 @@
"dev": true
},
"node_modules/yaml": {
- "version": "1.10.2",
- "resolved": "https://registry.npmjs.org/yaml/-/yaml-1.10.2.tgz",
- "integrity": "sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg==",
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.1.1.tgz",
+ "integrity": "sha512-o96x3OPo8GjWeSLF+wOAbrPfhFOGY0W00GNaxCDv+9hkcDJEnev1yh8S7pgHF0ik6zc8sQLuL8hjHjJULZp8bw==",
"engines": {
- "node": ">= 6"
+ "node": ">= 14"
}
},
"node_modules/yargs": {
@@ -11221,19 +11381,34 @@
"dev": true
},
"execa": {
- "version": "5.1.1",
- "resolved": "https://registry.npmjs.org/execa/-/execa-5.1.1.tgz",
- "integrity": "sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==",
+ "version": "6.1.0",
+ "resolved": "https://registry.npmjs.org/execa/-/execa-6.1.0.tgz",
+ "integrity": "sha512-QVWlX2e50heYJcCPG0iWtf8r0xjEYfz/OYLGDYH+IyjWezzPNxz63qNFOu0l4YftGWuizFVZHHs8PrLU5p2IDA==",
"requires": {
"cross-spawn": "^7.0.3",
- "get-stream": "^6.0.0",
- "human-signals": "^2.1.0",
- "is-stream": "^2.0.0",
+ "get-stream": "^6.0.1",
+ "human-signals": "^3.0.1",
+ "is-stream": "^3.0.0",
"merge-stream": "^2.0.0",
- "npm-run-path": "^4.0.1",
- "onetime": "^5.1.2",
- "signal-exit": "^3.0.3",
- "strip-final-newline": "^2.0.0"
+ "npm-run-path": "^5.1.0",
+ "onetime": "^6.0.0",
+ "signal-exit": "^3.0.7",
+ "strip-final-newline": "^3.0.0"
+ },
+ "dependencies": {
+ "mimic-fn": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-4.0.0.tgz",
+ "integrity": "sha512-vqiC06CuhBTUdZH+RYl8sFrL096vA45Ok5ISO6sE/Mr1jRbGH4Csnhi8f3wKVl7x8mO4Au7Ir9D3Oyv1VYMFJw=="
+ },
+ "onetime": {
+ "version": "6.0.0",
+ "resolved": "https://registry.npmjs.org/onetime/-/onetime-6.0.0.tgz",
+ "integrity": "sha512-1FlR+gjXK7X+AsAHso35MnyN5KqGwJRi/31ft6x0M194ht7S+rWAvd7PHss9xSKMzE0asv1pyIHaJYq+BbacAQ==",
+ "requires": {
+ "mimic-fn": "^4.0.0"
+ }
+ }
}
},
"exit": {
@@ -11513,9 +11688,9 @@
"dev": true
},
"human-signals": {
- "version": "2.1.0",
- "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz",
- "integrity": "sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw=="
+ "version": "3.0.1",
+ "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-3.0.1.tgz",
+ "integrity": "sha512-rQLskxnM/5OCldHo+wNXbpVgDn5A17CUoKX+7Sokwaknlq7CdSnphy0W39GU8dw59XiCXmFXDg4fRuckQRKewQ=="
},
"husky": {
"version": "8.0.1",
@@ -11748,9 +11923,9 @@
}
},
"is-stream": {
- "version": "2.0.1",
- "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz",
- "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg=="
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-3.0.0.tgz",
+ "integrity": "sha512-LnQR4bZ9IADDRSkvpqMGvt/tEJWclzklNgSw48V5EAaAeDd6qGvN8ei6k5p0tvxSR171VmGyHuTiAOfxAbr8kA=="
},
"is-string": {
"version": "1.0.7",
@@ -11874,6 +12049,52 @@
"requires": {
"execa": "^5.0.0",
"throat": "^6.0.1"
+ },
+ "dependencies": {
+ "execa": {
+ "version": "5.1.1",
+ "resolved": "https://registry.npmjs.org/execa/-/execa-5.1.1.tgz",
+ "integrity": "sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==",
+ "dev": true,
+ "requires": {
+ "cross-spawn": "^7.0.3",
+ "get-stream": "^6.0.0",
+ "human-signals": "^2.1.0",
+ "is-stream": "^2.0.0",
+ "merge-stream": "^2.0.0",
+ "npm-run-path": "^4.0.1",
+ "onetime": "^5.1.2",
+ "signal-exit": "^3.0.3",
+ "strip-final-newline": "^2.0.0"
+ }
+ },
+ "human-signals": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz",
+ "integrity": "sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==",
+ "dev": true
+ },
+ "is-stream": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz",
+ "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==",
+ "dev": true
+ },
+ "npm-run-path": {
+ "version": "4.0.1",
+ "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz",
+ "integrity": "sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==",
+ "dev": true,
+ "requires": {
+ "path-key": "^3.0.0"
+ }
+ },
+ "strip-final-newline": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-2.0.0.tgz",
+ "integrity": "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==",
+ "dev": true
+ }
}
},
"jest-circus": {
@@ -12614,6 +12835,50 @@
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
"dev": true
},
+ "execa": {
+ "version": "5.1.1",
+ "resolved": "https://registry.npmjs.org/execa/-/execa-5.1.1.tgz",
+ "integrity": "sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==",
+ "dev": true,
+ "requires": {
+ "cross-spawn": "^7.0.3",
+ "get-stream": "^6.0.0",
+ "human-signals": "^2.1.0",
+ "is-stream": "^2.0.0",
+ "merge-stream": "^2.0.0",
+ "npm-run-path": "^4.0.1",
+ "onetime": "^5.1.2",
+ "signal-exit": "^3.0.3",
+ "strip-final-newline": "^2.0.0"
+ }
+ },
+ "human-signals": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz",
+ "integrity": "sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==",
+ "dev": true
+ },
+ "is-stream": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz",
+ "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==",
+ "dev": true
+ },
+ "npm-run-path": {
+ "version": "4.0.1",
+ "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz",
+ "integrity": "sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==",
+ "dev": true,
+ "requires": {
+ "path-key": "^3.0.0"
+ }
+ },
+ "strip-final-newline": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-2.0.0.tgz",
+ "integrity": "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==",
+ "dev": true
+ },
"supports-color": {
"version": "7.2.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
@@ -13289,11 +13554,18 @@
"integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA=="
},
"npm-run-path": {
- "version": "4.0.1",
- "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz",
- "integrity": "sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==",
+ "version": "5.1.0",
+ "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-5.1.0.tgz",
+ "integrity": "sha512-sJOdmRGrY2sjNTRMbSvluQqg+8X7ZK61yvzBEIDhz4f8z1TZFYABsqjjCBd/0PUNE9M6QDgHJXQkGUEm7Q+l9Q==",
"requires": {
- "path-key": "^3.0.0"
+ "path-key": "^4.0.0"
+ },
+ "dependencies": {
+ "path-key": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/path-key/-/path-key-4.0.0.tgz",
+ "integrity": "sha512-haREypq7xkM7ErfgIyA0z+Bj4AGKlMSdlQE2jvJo6huWD1EdkKYV+G/T4nq0YEF2vgTT8kqMFKo1uHn950r4SQ=="
+ }
}
},
"object-inspect": {
@@ -13880,9 +14152,9 @@
"dev": true
},
"strip-final-newline": {
- "version": "2.0.0",
- "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-2.0.0.tgz",
- "integrity": "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA=="
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-3.0.0.tgz",
+ "integrity": "sha512-dOESqjYr96iWYylGObzd39EuNTa5VJxyvVAEm5Jnh7KGo75V43Hk1odPQkNDyXNmUR6k+gEiDVXnjB8HJ3crXw=="
},
"strip-json-comments": {
"version": "3.1.1",
@@ -13890,11 +14162,6 @@
"integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==",
"dev": true
},
- "supports-color": {
- "version": "9.2.2",
- "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-9.2.2.tgz",
- "integrity": "sha512-XC6g/Kgux+rJXmwokjm9ECpD6k/smUoS5LKlUCcsYr4IY3rW0XyAympon2RmxGrlnZURMpg5T18gWDP9CsHXFA=="
- },
"supports-hyperlinks": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/supports-hyperlinks/-/supports-hyperlinks-2.2.0.tgz",
@@ -14224,9 +14491,9 @@
"dev": true
},
"yaml": {
- "version": "1.10.2",
- "resolved": "https://registry.npmjs.org/yaml/-/yaml-1.10.2.tgz",
- "integrity": "sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg=="
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.1.1.tgz",
+ "integrity": "sha512-o96x3OPo8GjWeSLF+wOAbrPfhFOGY0W00GNaxCDv+9hkcDJEnev1yh8S7pgHF0ik6zc8sQLuL8hjHjJULZp8bw=="
},
"yargs": {
"version": "17.5.1",
diff --git a/package.json b/package.json
index 7483656d1..7ca78e34b 100644
--- a/package.json
+++ b/package.json
@@ -14,7 +14,7 @@
"url": "https://opencollective.com/lint-staged"
},
"engines": {
- "node": "^12.20.0 || ^14.13.1 || >=16.0.0"
+ "node": "^14.13.1 || >=16.0.0"
},
"type": "module",
"bin": "./bin/lint-staged.js",
@@ -36,7 +36,7 @@
"colorette": "^2.0.16",
"commander": "^9.3.0",
"debug": "^4.3.4",
- "execa": "^5.1.1",
+ "execa": "^6.1.0",
"lilconfig": "2.0.5",
"listr2": "^4.0.5",
"micromatch": "^4.0.5",
@@ -44,8 +44,7 @@
"object-inspect": "^1.12.2",
"pidtree": "^0.5.0",
"string-argv": "^0.3.1",
- "supports-color": "^9.2.2",
- "yaml": "^1.10.2"
+ "yaml": "^2.1.1"
},
"devDependencies": {
"@babel/core": "^7.18.2",
diff --git a/test/__mocks__/execa.js b/test/__mocks__/execa.js
index 5d0d45078..4534fd3e0 100644
--- a/test/__mocks__/execa.js
+++ b/test/__mocks__/execa.js
@@ -1,6 +1,6 @@
import { createExecaReturnValue } from '../utils/createExecaReturnValue'
-const execa = jest.fn(() =>
+export const execa = jest.fn(() =>
createExecaReturnValue({
stdout: 'a-ok',
stderr: '',
@@ -12,6 +12,4 @@ const execa = jest.fn(() =>
})
)
-execa.command = execa
-
-module.exports = execa
+export const execaCommand = execa
diff --git a/test/execGit.spec.js b/test/execGit.spec.js
index fec935100..17f9592ca 100644
--- a/test/execGit.spec.js
+++ b/test/execGit.spec.js
@@ -1,6 +1,6 @@
import path from 'path'
-import execa from 'execa'
+import { execa } from 'execa'
import { execGit, GIT_GLOBAL_OPTIONS } from '../lib/execGit'
diff --git a/test/getStagedFiles.spec.js b/test/getStagedFiles.spec.js
index 15866460d..620b8ebd2 100644
--- a/test/getStagedFiles.spec.js
+++ b/test/getStagedFiles.spec.js
@@ -11,11 +11,20 @@ jest.mock('../lib/execGit')
const normalizePath = (input) => normalize(path.resolve('/', input))
describe('getStagedFiles', () => {
+ afterEach(() => {
+ jest.clearAllMocks()
+ })
+
it('should return array of file names', async () => {
execGit.mockImplementationOnce(async () => 'foo.js\u0000bar.js\u0000')
const staged = await getStagedFiles({ cwd: '/' })
// Windows filepaths
expect(staged).toEqual([normalizePath('/foo.js'), normalizePath('/bar.js')])
+
+ expect(execGit).toHaveBeenLastCalledWith(
+ ['diff', '--name-only', '-z', '--diff-filter=ACMR', '--staged'],
+ { cwd: '/' }
+ )
})
it('should return empty array when no staged files', async () => {
@@ -31,4 +40,40 @@ describe('getStagedFiles', () => {
const staged = await getStagedFiles({})
expect(staged).toEqual(null)
})
+
+ it('should support overriding diff trees with ...', async () => {
+ execGit.mockImplementationOnce(async () => 'foo.js\u0000bar.js\u0000')
+ const staged = await getStagedFiles({ cwd: '/', diff: 'master...my-branch' })
+ // Windows filepaths
+ expect(staged).toEqual([normalizePath('/foo.js'), normalizePath('/bar.js')])
+
+ expect(execGit).toHaveBeenLastCalledWith(
+ ['diff', '--name-only', '-z', '--diff-filter=ACMR', 'master...my-branch'],
+ { cwd: '/' }
+ )
+ })
+
+ it('should support overriding diff trees with multiple args', async () => {
+ execGit.mockImplementationOnce(async () => 'foo.js\u0000bar.js\u0000')
+ const staged = await getStagedFiles({ cwd: '/', diff: 'master my-branch' })
+ // Windows filepaths
+ expect(staged).toEqual([normalizePath('/foo.js'), normalizePath('/bar.js')])
+
+ expect(execGit).toHaveBeenLastCalledWith(
+ ['diff', '--name-only', '-z', '--diff-filter=ACMR', 'master', 'my-branch'],
+ { cwd: '/' }
+ )
+ })
+
+ it('should support overriding diff-filter', async () => {
+ execGit.mockImplementationOnce(async () => 'foo.js\u0000bar.js\u0000')
+ const staged = await getStagedFiles({ cwd: '/', diffFilter: 'ACDMRTUXB' })
+ // Windows filepaths
+ expect(staged).toEqual([normalizePath('/foo.js'), normalizePath('/bar.js')])
+
+ expect(execGit).toHaveBeenLastCalledWith(
+ ['diff', '--name-only', '-z', '--diff-filter=ACDMRTUXB', '--staged'],
+ { cwd: '/' }
+ )
+ })
})
diff --git a/test/integration.test.js b/test/integration.test.js
index b90a35c8e..afc0bda45 100644
--- a/test/integration.test.js
+++ b/test/integration.test.js
@@ -1309,6 +1309,51 @@ describe('lint-staged', () => {
// File outside deeper/ was not fixed
expect(await readFile('file.js')).toEqual(testJsFileUgly)
})
+
+ it('should support overriding file list using --diff', async () => {
+ // Commit ugly file
+ await appendFile('test.js', testJsFileUgly)
+ await execGit(['add', 'test.js'])
+ await execGit(['commit', '-m', 'ugly'], { cwd })
+
+ const hashes = (await execGit(['log', '--format=format:%H'])).trim().split('\n')
+ expect(hashes).toHaveLength(2)
+
+ // Run lint-staged with `--diff` between the two commits.
+ // Nothing is staged at this point, so don't rung `gitCommit`
+ const passed = await lintStaged({
+ config: { '*.js': 'prettier --list-different' },
+ cwd,
+ debug: true,
+ diff: `${hashes[1]}...${hashes[0]}`,
+ stash: false,
+ })
+
+ // Lint-staged failed because commit diff contains ugly file
+ expect(passed).toEqual(false)
+
+ expect(console.printHistory()).toMatch('prettier --list-different:')
+ expect(console.printHistory()).toMatch('test.js')
+ })
+
+ it('should support overriding default --diff-filter', async () => {
+ // Stage ugly file
+ await appendFile('test.js', testJsFileUgly)
+ await execGit(['add', 'test.js'])
+
+ // Run lint-staged with `--diff-filter=D` to include only deleted files.
+ const passed = await lintStaged({
+ config: { '*.js': 'prettier --list-different' },
+ cwd,
+ diffFilter: 'D',
+ stash: false,
+ })
+
+ // Lint-staged passed because no matching (deleted) files
+ expect(passed).toEqual(true)
+
+ expect(console.printHistory()).toMatch('No staged files found')
+ })
})
describe('lintStaged', () => {
diff --git a/test/loadConfig.spec.js b/test/loadConfig.spec.js
index 2a533a19c..44888364f 100644
--- a/test/loadConfig.spec.js
+++ b/test/loadConfig.spec.js
@@ -21,7 +21,7 @@ jest.unmock('execa')
* This converts paths into `file://` urls, but this doesn't
* work with `import()` when using babel + jest.
*/
-jest.mock('url', () => ({
+jest.mock('node:url', () => ({
pathToFileURL: (path) => path,
}))
diff --git a/test/makeCmdTasks.spec.js b/test/makeCmdTasks.spec.js
index 5d5e3164c..999052faf 100644
--- a/test/makeCmdTasks.spec.js
+++ b/test/makeCmdTasks.spec.js
@@ -1,4 +1,4 @@
-import execa from 'execa'
+import { execa } from 'execa'
import { makeCmdTasks } from '../lib/makeCmdTasks'
diff --git a/test/resolveTaskFn.spec.js b/test/resolveTaskFn.spec.js
index f46d57998..c5bbb3368 100644
--- a/test/resolveTaskFn.spec.js
+++ b/test/resolveTaskFn.spec.js
@@ -1,4 +1,4 @@
-import execa from 'execa'
+import { execa } from 'execa'
import pidTree from 'pidtree'
import { resolveTaskFn } from '../lib/resolveTaskFn'
diff --git a/test/runAll.spec.js b/test/runAll.spec.js
index f890383aa..5c1e7420b 100644
--- a/test/runAll.spec.js
+++ b/test/runAll.spec.js
@@ -1,7 +1,7 @@
import path from 'path'
import makeConsoleMock from 'consolemock'
-import execa from 'execa'
+import { execa } from 'execa'
import normalize from 'normalize-path'
import { getStagedFiles } from '../lib/getStagedFiles'
@@ -45,6 +45,7 @@ describe('runAll', () => {
beforeAll(() => {
console = makeConsoleMock()
+ jest.clearAllMocks()
})
afterEach(() => {
@@ -372,4 +373,14 @@ describe('runAll', () => {
expect(ctx.errors.has(ConfigNotFoundError)).toBe(true)
}
})
+
+ it('should warn when --no-stash was used', async () => {
+ await runAll({ configObject: { '*.js': ['echo "sample"'] }, stash: false })
+ expect(console.printHistory()).toMatch('Skipping backup because `--no-stash` was used')
+ })
+
+ it('should warn when --diff was used', async () => {
+ await runAll({ configObject: { '*.js': ['echo "sample"'] }, diff: 'branch1...branch2' })
+ expect(console.printHistory()).toMatch('Skipping backup because `--diff` was used')
+ })
})
diff --git a/test/searchConfigs.spec.js b/test/searchConfigs.spec.js
index e7adcc206..eb229fe6a 100644
--- a/test/searchConfigs.spec.js
+++ b/test/searchConfigs.spec.js
@@ -4,7 +4,7 @@ import normalize from 'normalize-path'
import { execGit } from '../lib/execGit.js'
import { loadConfig } from '../lib/loadConfig.js'
-import { ConfigObjectSymbol, searchConfigs } from '../lib/searchConfigs.js'
+import { searchConfigs } from '../lib/searchConfigs.js'
jest.mock('../lib/resolveConfig', () => ({
/** Unfortunately necessary due to non-ESM tests. */
@@ -47,7 +47,7 @@ describe('searchConfigs', () => {
it('should return config for valid config object', async () => {
await expect(searchConfigs({ configObject: { '*.js': 'eslint' } })).resolves.toEqual({
- [ConfigObjectSymbol]: { '*.js': 'eslint' },
+ '': { '*.js': 'eslint' },
})
})