|
395 | 395 | If you were using the shell option to avoid passing filenames to tasks, for example `bash -c 'tsc --noEmit'`, use the function syntax instead: |
396 | 396 |
|
397 | 397 | ```js |
398 | | - export default { "*.ts": () => "tsc --noEmit" }; |
| 398 | + export default { '*.ts': () => 'tsc --noEmit' } |
399 | 399 | ``` |
400 | 400 |
|
401 | 401 | - [#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 | 408 |
|
409 | 409 | ```js |
410 | 410 | export default { |
411 | | - "*.js": { |
412 | | - title: "My task", |
| 411 | + '*.js': { |
| 412 | + title: 'My task', |
413 | 413 | task: async (files) => { |
414 | | - console.log("Staged JS files:", files); |
| 414 | + console.log('Staged JS files:', files) |
415 | 415 | }, |
416 | 416 | }, |
417 | | - }; |
| 417 | + } |
418 | 418 | ``` |
419 | 419 |
|
420 | 420 | _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 | 446 | By default Prettier [prefers double quotes](https://prettier.io/docs/rationale#strings). |
447 | 447 |
|
448 | 448 | #### Previously |
449 | | - |
450 | 449 | 1. Stage `file.js` with only double quotes `"` changed to `'` |
451 | 450 | 1. Run `git commit -am "I don't like double quotes"` |
452 | 451 | 1. _Lint-staged_ runs `prettier --write file.js`, converting all the `'` back to `"` |
453 | 452 | 1. Because there are now no changes, _lint-staged_ fails, cancels the commit, and resets back to the original state |
454 | 453 | 1. Commit was not done, original state is restored and single quotes `'` are staged |
455 | 454 |
|
456 | 455 | #### Now |
457 | | - |
458 | 456 | 1. Stage `file.js` with only double-quotes `"` changed to `'` |
459 | 457 | 1. Run `git commit -am "I don't like double quotes"` |
460 | 458 | 1. _Lint-staged_ runs `prettier --write file.js`, converting all the `'` back to `"` |
|
493 | 491 | * @type {import('lint-staged').Configuration} |
494 | 492 | */ |
495 | 493 | export default { |
496 | | - "*": "prettier --write", |
497 | | - }; |
| 494 | + '*': 'prettier --write', |
| 495 | + } |
498 | 496 | ``` |
499 | 497 |
|
500 | 498 | 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. |
@@ -986,7 +984,7 @@ To update your Node.js integration, please use: |
986 | 984 |
|
987 | 985 | ```js |
988 | 986 | // const lintStaged = require('lint-staged') |
989 | | -import lintStaged from "lint-staged"; |
| 987 | +import lintStaged from 'lint-staged' |
990 | 988 | ``` |
991 | 989 |
|
992 | 990 | ## [v11.3.0-beta.2](https://github.com/lint-staged/lint-staged/releases/tag/v11.3.0-beta.2) - 30 Oct 2021 |
|
0 commit comments