Skip to content

Commit fb540fb

Browse files
authored
Merge pull request #1824 from lint-staged/changeset-release/main
πŸ¦‹ Changeset release
2 parents 60cbb88 + dc0a738 commit fb540fb

4 files changed

Lines changed: 42 additions & 39 deletions

File tree

β€Ž.changeset/better-loops-cheat.mdβ€Ž

Lines changed: 0 additions & 28 deletions
This file was deleted.

β€ŽCHANGELOG.mdβ€Ž

Lines changed: 39 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,34 @@
11
# lint-staged
22

3+
## 17.2.0
4+
5+
### Minor Changes
6+
7+
- [#1823](https://github.com/lint-staged/lint-staged/pull/1823) [`ee156cc`](https://github.com/lint-staged/lint-staged/commit/ee156cc7039494f1db11f389b1233c78f588238c) - 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:
8+
9+
```js
10+
/** @type {import('lint-staged').Configuration} */
11+
export default {
12+
"*.ts": () => "tsc", // Run "tsc" when any TS file is changed (for entire project)
13+
};
14+
```
15+
16+
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.
17+
18+
Also, native JavaScript/Node.js function tasks won't be chunked at all, when previously they were run multiple times when chunked:
19+
20+
```js
21+
/** @type {import('lint-staged').Configuration} */
22+
export default {
23+
"*.js": {
24+
title: "Log staged JS files to console",
25+
task: async (files) => {
26+
console.log("Staged JS files:", files);
27+
},
28+
},
29+
};
30+
```
31+
332
## 17.1.1
433

534
### Patch Changes
@@ -395,7 +424,7 @@
395424
If you were using the shell option to avoid passing filenames to tasks, for example `bash -c 'tsc --noEmit'`, use the function syntax instead:
396425

397426
```js
398-
export default { '*.ts': () => 'tsc --noEmit' }
427+
export default { "*.ts": () => "tsc --noEmit" };
399428
```
400429

401430
- [#1546](https://github.com/lint-staged/lint-staged/pull/1546) [`158d15c`](https://github.com/lint-staged/lint-staged/commit/158d15c9aea0a3a87790ec3766442763cf387dba) Thanks [@iiroj](https://github.com/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.
@@ -408,13 +437,13 @@
408437

409438
```js
410439
export default {
411-
'*.js': {
412-
title: 'My task',
440+
"*.js": {
441+
title: "My task",
413442
task: async (files) => {
414-
console.log('Staged JS files:', files)
443+
console.log("Staged JS files:", files);
415444
},
416445
},
417-
}
446+
};
418447
```
419448

420449
_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.
@@ -446,13 +475,15 @@
446475
By default Prettier [prefers double quotes](https://prettier.io/docs/rationale#strings).
447476

448477
#### Previously
478+
449479
1. Stage `file.js` with only double quotes `"` changed to `'`
450480
1. Run `git commit -am "I don't like double quotes"`
451481
1. _Lint-staged_ runs `prettier --write file.js`, converting all the `'` back to `"`
452482
1. Because there are now no changes, _lint-staged_ fails, cancels the commit, and resets back to the original state
453483
1. Commit was not done, original state is restored and single quotes `'` are staged
454484

455485
#### Now
486+
456487
1. Stage `file.js` with only double-quotes `"` changed to `'`
457488
1. Run `git commit -am "I don't like double quotes"`
458489
1. _Lint-staged_ runs `prettier --write file.js`, converting all the `'` back to `"`
@@ -491,8 +522,8 @@
491522
* @type {import('lint-staged').Configuration}
492523
*/
493524
export default {
494-
'*': 'prettier --write',
495-
}
525+
"*": "prettier --write",
526+
};
496527
```
497528

498529
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](https://github.com/nodejs/node/releases/tag/v22.6.0) and unflagged in [v23.6.0](https://github.com/nodejs/node/releases/tag/v23.6.0), enabling Node.js to execute TypeScript files without additional configuration.
@@ -984,7 +1015,7 @@ To update your Node.js integration, please use:
9841015

9851016
```js
9861017
// const lintStaged = require('lint-staged')
987-
import lintStaged from 'lint-staged'
1018+
import lintStaged from "lint-staged";
9881019
```
9891020

9901021
## [v11.3.0-beta.2](https://github.com/lint-staged/lint-staged/releases/tag/v11.3.0-beta.2) - 30 Oct 2021

β€Žpackage-lock.jsonβ€Ž

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

β€Žpackage.jsonβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "lint-staged",
3-
"version": "17.1.1",
3+
"version": "17.2.0",
44
"description": "Lint files staged by git",
55
"license": "MIT",
66
"repository": {

0 commit comments

Comments
Β (0)