Skip to content

Releases: lint-staged/lint-staged

v16.1.2

15 Jun 10:07
Compare
Choose a tag to compare

Patch Changes

  • #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.

v16.1.1

14 Jun 08:29
Compare
Choose a tag to compare

Patch Changes

  • #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.

v16.1.0

27 May 17:32
Compare
Choose a tag to compare

Minor Changes

  • #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.

Patch Changes

v16.0.0

10 May 17:23
Compare
Choose a tag to compare

Major Changes

  • #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.

Minor Changes

  • #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.

v15.5.2

06 May 10:11
Compare
Choose a tag to compare

Patch Changes

v15.5.1

11 Apr 17:08
Compare
Choose a tag to compare

Patch Changes

  • #1533 5d53534 Thanks @iiroj! - Improve listing of staged files so that lint-staged doesn't crash when encountering an uninitialized submodule. This should result in less errors like:

    ✖ Failed to get staged files!
    

v15.5.0

12 Mar 14:51
Compare
Choose a tag to compare

Minor Changes

  • #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.

    Example with Prettier

    By default Prettier prefers double quotes.

    Previously

    1. Stage file.js with only double quotes " changed to '
    2. Run git commit -am "I don't like double quotes"
    3. Lint-staged runs prettier --write file.js, converting all the ' back to "
    4. Because there are now no changes, lint-staged fails, cancels the commit, and resets back to the original state
    5. Commit was not done, original state is restored and single quotes ' are staged

    Now

    1. Stage file.js with only double-quotes " changed to '
    2. Run git commit -am "I don't like double quotes"
    3. Lint-staged runs prettier --write file.js, converting all the ' back to "
    4. Because there are now no changes, lint-staged fails and cancels the commit
    5. Commit was not done, and there are no staged changes

v15.4.3

26 Jan 14:19
Compare
Choose a tag to compare

Patch Changes

  • #1512 cbfed1d Thanks @tarik02! - Adjust TypeScript types for the default export so that it can be used as a value without error TS2693.

v15.4.2

23 Jan 11:21
aef9e5c
Compare
Choose a tag to compare

Patch Changes

  • #1509 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.

v15.4.1

16 Jan 18:03
1c93c9e
Compare
Choose a tag to compare

Patch Changes

  • #1504 1c7a45e Thanks @iiroj! - Default TypeScript config filenames match JS equivalents.

  • #1504 9cc18c9 Thanks @iiroj! - Add missing conditional exports syntax for TypeScript types.