NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
npm · #1744 most downloaded on npm
Lint files staged by git
Last release 8 days ago
26 Sep 2026
Release timing varies
gaps range from 8 days to 3 months
Nearly every release is documented
notes for 60 of the last 60 stable releases
Nothing withdrawn
no release was ever pulled
11 years old
298 releases · first in 2016
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="import { defineConfig } fr
#1850 938d3f4 - Task functions like { title, task } can now use a logger function log() to emit output while the task runs. By default, the output will only be visible if the task fails, unless the --verbose option was used. Additionally, when the task rejects, the error will be shown in the output.
import { defineConfig } from 'lint-staged/config'
export default defineConfig({
'*': {
title: 'Fail if PDF files are committed',
task: async (filepaths, { log }) => {
const pdfFiles = filepaths.filter((f) => f.toLowerCase().endsWith('.pdf'))
if (pdfFiles.length > 0) {
log('PDF files should not be committed: %s', pdfFiles)
throw new Error('Failed')
}
},
},
})#1854 30562bc - lint-staged now stages changes to all tracked files modified by tasks, including files that weren’t originally staged or didn’t match the configured globs. This can happen when your task has side-effects, or it's a function that ignores the staged files like () => "prettier --write .".
If you have unstaged changes in a file and the task also edits that file, your unstaged changes will be staged too. Use --hide-unstaged to hide your changes while tasks run.
#1860 4296532 - The assignment of staged files to lint-staged configuration files (when using multiple, for example in a monorepo) has been rewritten to be more efficient. As a reminder, each staged file is assigned to exactly one configuration (the closest one), even if that config doesn't match the file in its globs.
#1861 c45f28a - Fix running parallel tasks for a single glob, when tasks are created by a function. Nesting one level of arrays inside an array of tasks will result in the inner tasks running in parallel. This behavior should now be consistent when creating tasks using functions. In the following example eslint and prettier will run in parallel (for all files, when any JS files are staged):
import { defineConfig } from 'lint-staged/config'
export default defineConfig({
'*.js': () => [['eslint --max-warnings=0 .', 'prettier --list-different .']],
})#1859 f0ea69d - Various performance improvements from skipping redundant internal Git calls.
#1856 69d7d17 - Partially staged changes are hidden in a uniquely-named patch file to avoid multiple invocations of lint-staged overwriting it. This makes it safer to run lint-staged in multiple worktrees at the same time.
One column per quarter.
A 'const' initializer in an ambient context must be a string or numeric literal or literal enum reference.
Minor Changes #1847 f9063b7 - Lint-staged now refuses to run when files were staged with --intent-to-add , because Git stash doesn't support them. Pre
f9063b7 - Lint-staged now refuses to run when files were staged with --intent-to-add, because Git stash doesn't support them. Previously this was an unhandled error.#1848 d718ccc - Lint-staged now handles color support better in non-TTY streams, and honors the FORCE_COLOR environment variable.
#1845 7e5ece8 - Update tinyexec@1.3.1 so that local binaries from node_modules/.bin are resolved starting from the directory of each lint-staged configuration file (in monorepo setups). This behavior was broken in lint-staged@16.3.0 where they were only resolved from the current working directory and up.
#1845 eb8a4e3 - Do not try to restore untracked files when using --hide-all and there is no initial commit yet.
<div class="highlight highlight-source-ts notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="// lint-staged.config.ts
efe5b63 - This is a version-bump-only release because the previous version 17.4.0 was not published to npmjs.com due to problems with GitHub Actions and Changesets.#1836 90ec282 - Added a new defineConfig helper for type-checking the lint-staged configuration:
// lint-staged.config.ts
import { defineConfig } from 'lint-staged/config'
export default defineConfig({
'*.js': ['prettier --check', 'eslint'],
})#1832 510a27c - Added a new flag --all to make lint-staged include all files tracked by Git, instead of only staged.
By default lint-staged only runs tasks on files that include staged changes (hence the name). Use this flag to include all files tracked in Git version control (standard exclusions apply). Using this flag implies the --no-stash flag, disabling the automatic backup, and the --allow-empty flag so that lint-staged doesn't fail when there are no changes after running. This makes it easier to run npx lint-staged --all on a clean state, for example in CI.
#1838 69bec99 - The behavior of the automatic backup stash has been improved when running lint-staged in multiple worktrees in parallel. You should still avoid running multiple instances of lint-staged in parallel in the same tree, because some of the Git operations are locking and might lead to data loss.
#1839 5e5bdd2 - Parsing of lint-staged CLI flags and Node.js API options has been rewritten to avoid inconsistent behavior between the two.
{ "*.ts" : [ " first " , " second " , [ " third " , " third " ], " fourth " ] }
#1825 16b3f74 - It is now possible to run multiple tasks in parallel for a single glob by configuring it with an array of tasks (which run sequentially), and then placing another array inside it (where the tasks will run in parallel). The following demonstrates the order tasks will start in:
{
"*.ts": ["first", "second", ["third", "third"], "fourth"]
}As a concrete example, lint-staged's own configuration is:
/** @type {import('./lib/index.js').Configuration} */
export default {
"*": [
[
"oxfmt --check --no-error-on-unmatched-pattern",
"oxlint --no-error-on-unmatched-pattern",
],
],
"*.ts": () => "tsc",
};which means:
oxfmt --check --no-error-on-unmatched-pattern lib/index.jsoxlint --no-error-on-unmatched-pattern lib/index.js*.ts files are staged, run tsc without appending any arguments/ @type { import('lint-staged').Configuration } */ export default { "*.ts" : ( ) => "tsc" , // Run "tsc" when any TS file is changed (for entire proje
#1823 ee156cc - The chunking of tasks based on maximum command line argument length has been re-implemented to be more precise. Now the chunking happens based on the final generated command string, instead of just the list of staged files like previously. This benefits mainly Windows platforms and function commands like:
/** @type {import('lint-staged').Configuration} */
export default {
"*.ts": () => "tsc", // Run "tsc" when any TS file is changed (for entire project)
};Where the spawned command is literally "tsc" without any extra arguments. Previously, this was still chunked when a lot of files were staged. Now, it probably won't be chunked because the length of the command is just three letters.
Also, native JavaScript/Node.js function tasks won't be chunked at all, when previously they were run multiple times when chunked:
/** @type {import('lint-staged').Configuration} */
export default {
"*.js": {
title: "Log staged JS files to console",
task: async (files) => {
console.log("Staged JS files:", files);
},
},
};Patch Changes #1820 a626a9f - It's now possible to set --max-arg-length=Infinity to effectively disable chunking of tasks based on the number of stage
Size of node_modules/ after installing: 1561.7 kB with 29 packages.
#1816 7568d4f - The console output of lint-staged has been simplified so that there's less interactive spinners and more explicit messages like "Started…" -> "Done!". The primary purpose of this was to remove Listr2, a very large dependency.
Before:
Size of node_modules/ after installing: 1561.7 kB with 29 packages.
Fancy interactive spinners, but output dynamically changes:
✔ Backed up original state in git stash (0b191303)
✔ Running tasks for staged files...
✔ Staging changes from tasks...
✔ Cleaning up temporary files...After:
Size of node_modules/ after installing: 974.0 kB with 5 packages (37.6 % smaller, 82.7 % less transitive dependencies).
Simpler but more explicit output:
⋯ Backing up original state…
✔ Done backing up original state (35b38ed1)!
⋯ Running tasks for staged files…
*.js — 1 file
⋯ oxlint --fix
*.{json,md} — 1 file
⋯ oxfmt --write
✔ oxfmt --write
✔ oxlint --fix
✔ Done running tasks for staged files!
⋯ Staging changes from tasks…
✔ Done staging changes from tasks!
⋯ Cleaning up temporary files…
✔ Done cleaning up temporary files!#1816 c19079d - Try to restore hidden unstaged changes when using --no-revert.
#1818 efb23a2 - Console output colors are enabled/disabled more consistently.
#1818 26112a1 - Failed JS function tasks now properly kill other tasks, unless --continue-on-error is used. Previously their failure didn't affect other tasks.
Patch Changes #1809 179b437 - Fix lint-staged discarding the ongoing merge conflict status ( .git/MERGE_HEAD ) when using the --hide-unstaged or --hid
#1809 179b437 - Fix lint-staged discarding the ongoing merge conflict status (.git/MERGE_HEAD) when using the --hide-unstaged or --hide-all options.
#1811 3d0b2c0 - Fix issues with Git commands that are successful but also emit warnings to stderr, by ignoring the stderr output completely when the process exits with code 0. This was the behavior when using nano-spawn and execa, but when switching to tinyexec in 16.3.0 both stdout and stderr were used as interleaved output.
Patch Changes #1806 e692e58 - Update dependency tinyexec@^1.2.4 .
Patch Changes #1803 bdf2770 - Run all tests with Deno , in addition to Node.js and Bun. #1796 7508272 - Fix performance regression of lint-staged v17
#1803 bdf2770 - Run all tests with Deno, in addition to Node.js and Bun.
#1796 7508272 - Fix performance regression of lint-staged v17 by going back to using git add to stage task modifications. This was changed to git update-index --again in v17 for less manual work, but unfortunately the update-index command gets slower in very large Git repos.
#1797 7b2505a - This version of lint-staged uses the new staged publishing for npm packages feature. Releases are already published from GitHub Actions with trusted publishing, but now an additional approval with two-factor authentication is also required.
#1802 321b0a9 - Downgrade dependency tinyexec@1.2.2 to avoid issues in version 1.2.3.
Patch Changes #1792 1f67271 - Correctly set the --max-arg-length default value based on the running platform. This controls how very long lists of sta
after editing <file> it is staged with git add <file> , and then committed with git commit
#1788 f95c1f8 - Another fix for making sure lint-staged adds task modifications correctly to the commit in the following cases:
<file> it is staged with git add <file>, and then committed with git commit<file> it is committed with git commit --all without explicit git add<file> it is committed with git commit <pathspec> without explicit git addThere's new test cases which actually setup the Git pre_commit hook to run lint-staged and verify them. These issues started in v17.0.0 when trying to improve support for committig without having explicitly staged files.
git commit -am "my commit message" where -a (--all) means to automatically stage all tracked modified and deleted files
06813f9 Thanks @iiroj! - Fix lint-staged behavior when implicitly committing files without using git add by either:
git commit -am "my commit message" where -a (--all) means to automatically stage all tracked modified and deleted filesgit commit -m "my commit message" . where . is an example of a pathspec where matching files will be staged### Patch Changes - #1779 `88670ca` Thanks @iiroj! - Enable immutable GitHub releases
### Patch Changes - #1776 `4a5664b` Thanks @iiroj! - Adjust GitHub Actions workflow so that automatic publishing works with signed commits.
`shell npm install --development yaml `
#1745 e244adf Thanks @iiroj! - Node.js v20 is no longer supported, and the oldest supported version is now 22.22.1, which is an active LTS version at the time of this release. Node.js 20 will be EOL after April 2026. Please upgrade your Node.js version!
#1676 0584e0b Thanks @outslept! - Lint-staged now tries to verify the installed Git version is at least 2.32.0, released in 2021. If you're using an even older Git version, you need to upgrade it before running lint-staged!
#1745 2dcc40a Thanks @iiroj! - The dependency yaml is now marked as optional and probably won't be installed by default. If you're using a YAML configuration file you should install the package separately:
npm install --development yaml
If you're using .lintstagedrc as the config file name (without a file extension), it will be treated as a YAML file. If the content is JSON, consider renaming it to .lintstagedrc.json to avoid needing to install yaml.
#1748 809d5ef Thanks @iiroj! - Add new option --hide-all for hiding all unstaged changes and untracked files, before running tasks. This makes it easier to run tools like Knip which check for unused code. Untracked files are included in the backup stash and restored automatically after running.
#1759 f13045a Thanks @iiroj! - Update dependencies, including tinyexec@1.1.1 to fix the following issues:
#!/usr/bin/env node shebang (Prettier, ESLint, for example) were previously spawned using the default Node.js version configured by the version manager (the one which node points to) on POSIX systems. Now, they will be spawned with the same version that lint-staged itself was started with.
node executable available in PATH is a symlink pointing to Snap itself. The sandboxing features of Snap prevented lint-staged from spawning scripts with the #!/usr/bin/env node shebang, because it meant lint-staged tried to spawn Snap via the symlink. This resulted in an ENOENT error when trying to run prettier, for example. Now, since the real node executable's directory is available in the PATH, lint-staged will instead spawn the script with the real node binary succesfully.#1761 d3251b1 Thanks @iiroj! - Lint-staged now runs git update-index --again after running tasks, instead of git add <originally staged files>. This should improve compatibility when using non-default indexes, for example when committing with a pathspec git commit -m "message" . instead of adding files to the index.
#1745 a9585ac Thanks @iiroj! - Remove commander as a dependency and use the built-in parseArgs from node:util to parse CLI flags.
#1755 c82d30b Thanks @iiroj! - All tests now pass on the Bun runtime (latest).
#1750 a401818 Thanks @iiroj! - Remove manual handling for git stash --keep-index resurrecting deleted files, because the issue was fixed in Git 2.23.0 and lint-staged requires at least Git 2.32.0.
#1771 c4b8936 Thanks @iiroj! - Fix documentation about multiple config files and the --cwd option. When using it, all tasks will be run in the specified directory. For example, to run everything in the actual process.cwd(), use lint-staged --cwd=".".
### Minor Changes - #1739 `687fc90` Thanks @hyperz111! - Replace micromatch with picomatch to reduce dependencies.
687fc90 Thanks @hyperz111! - Replace micromatch with picomatch to reduce dependencies.### Patch Changes - #1742 `9d6e827` Thanks @iiroj! - Update dependencies, including `tinyexec@1.0.4` to make sure local node_modules/.bin are preferre
9d6e827 Thanks @iiroj! - Update dependencies, including tinyexec@1.0.4 to make sure local node_modules/.bin are preferred to global locations (released in tinyexec@1.0.3).### Patch Changes - #1740 `0109e8d` Thanks @iiroj! - Make sure Git's warning about CRLF line-endings doesn't interfere with creating initial backup st
### Patch Changes - #1735 `2adaf6c` Thanks @iiroj! - Hide the extra cmd window on Windows by spawning tasks without the detached option.
### Patch Changes - #1729 `cd5d762` Thanks @iiroj! - Remove nano-spawn as a dependency from package.json as it was replaced with tinyexec and is no lo
### Minor Changes - #1698 `feda37a` Thanks @iiroj! - Run external processes with `tinyexec` instead of `nano-spawn`. nano-spawn replaced `execa` in _l
#1698 feda37a Thanks @iiroj! - Run external processes with tinyexec instead of nano-spawn. nano-spawn replaced execa in lint-staged version 16 to limit the amount of npm dependencies required, but caused some unknown issues related to spawning tasks. Let's hope tinyexec improves the situation.
#1699 1346d16 Thanks @iiroj! - Remove pidtree as a dependency. When a task fails, its sub-processes are killed more efficiently via the process group on Unix systems, and the taskkill command on Windows.
### Patch Changes - #1711 `ef74c8d` Thanks @iiroj! - Do not display a "_failed to spawn_" error message when a task fails normally. This message is re
### Patch Changes - #1693 `33d4502` Thanks @Adrian-Baran-GY! - Fix problems with --continue-on-error option, where tasks might have still been killed
33d4502 Thanks @Adrian-Baran-GY! - Fix problems with --continue-on-error option, where tasks might have still been killed (SIGINT) when one of them failed.### Patch Changes - #1687 `9e02d9d` Thanks @iiroj! - Fix unhandled promise rejection when spawning tasks (_instead of the tasks themselves failing_).
### Patch Changes - #1682 `0176038` Thanks @iiroj! - Update dependencies, including `nano-spawn@2.0.0` with bug fixes. - #1671 `581a54e` Thanks @iiroj
### Patch Changes - #1669 `27cd541` Thanks @iiroj! - When using --fail-on-changes, automatically hidden (partially) unstaged changes are no longer cou
Additionally, the example for using the backup stash manually now uses the correct backup hash, if available:
#1667 699f95d Thanks @iiroj! - The backup stash will not be dropped when using --fail-on-changes and there are errors. When reverting to original state is disabled (via --no-revert or --fail-on-changes), hidden (partially) unstaged changes are still restored automatically so that it's easier to resolve the situation manually.
Additionally, the example for using the backup stash manually now uses the correct backup hash, if available:
% npx lint-staged --fail-on-changes
✔ Backed up original state in git stash (c18d55a3)
✔ Running tasks for staged files...
✖ Tasks modified files and --fail-on-changes was used!
↓ Cleaning up temporary files...
✖ lint-staged failed because `--fail-on-changes` was used.
Any lost modifications can be restored from a git stash:
> git stash list --format="%h %s"
c18d55a3 On main: lint-staged automatic backup
> git apply --index c18d55a3
Given the recent vulnerabilities in the _npm_ ecosystem, it's best to be very careful when updating dependencies.
#1664 8277b3b Thanks @iiroj! - The built-in TypeScript types have been updated to more closely match the implementation. Notably, the list of staged files supplied to task functions is readonly string[] and can't be mutated. Thanks @outslept!
export default {
--- "*": (files: string[]) => void console.log('staged files', files)
+++ "*": (files: readonly string[]) => void console.log('staged files', files)
}
#1654 70b9af3 Thanks @iiroj! - This version has been published from GitHub Actions using Trusted Publishing for npm packages.
#1659 4996817 Thanks @iiroj! - Fix searching configuration files when the working directory is a subdirectory of a git repository, and there are package.json files in the working directory. This situation might happen when running lint-staged for a single package in a monorepo.
#1654 7021f0a Thanks @iiroj! - Return the caret semver range (^) to direct dependencies so that future patch and minor versions are allowed. This enables projects to better maintain and deduplicate their own transitive dependencies while not requiring direct updates to lint-staged. This was changed in 16.2.0 after the vulnerability issues with chalk and debug, which were also removed in the same version.
Given the recent vulnerabilities in the npm ecosystem, it's best to be very careful when updating dependencies.
Thanks to @ItsNickBarry for the idea and initial implementation in #1552.
#1615 99eb742 Thanks @iiroj! - Added a new option --fail-on-changes to make lint-staged exit with code 1 when tasks modify any files, making the precommit hook fail. This is similar to the git diff --exit-code option. Using this flag also implies the --no-revert flag which means any changes made by tasks will be left in the working tree after failing, so that they can be manually staged and the commit tried again.
#1611 cd05fd3 Thanks @rlorenzo! - Added a new option --continue-on-error so that lint-staged will run all tasks to completion even if some of them fail. By default, lint-staded will exit early on the first failure.
#1637 82fcc07 Thanks @iiroj! - Internal lint-staged errors are now thrown and visible in the console output. Previously they were caught with the process exit code set to 1, but not logged. This happens when, for example, there's a syntax error in the lint-staged configuration file.
#1647 a5ecc06 Thanks @iiroj! - Remove debug as a dependency due to recent malware issue; read more at https://github.com/debug-js/debug/issues/1005. Because of this, the DEBUG environment variable is no longer supported — use the --debug to enable debugging
#1636 8db2717 Thanks @iiroj! - Added a new option --hide-unstaged so that lint-staged will hide all unstaged changes to tracked files before running tasks. The changes will be applied back after running the tasks. Note that the combination of flags --hide-unstaged --no-hide-partially-staged isn't meaningful and behaves the same as just --hide-unstaged.
Thanks to @ItsNickBarry for the idea and initial implementation in #1552.
#1648 7900b3b Thanks @iiroj! - Remove lilconfig to reduce reliance on third-party dependencies. It was used to find possible config files outside of those tracked in Git, including from the parent directories. This behavior has been moved directly into lint-staged and should work about the same.
#1633 7f9e485 Thanks @dependabot! - Bumps listr2 from 9.0.3 to 9.0.4.
#1626 99d5a9b Thanks @iiroj! - Due to recent phishing attacks, for example chalk@5.6.1 was released with malware. To avoid lint-staged's users being at risk the direct dependencies are pinned to exact versions, instead of allowing future patch versions with the caret (^) range.
#1588 035bbf2 Thanks @outslept! - Increase performance by listing staged files and searching for configuration concurrently.
#1645 deba3ad Thanks @iiroj! - Remove chalk as a dependency due to recent malware issue; read more at https://github.com/chalk/chalk/issues/656.
If you are having trouble with ANSI color codes when using lint-staged, you can try setting either FORCE_COLOR=true or NO_COLOR=true env variables.
### Patch Changes - #1610 `e93578e` Thanks @iiroj! - Try to improve terminating of subprocess of tasks by using SIGKILL, and only calling pidtree when
### Patch Changes - #1608 `4e3ce22` Thanks @srsatt! - Detect the git repo's top-level directory correctly when in a worktree.
### Patch Changes - #1604 `90b37b0` Thanks @iiroj! - Add another types field to package.json to make even more sure NPM detects that _lint-staged_ inc
### Patch Changes - #1602 `7ea700b` Thanks @dword-design! - Add the types field to package.json to make sure NPM detects _lint-staged_ includes built-
7ea700b Thanks @dword-design! - Add the types field to package.json to make sure NPM detects lint-staged includes built-in TypeScript type definitions.`38f942e` Thanks @iiroj! - Removed an extraneous log entry that printed shouldHidePArtiallyStagedFiles to console output.
#1570 a7c0c88 Thanks @ItsNickBarry! - When using --diff-filter with the D option to include deleted staged files, lint-staged no longer tries to stage the deleted files, unless they're no longer deleted. Previously this caused an error from git add like fatal: pathspec 'deleted-file' did not match any files.
38f942e Thanks @iiroj! - Removed an extraneous log entry that printed shouldHidePArtiallyStagedFiles to console output.
The previous (incorrect) behavior can still be achieved by using both options --no-stash --no-hide-partially-staged at the same time.
#1565 3686977 Thanks @iiroj! - Lint-staged now explicitly warns about potential data loss when using --no-stash.
#1571 02299a9 Thanks @iiroj! - Function tasks (introduced in v16.0.0) only receive the staged files matching the configured glob, instead of all staged files.
#1563 bc61c74 Thanks @iiroj! - This version fixes incorrect behavior where unstaged changes were committed when using the --no-stash option. This happened because --no-stash implied --no-hide-partially-staged, meaning unstaged changes to files which also had other staged changes were added to the commit by lint-staged; this is no longer the case.
The previous (incorrect) behavior can still be achieved by using both options --no-stash --no-hide-partially-staged at the same time.
### Minor Changes - #1536 `e729daa` Thanks @iiroj! - A new flag --no-revert has been introduced for when task modifications should be applied to the i
#1536 e729daa Thanks @iiroj! - A new flag --no-revert has been introduced for when task modifications should be applied to the index before aborting the commit in case of errors. By default, lint-staged will clear all task modifications and revert to the original state.
#1550 b27fa3f Thanks @iiroj! - Lint-staged now ignores symlinks and leaves them out from the list of staged files.
c37dc38 Thanks @iiroj! - The minimum required Node.js version is lowered to 20.17 following nano-spawn@1.0.2.`json { "*.js": "node my-js-linter.js" } `
#1546 158d15c Thanks @iiroj! - Processes are spawned using nano-spawn instead of execa. If you are using Node.js scripts as tasks, you might need to explicitly run them with node, especially when using Windows:
{
"*.js": "node my-js-linter.js"
}
#1546 158d15c Thanks @iiroj! - The --shell flag has been removed and lint-staged no longer supports evaluating commands directly via a shell. To migrate existing commands, you can create a shell script and invoke it instead. Lint-staged will pass matched staged files as a list of arguments, accessible via "$@":
# my-script.sh
#!/bin/bash
echo "Staged files: $@"
and
{ "*.js": "my-script.sh" }
If you were using the shell option to avoid passing filenames to tasks, for example bash -c 'tsc --noEmit', use the function syntax instead:
export default { '*.ts': () => 'tsc --noEmit' }
#1546 158d15c Thanks @iiroj! - Validation for deprecated advanced configuration has been removed. The advanced configuration was removed in lint-staged version 9 and until now validation has failed if advanced configuration options were detected. Going forward the entire configuration will be treated with the same logic and if these advanced options are still present, they might be treated as valid globs for staged files instead.
#1546 158d15c Thanks @iiroj! - The lowest supported Node.js version is 20.18. Please upgrade your Node.js version.
#1401 27110ef Thanks @RohitLuthra19! - Added support for directly running functions on staged files. To configure a function task, use an object with a title and the task itself:
export default {
'*.js': {
title: 'My task',
task: async (files) => {
console.log('Staged JS files:', files)
},
},
}
Lint-staged will run your function task with the staged files matching the configured glob as its argument, and show the custom title in its console output.
### Patch Changes - #1544 `5561321` Thanks @YimingIsCOLD! - Correctly handle colon (:) characters in staged filenames.
5561321 Thanks @YimingIsCOLD! - Correctly handle colon (:) characters in staged filenames.### Patch Changes - #1533 `5d53534` Thanks @iiroj! - Improve listing of staged files so that _lint-staged_ doesn't crash when encountering an uninitia
By default Prettier prefers double quotes.
#1526 630af5f Thanks @iiroj! - Lint-staged no longer resets to the original state when preventing an empty git commit. This happens when your configured tasks reset all the staged changes, typically when trying to commit formatting changes which conflict with your linter setup like ESLint or Prettier.
By default Prettier prefers double quotes.
file.js with only double quotes " changed to 'git commit -am "I don't like double quotes"prettier --write file.js, converting all the ' back to "' are stagedfile.js with only double-quotes " changed to 'git commit -am "I don't like double quotes"prettier --write file.js, converting all the ' back to "#1526 630af5f Thanks @iiroj! - Lint-staged no longer resets to the original state when preventing an empty git commit. This happens when your configured tasks reset all the staged changes, typically when trying to commit formatting changes which conflict with your linter setup like ESLint or Prettier.
By default Prettier prefers double quotes.
file.js with only double quotes " changed to 'git commit -am "I don't like double quotes"prettier --write file.js, converting all the ' back to "' are stagedfile.js with only double-quotes " changed to 'git commit -am "I don't like double quotes"prettier --write file.js, converting all the ' back to "### Patch Changes - #1512 `cbfed1d` Thanks @tarik02! - Adjust TypeScript types for the default export so that it can be used as a value without error
### Patch Changes - #1509 `8827ebf` Thanks @iiroj! - Change _lint-staged_'s dependencies to use caret (`^`) ranges instead of tilde (`~`). This makes
8827ebf Thanks @iiroj! - Change lint-staged's dependencies to use caret (^) ranges instead of tilde (~). This makes it easier for package managers to perform dependency management when minor-level updates are also permitted instead of just patch-level.### Patch Changes - #1504 `1c7a45e` Thanks @iiroj! - Default TypeScript config filenames match JS equivalents. - #1504 `9cc18c9` Thanks @iiroj! - Add
@filename: lint-staged.config.js
#1500 a8ec1dd Thanks @iiroj! - Lint-staged now provides TypeScript types for the configuration and main Node.js API. You can use the JSDoc syntax in your JS configuration files:
/**
* @filename: lint-staged.config.js
* @type {import('lint-staged').Configuration}
*/
export default {
'*': 'prettier --write',
}
It's also possible to use the .ts file extension for the configuration if your Node.js version supports it. The --experimental-strip-types flag was introduced in Node.js v22.6.0 and unflagged in v23.6.0, enabling Node.js to execute TypeScript files without additional configuration.
export NODE_OPTIONS="--experimental-strip-types"
npx lint-staged --config lint-staged.config.ts
% npx lint-staged ✔ Backed up original state in git stash (20addf8) ✔ Running tasks for staged files... ✔ Applying modifications from tasks... ✔ Clean
#1495 e69da9e Thanks @iiroj! - Added more info to the debug logs so that "environment" info doesn't need to be added separately to GitHub issues.
#1493 fa0fe98 Thanks @iiroj! - Added more help messages around the automatic git stash that lint-staged creates as a backup (by default). The console output also displays the short git hash of the stash so that it's easier to recover lost files in case some fatal errors are encountered, or the process is killed before completing.
For example:
% npx lint-staged
✔ Backed up original state in git stash (20addf8)
✔ Running tasks for staged files...
✔ Applying modifications from tasks...
✔ Cleaning up temporary files...
where the backup can be seen with git show 20addf8, or git stash list:
% git stash list
stash@{0}: lint-staged automatic backup (20addf8)
### Patch Changes - #1484 `bcfe309` Thanks @wormsik! - Escape paths containing spaces when using the "shell" option. - #1487 `7dd8caa` Thanks @iiroj!
### Patch Changes - #1471 `e3f283b` Thanks @iiroj! - Update minor dependencies, including micromatch@~4.0.8.
### Patch Changes - #1463 `b69ce2d` Thanks @iiroj! - Set the maximum number of event listeners to the number of tasks. This should silence the console
`f0480f0` Thanks @iiroj! - In the previous version the native git rev-parse --show-toplevel command was taken into use for resolving the current git r
f0480f0 Thanks @iiroj! - In the previous version the native git rev-parse --show-toplevel command was taken into use for resolving the current git repo root. This version switched the --show-toplevel flag with --show-cdup, because on Git installed via MSYS2 the former was returning absolute paths that do not work with Node.js child_process. The new flag returns a path relative to the working directory, avoiding the issue.
The GitHub Actions workflow has been updated to install Git via MSYS2, to ensure better future compatibility; using the default Git binary in the GitHub Actions runner was working correctly even with MSYS2.
### Patch Changes - #1440 `a51be80` Thanks @iiroj! - In the previous version the native git rev-parse --show-toplevel command was taken into use for r
a51be80 Thanks @iiroj! - In the previous version the native git rev-parse --show-toplevel command was taken into use for resolving the current git repo root. This version drops the --path-format=absolute option to support earlier git versions since it's also the default behavior. If you are still having trouble, please try upgrading git to the latest version.### Patch Changes - #1433 `119adb2` Thanks @iiroj! - Use native "git rev-parse" commands to determine git repo root directory and the .git config dire
### Patch Changes - #1424 `31a1f95` Thanks @iiroj! - Allow approximately equivalent versions of direct dependencies by using the "~" character in the
#1424 31a1f95 Thanks @iiroj! - Allow approximately equivalent versions of direct dependencies by using the "~" character in the version ranges. This means a more recent patch version of a dependency is allowed if available.
#1423 91abea0 Thanks @iiroj! - Improve error logging when failing to read or parse a configuration file
`4f4537a` Thanks @iiroj! - Fix release issue with previous version; update dependencies
### Patch Changes - #1391 `fdcdad4` Thanks @iiroj! - _Lint-staged_ no longer tries to load configuration from files that are not checked out. This mig
### Patch Changes - #1387 `e4023f6` Thanks @iiroj! - Ignore stdin of spawned commands so that they don't get stuck waiting. Until now, _lint-staged_ h
e4023f6 Thanks @iiroj! - Ignore stdin of spawned commands so that they don't get stuck waiting. Until now, lint-staged has used the default settings to spawn linter commands. This means the stdin of the spawned commands has accepted input, and essentially gotten stuck waiting. Now the stdin is ignored and commands will no longer get stuck. If you relied on this behavior, please open a new issue and describe how; the behavior has not been intended.### Minor Changes - #1371 `f3378be` Thanks @iiroj! - Using the --no-stash flag no longer discards all unstaged changes to partially staged files, whic
f3378be Thanks @iiroj! - Using the --no-stash flag no longer discards all unstaged changes to partially staged files, which resulted in inadvertent data loss. This fix is available with a new flag --no-hide-partially-staged that is automatically enabled when --no-stash is used.#1368 777d4e9 Thanks @iiroj! - To improve performance, only use lilconfig when searching for config files outside the git repo. In the regular case, lint-staged finds the config files from the Git index and loads them directly.
#1373 85eb0dd Thanks @iiroj! - When determining git directory, use fs.realpath() only for symlinks. It looks like fs.realpath() changes some Windows mapped network filepaths unexpectedly, causing issues.
### Minor Changes - #1344 `0423311` Thanks @danielbayley! - Add support for loading configuration from package.yaml and package.yml files, supported b
### Patch Changes - #1339 `8e82364` Thanks @iiroj! - Update dependencies, including listr2@7.0.2 to fix an upstream issue affecting lint-staged.
Your coding agent can read these notes before it upgrades. Set up the MCP server →