lint-staged
Advanced tools
Comparing version 13.1.0 to 13.1.1
@@ -80,3 +80,4 @@ /** @typedef {import('./index').Logger} Logger */ | ||
shell = false, | ||
stash = true, | ||
// Stashing should be disabled by default when the `diff` option is used | ||
stash = diff === undefined, | ||
verbose = false, | ||
@@ -108,5 +109,5 @@ }, | ||
// Lint-staged should create a backup stash only when there's an initial commit, | ||
// and when using the default list of staged files | ||
ctx.shouldBackup = hasInitialCommit && stash && diff === undefined | ||
// Lint-staged will create a backup stash only when there's an initial commit, | ||
// and when using the default list of staged files by default | ||
ctx.shouldBackup = hasInitialCommit && stash | ||
if (!ctx.shouldBackup) { | ||
@@ -113,0 +114,0 @@ logger.warn(skippingBackup(hasInitialCommit, diff)) |
{ | ||
"name": "lint-staged", | ||
"version": "13.1.0", | ||
"version": "13.1.1", | ||
"description": "Lint files staged by git", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -45,3 +45,3 @@ # 🚫💩 lint-staged ![GitHub Actions](https://github.com/okonet/lint-staged/workflows/CI/badge.svg) [![npm version](https://badge.fury.io/js/lint-staged.svg)](https://badge.fury.io/js/lint-staged) [![Codecov](https://codecov.io/gh/okonet/lint-staged/branch/master/graph/badge.svg)](https://codecov.io/gh/okonet/lint-staged) | ||
- [SurviveJS interview - Juho Vepsäläinen and Andrey Okonetchnikov, 2018](https://survivejs.com/blog/lint-staged-interview/) | ||
- [Prettier your CSharp with `dotnet-format` and `lint-staged`](https://blog.johnnyreilly.com/2020/12/prettier-your-csharp-with-dotnet-format-and-lint-staged.html) | ||
- [Prettier your CSharp with `dotnet-format` and `lint-staged`](https://johnnyreilly.com/2020/12/22/prettier-your-csharp-with-dotnet-format-and-lint-staged) | ||
@@ -131,6 +131,6 @@ > If you've written one, please submit a PR with the link to it! | ||
- uses [`verbose` renderer](https://github.com/SamVerschueren/listr-verbose-renderer) for `listr`; this causes serial, uncoloured output to the terminal, instead of the default (beautified, dynamic) output. | ||
- **`--diff`**: By default linters are filtered against all files staged in git, generated from `git diff --staged`. This option allows you to override the `--staged` flag with arbitrary revisions. For example to get a list of changed files between two branches, use `--diff="branch1...branch2"`. You can also read more from about [git diff](https://git-scm.com/docs/git-diff) and [gitrevisions](https://git-scm.com/docs/gitrevisions). | ||
- **`--diff`**: By default linters are filtered against all files staged in git, generated from `git diff --staged`. This option allows you to override the `--staged` flag with arbitrary revisions. For example to get a list of changed files between two branches, use `--diff="branch1...branch2"`. You can also read more from about [git diff](https://git-scm.com/docs/git-diff) and [gitrevisions](https://git-scm.com/docs/gitrevisions). This option also implies `--no-stash`. | ||
- **`--diff-filter`**: By default only files that are _added_, _copied_, _modified_, or _renamed_ are included. Use this flag to override the default `ACMR` value with something else: _added_ (`A`), _copied_ (`C`), _deleted_ (`D`), _modified_ (`M`), _renamed_ (`R`), _type changed_ (`T`), _unmerged_ (`U`), _unknown_ (`X`), or _pairing broken_ (`B`). See also the `git diff` docs for [--diff-filter](https://git-scm.com/docs/git-diff#Documentation/git-diff.txt---diff-filterACDMRTUXB82308203). | ||
- **`--max-arg-length`**: long commands (a lot of files) are automatically split into multiple chunks when it detects the current shell cannot handle them. Use this flag to override the maximum length of the generated command string. | ||
- **`--no-stash`**: By default a backup stash will be created before running the tasks, and all task modifications will be reverted in case of an error. This option will disable creating the stash, and instead leave all modifications in the index when aborting the commit. | ||
- **`--no-stash`**: By default a backup stash will be created before running the tasks, and all task modifications will be reverted in case of an error. This option will disable creating the stash, and instead leave all modifications in the index when aborting the commit. Can be re-enabled with `--stash` | ||
- **`--quiet`**: Supress all CLI output, except from tasks. | ||
@@ -616,2 +616,25 @@ - **`--relative`**: Pass filepaths relative to `process.cwd()` (where `lint-staged` runs) to tasks. Default is `false`. | ||
### Integrate with Next.js | ||
<details> | ||
<summary>Click to expand</summary> | ||
```js | ||
// .lintstagedrc.js | ||
// See https://nextjs.org/docs/basic-features/eslint#lint-staged for details | ||
const path = require('path') | ||
const buildEslintCommand = (filenames) => | ||
`next lint --fix --file ${filenames | ||
.map((f) => path.relative(process.cwd(), f)) | ||
.join(' --file ')}` | ||
module.exports = { | ||
'*.{js,jsx,ts,tsx}': [buildEslintCommand], | ||
} | ||
``` | ||
</details> | ||
## Frequently Asked Questions | ||
@@ -618,0 +641,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
111276
1887
907