Skip to content

Releases: lint-staged/lint-staged

v17.3.0

Choose a tag to compare

@github-actions github-actions released this 31 Jul 08:41
Immutable release. Only release title and notes can be modified.
d153443

Minor Changes

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

    1. for all staged files, run the two commands in parallel with staged filenames appended, for example:
      • oxfmt --check --no-error-on-unmatched-pattern lib/index.js
      • oxlint --no-error-on-unmatched-pattern lib/index.js
    2. additionally, if any *.ts files are staged, run tsc without appending any arguments
    3. The two sets of commands also run in parallel

Patch Changes

  • #1829 15f7e53 - During an in-progress merge, files that are unchanged from the branch being merged are now skipped. Technically, files are only included if there are staged changes against both HEAD and MERGE_HEAD.

v17.2.0

Choose a tag to compare

@github-actions github-actions released this 23 Jul 09:48
Immutable release. Only release title and notes can be modified.
fb540fb

Minor Changes

  • #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);
        },
      },
    };

v17.1.1

Choose a tag to compare

@github-actions github-actions released this 22 Jul 06:06
Immutable release. Only release title and notes can be modified.
dbc7831

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 staged files. The parsing and validation of the numeric CLI options --max-arg-length and --concurrency has been improved.

v17.1.0

Choose a tag to compare

@github-actions github-actions released this 18 Jul 13:47
Immutable release. Only release title and notes can be modified.
dd5a95f

Minor Changes

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

Patch Changes

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

v17.0.8

Choose a tag to compare

@github-actions github-actions released this 20 Jun 19:36
Immutable release. Only release title and notes can be modified.
5f3b8f2

Patch Changes

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

v17.0.7

Choose a tag to compare

@github-actions github-actions released this 31 May 10:48
Immutable release. Only release title and notes can be modified.
cd11fec

Patch Changes

v17.0.6

Choose a tag to compare

@github-actions github-actions released this 30 May 10:45
Immutable release. Only release title and notes can be modified.
094ba56

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

v17.0.5

Choose a tag to compare

@github-actions github-actions released this 16 May 11:05
Immutable release. Only release title and notes can be modified.
cbd822e

Patch Changes

  • #1792 1f67271 - Correctly set the --max-arg-length default value based on the running platform. This controls how very long lists of staged files are split into multiple chunks.

v17.0.4

Choose a tag to compare

@github-actions github-actions released this 09 May 19:45
Immutable release. Only release title and notes can be modified.
2862964

Patch Changes

  • #1788 f95c1f8 - Another fix for making sure lint-staged adds task modifications correctly to the commit in the following cases:

    • after editing <file> it is staged with git add <file>, and then committed with git commit
    • after editing <file> it is committed with git commit --all without explicit git add
    • after editing <file> it is committed with git commit <pathspec> without explicit git add

    There'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.

v17.0.3

Choose a tag to compare

@github-actions github-actions released this 08 May 14:08
Immutable release. Only release title and notes can be modified.
a36ec1e

Patch Changes

  • #1782 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 files
    • git commit -m "my commit message" . where . is an example of a pathspec where matching files will be staged