For version lint-staged@16.0.0 the lowest supported Node.js version is 20.19.0, following requirements of nano-spawn. Please upgrade your Node.js version.
For version lint-staged@16.1.0 this is lowered to 20.17.0, again following nano-spawn.
Advanced configuration options (removed in v9) are no longer validated separately, and might be treated as valid globs for tasks. Please do not try to use advanced config options anymore, they haven't been supported since v8.
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' }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"
}- Since
v15.0.0lint-staged no longer supports Node.js 16. Please upgrade your Node.js version to at least18.12.0.
- Since
v14.0.0lint-staged no longer supports Node.js 14. Please upgrade your Node.js version to at least16.14.0.
- Since
v13.0.0lint-staged no longer supports Node.js 12. Please upgrade your Node.js version to at least14.13.1, or16.0.0onward. - Version
v13.3.0was incorrectly released including code of versionv14.0.0. This means the breaking changes ofv14are also included inv13.3.0, the lastv13version released
- Since
v12.0.0lint-staged is a pure ESM module, so make sure your Node.js version is at least12.20.0,14.13.1, or16.0.0. Read more about ESM modules from the official Node.js Documentation site here.
- From
v10.0.0onwards any new modifications to originally staged files will be automatically added to the commit. If your task previously contained agit addstep, please remove this. The automatic behaviour ensures there are less race-conditions, since trying to run multiple git operations at the same time usually results in an error. - From
v10.0.0onwards, lint-staged uses git stashes to improve speed and provide backups while running. Since git stashes require at least an initial commit, you shouldn't run lint-staged in an empty repo. - From
v10.0.0onwards, lint-staged requires Node.js version 10.13.0 or later. - From
v10.0.0onwards, lint-staged will abort the commit if linter tasks undo all staged changes. To allow creating an empty commit, please use the--allow-emptyoption.