Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[13.0.0] excessive output when invoked through pre-commit script #1164

Closed
wKovacs64 opened this issue Jun 1, 2022 · 52 comments · Fixed by #1265
Closed

[13.0.0] excessive output when invoked through pre-commit script #1164

wKovacs64 opened this issue Jun 1, 2022 · 52 comments · Fixed by #1265

Comments

@wKovacs64
Copy link

Description

Not sure if this is a bug, but lint-staged v13.0.0 sure is chatty. :) Running npx lint-staged (not through a husky pre-commit script) seems to yield the expected output, though. See both examples below.

Steps to reproduce

  1. Install lint-staged 13.0.0
  2. Add files and commit
  3. Observe output
Expand to view output when invoked through husky
◼ Preparing lint-staged...
◼ Preparing lint-staged...
◼ Running tasks for staged files...
◼ Preparing lint-staged...
◼ Running tasks for staged files...
◼ Applying modifications from tasks...
◼ Preparing lint-staged...
◼ Running tasks for staged files...
◼ Applying modifications from tasks...
◼ Cleaning up temporary files...
⠋ Preparing lint-staged...
◼ Running tasks for staged files...
◼ Applying modifications from tasks...
◼ Cleaning up temporary files...
⠙ Preparing lint-staged...
◼ Running tasks for staged files...
◼ Applying modifications from tasks...
◼ Cleaning up temporary files...
✔ Preparing lint-staged...
◼ Running tasks for staged files...
◼ Applying modifications from tasks...
◼ Cleaning up temporary files...
✔ Preparing lint-staged...
⠙ Running tasks for staged files...
◼ Applying modifications from tasks...
◼ Cleaning up temporary files...
✔ Preparing lint-staged...
❯ Running tasks for staged files...
◼ Applying modifications from tasks...
◼ Cleaning up temporary files...
✔ Preparing lint-staged...
❯ Running tasks for staged files...
  ◼ lint-staged.config.js — 2 files
◼ Applying modifications from tasks...
◼ Cleaning up temporary files...
✔ Preparing lint-staged...
❯ Running tasks for staged files...
  ⠙ lint-staged.config.js — 2 files
◼ Applying modifications from tasks...
◼ Cleaning up temporary files...
✔ Preparing lint-staged...
❯ Running tasks for staged files...
  ❯ lint-staged.config.js — 2 files
◼ Applying modifications from tasks...
◼ Cleaning up temporary files...
✔ Preparing lint-staged...
❯ Running tasks for staged files...
  ❯ lint-staged.config.js — 2 files
    ◼ *.{js,jsx,ts,tsx} — 0 file
◼ Applying modifications from tasks...
◼ Cleaning up temporary files...
✔ Preparing lint-staged...
❯ Running tasks for staged files...
  ❯ lint-staged.config.js — 2 files
    ◼ *.{js,jsx,ts,tsx} — 0 file
    ◼ *.{html,css,json,md,mdx,yml,yaml} — 2 files
◼ Applying modifications from tasks...
◼ Cleaning up temporary files...
✔ Preparing lint-staged...
❯ Running tasks for staged files...
  ❯ lint-staged.config.js — 2 files
    ⠙ *.{js,jsx,ts,tsx} — 0 file
    ◼ *.{html,css,json,md,mdx,yml,yaml} — 2 files
◼ Applying modifications from tasks...
◼ Cleaning up temporary files...
✔ Preparing lint-staged...
❯ Running tasks for staged files...
  ❯ lint-staged.config.js — 2 files
    ⠙ *.{js,jsx,ts,tsx} — 0 file
    ⠙ *.{html,css,json,md,mdx,yml,yaml} — 2 files
◼ Applying modifications from tasks...
◼ Cleaning up temporary files...
✔ Preparing lint-staged...
❯ Running tasks for staged files...
  ❯ lint-staged.config.js — 2 files
    ↓ *.{js,jsx,ts,tsx} — no files [SKIPPED]
    ⠙ *.{html,css,json,md,mdx,yml,yaml} — 2 files
◼ Applying modifications from tasks...
◼ Cleaning up temporary files...
✔ Preparing lint-staged...
❯ Running tasks for staged files...
  ❯ lint-staged.config.js — 2 files
    ↓ *.{js,jsx,ts,tsx} — no files [SKIPPED]
    ❯ *.{html,css,json,md,mdx,yml,yaml} — 2 files
◼ Applying modifications from tasks...
◼ Cleaning up temporary files...
✔ Preparing lint-staged...
❯ Running tasks for staged files...
  ❯ lint-staged.config.js — 2 files
    ↓ *.{js,jsx,ts,tsx} — no files [SKIPPED]
    ❯ *.{html,css,json,md,mdx,yml,yaml} — 2 files
      ◼ prettier --write
◼ Applying modifications from tasks...
◼ Cleaning up temporary files...
✔ Preparing lint-staged...
❯ Running tasks for staged files...
  ❯ lint-staged.config.js — 2 files
    ↓ *.{js,jsx,ts,tsx} — no files [SKIPPED]
    ❯ *.{html,css,json,md,mdx,yml,yaml} — 2 files
      ⠙ prettier --write
◼ Applying modifications from tasks...
◼ Cleaning up temporary files...
✔ Preparing lint-staged...
❯ Running tasks for staged files...
  ❯ lint-staged.config.js — 2 files
    ↓ *.{js,jsx,ts,tsx} — no files [SKIPPED]
    ❯ *.{html,css,json,md,mdx,yml,yaml} — 2 files
      ⠹ prettier --write
◼ Applying modifications from tasks...
◼ Cleaning up temporary files...
✔ Preparing lint-staged...
❯ Running tasks for staged files...
  ❯ lint-staged.config.js — 2 files
    ↓ *.{js,jsx,ts,tsx} — no files [SKIPPED]
    ❯ *.{html,css,json,md,mdx,yml,yaml} — 2 files
      ⠸ prettier --write
◼ Applying modifications from tasks...
◼ Cleaning up temporary files...
✔ Preparing lint-staged...
❯ Running tasks for staged files...
  ❯ lint-staged.config.js — 2 files
    ↓ *.{js,jsx,ts,tsx} — no files [SKIPPED]
    ❯ *.{html,css,json,md,mdx,yml,yaml} — 2 files
      ⠼ prettier --write
◼ Applying modifications from tasks...
◼ Cleaning up temporary files...
✔ Preparing lint-staged...
❯ Running tasks for staged files...
  ❯ lint-staged.config.js — 2 files
    ↓ *.{js,jsx,ts,tsx} — no files [SKIPPED]
    ❯ *.{html,css,json,md,mdx,yml,yaml} — 2 files
      ⠴ prettier --write
◼ Applying modifications from tasks...
◼ Cleaning up temporary files...
✔ Preparing lint-staged...
❯ Running tasks for staged files...
  ❯ lint-staged.config.js — 2 files
    ↓ *.{js,jsx,ts,tsx} — no files [SKIPPED]
    ❯ *.{html,css,json,md,mdx,yml,yaml} — 2 files
      ⠦ prettier --write
◼ Applying modifications from tasks...
◼ Cleaning up temporary files...
✔ Preparing lint-staged...
❯ Running tasks for staged files...
  ❯ lint-staged.config.js — 2 files
    ↓ *.{js,jsx,ts,tsx} — no files [SKIPPED]
    ❯ *.{html,css,json,md,mdx,yml,yaml} — 2 files
      ✔ prettier --write
◼ Applying modifications from tasks...
◼ Cleaning up temporary files...
✔ Preparing lint-staged...
❯ Running tasks for staged files...
  ❯ lint-staged.config.js — 2 files
    ↓ *.{js,jsx,ts,tsx} — no files [SKIPPED]
    ✔ *.{html,css,json,md,mdx,yml,yaml} — 2 files
◼ Applying modifications from tasks...
◼ Cleaning up temporary files...
✔ Preparing lint-staged...
❯ Running tasks for staged files...
  ✔ lint-staged.config.js — 2 files
◼ Applying modifications from tasks...
◼ Cleaning up temporary files...
✔ Preparing lint-staged...
✔ Running tasks for staged files...
◼ Applying modifications from tasks...
◼ Cleaning up temporary files...
✔ Preparing lint-staged...
✔ Running tasks for staged files...
⠦ Applying modifications from tasks...
◼ Cleaning up temporary files...
✔ Preparing lint-staged...
✔ Running tasks for staged files...
✔ Applying modifications from tasks...
◼ Cleaning up temporary files...
✔ Preparing lint-staged...
✔ Running tasks for staged files...
✔ Applying modifications from tasks...
⠦ Cleaning up temporary files...
✔ Preparing lint-staged...
✔ Running tasks for staged files...
✔ Applying modifications from tasks...
⠧ Cleaning up temporary files...
✔ Preparing lint-staged...
✔ Running tasks for staged files...
✔ Applying modifications from tasks...
✔ Cleaning up temporary files...
✔ Preparing lint-staged...
✔ Running tasks for staged files...
✔ Applying modifications from tasks...
✔ Cleaning up temporary files...
[lint-staged-13 c25c260f] chore(deps): update lint-staged to v13
Expand to view output when invoked directly (no husky)
✔ Preparing lint-staged...
✔ Running tasks for staged files...
✔ Applying modifications from tasks...
✔ Cleaning up temporary files...

Debug Logs

expand to view
  lint-staged:bin Options parsed from command-line: {
  allowEmpty: false,
  concurrent: true,
  configPath: undefined,
  cwd: undefined,
  debug: true,
  diff: undefined,
  diffFilter: undefined,
  maxArgLength: undefined,
  quiet: false,
  relative: false,
  shell: false,
  stash: true,
  verbose: false
} +0ms
  lint-staged:validateOptions Validating options... +0ms
  lint-staged:validateOptions Validated options! +0ms
  lint-staged Unset GIT_LITERAL_PATHSPECS (was `undefined`) +0ms
  lint-staged:runAll Running all linter scripts... +0ms
  lint-staged:runAll Using working directory `C:\dev\node\booleanize` +0ms
  lint-staged:resolveGitRepo Resolving git repo from `C:\dev\node\booleanize` +0ms
  lint-staged:resolveGitRepo Unset GIT_DIR (was `undefined`) +0ms
  lint-staged:resolveGitRepo Unset GIT_WORK_TREE (was `undefined`) +0ms
  lint-staged:execGit Running git command [ 'rev-parse', '--show-prefix' ] +0ms
  lint-staged:resolveGitRepo Resolved git directory to be `C:/dev/node/booleanize` +57ms
  lint-staged:resolveGitRepo Resolved git config directory to be `C:/dev/node/booleanize/.git` +0ms
  lint-staged:execGit Running git command [ 'log', '-1' ] +56ms
  lint-staged:execGit Running git command [ 'diff', '--name-only', '-z', '--diff-filter=ACMR', '--staged' ] +51ms
  lint-staged:runAll Loaded list of staged files in git:
  lint-staged:runAll [
  lint-staged:runAll   'C:/dev/node/booleanize/package-lock.json',
  lint-staged:runAll   'C:/dev/node/booleanize/package.json'
  lint-staged:runAll ] +160ms
  lint-staged:searchConfigs Searching for configuration files... +0ms
  lint-staged:execGit Running git command [ 'ls-files', '-z', '--full-name' ] +53ms
  lint-staged:execGit Running git command [ 'ls-files', '-z', '--full-name', '--others', '--exclude-standard' ] +23ms
  lint-staged:searchConfigs Found possible config files: [
  'C:/dev/node/booleanize/lint-staged.config.js',
  'C:/dev/node/booleanize/package.json'
] +74ms
  lint-staged:loadConfig Loading configuration from `C:/dev/node/booleanize/lint-staged.config.js`... +0ms
  lint-staged:loadConfig Loading configuration from `C:/dev/node/booleanize/package.json`... +0ms
  lint-staged:loadConfig Successfully loaded config from `C:\dev\node\booleanize\lint-staged.config.js`:
  lint-staged:loadConfig {
  lint-staged:loadConfig   '*.{js,jsx,ts,tsx}': [ 'prettier --write', 'eslint --fix' ],
  lint-staged:loadConfig   '*.{html,css,json,md,mdx,yml,yaml}': [ 'prettier --write' ]
  lint-staged:loadConfig } +2ms
  lint-staged:searchConfigs Config file "C:/dev/node/booleanize/lint-staged.config.js" resolved to "C:\dev\node\booleanize\lint-staged.config.js" +3ms
  lint-staged:validateConfig Validating config from `C:\dev\node\booleanize\lint-staged.config.js`... +0ms
  lint-staged:validateConfig Validated config from `C:\dev\node\booleanize\lint-staged.config.js`: +1ms
  lint-staged:validateConfig {
  lint-staged:validateConfig   '*.{js,jsx,ts,tsx}': [ 'prettier --write', 'eslint --fix' ],
  lint-staged:validateConfig   '*.{html,css,json,md,mdx,yml,yaml}': [ 'prettier --write' ]
  lint-staged:validateConfig } +1ms
  lint-staged:loadConfig Successfully loaded config from `C:\dev\node\booleanize\package.json`:
  lint-staged:loadConfig null +2ms
  lint-staged:searchConfigs Found 1 config files +3ms
  lint-staged:groupFilesByConfig Grouping 2 files by 1 configurations +0ms
  lint-staged:chunkFiles Resolved an argument string length of 76 characters from 2 files +0ms
  lint-staged:chunkFiles Creating 1 chunks for maxArgLength of 4095.5 +0ms
  lint-staged:generateTasks Generating linter tasks +0ms
  lint-staged:generateTasks Generated task:
  lint-staged:generateTasks {
  lint-staged:generateTasks   pattern: '*.{js,jsx,ts,tsx}',
  lint-staged:generateTasks   commands: [ 'prettier --write', 'eslint --fix' ],
  lint-staged:generateTasks   fileList: []
  lint-staged:generateTasks } +2ms
  lint-staged:generateTasks Generated task:
  lint-staged:generateTasks {
  lint-staged:generateTasks   pattern: '*.{html,css,json,md,mdx,yml,yaml}',
  lint-staged:generateTasks   commands: [ 'prettier --write' ],
  lint-staged:generateTasks   fileList: [
  lint-staged:generateTasks     'C:/dev/node/booleanize/package-lock.json',
  lint-staged:generateTasks     'C:/dev/node/booleanize/package.json'
  lint-staged:generateTasks   ]
  lint-staged:generateTasks } +1ms
  lint-staged:makeCmdTasks Creating listr tasks for commands [ 'prettier --write', 'eslint --fix' ] +0ms
  lint-staged:resolveTaskFn cmd: prettier +0ms
  lint-staged:resolveTaskFn args: [ '--write' ] +0ms
  lint-staged:resolveTaskFn execaOptions: {
  cwd: 'C:\\dev\\node\\booleanize',
  preferLocal: true,
  reject: false,
  shell: false
} +0ms
  lint-staged:resolveTaskFn cmd: eslint +1ms
  lint-staged:resolveTaskFn args: [ '--fix' ] +0ms
  lint-staged:resolveTaskFn execaOptions: {
  cwd: 'C:\\dev\\node\\booleanize',
  preferLocal: true,
  reject: false,
  shell: false
} +0ms
  lint-staged:makeCmdTasks Creating listr tasks for commands [ 'prettier --write' ] +3ms
  lint-staged:resolveTaskFn cmd: prettier +0ms
  lint-staged:resolveTaskFn args: [ '--write' ] +1ms
  lint-staged:resolveTaskFn execaOptions: {
  cwd: 'C:\\dev\\node\\booleanize',
  preferLocal: true,
  reject: false,
  shell: false
} +0ms
  lint-staged:chunkFiles Resolved an argument string length of 76 characters from 2 files +8ms
  lint-staged:chunkFiles Creating 1 chunks for maxArgLength of 4095.5 +0ms
[STARTED] Preparing lint-staged...
  lint-staged:GitWorkflow Backing up original state... +0ms
  lint-staged:GitWorkflow Getting partially staged files... +0ms
  lint-staged:execGit Running git command [ 'status', '-z' ] +68ms
  lint-staged:GitWorkflow Found partially staged files: [] +54ms
  lint-staged:GitWorkflow Backing up merge state... +1ms
  lint-staged:file Reading file `C:\dev\node\booleanize\.git\MERGE_HEAD` +0ms
  lint-staged:file Reading file `C:\dev\node\booleanize\.git\MERGE_MODE` +0ms
  lint-staged:file Reading file `C:\dev\node\booleanize\.git\MERGE_MSG` +0ms
  lint-staged:file File `C:\dev\node\booleanize\.git\MERGE_HEAD` doesn't exist, ignoring... +0ms
  lint-staged:file File `C:\dev\node\booleanize\.git\MERGE_MODE` doesn't exist, ignoring... +0ms
  lint-staged:file File `C:\dev\node\booleanize\.git\MERGE_MSG` doesn't exist, ignoring... +1ms
  lint-staged:GitWorkflow Done backing up merge state! +1ms
  lint-staged:GitWorkflow Getting deleted files... +0ms
  lint-staged:execGit Running git command [ 'ls-files', '--deleted' ] +55ms
  lint-staged:GitWorkflow Found deleted files: [] +48ms
  lint-staged:execGit Running git command [ 'stash', 'create' ] +48ms
  lint-staged:execGit Running git command [
  'stash',
  'store',
  '--quiet',
  '--message',
  'lint-staged automatic backup',
  '8e320ffdf8dc88afc2ae838a06c4557a81029180'
] +82ms
  lint-staged:GitWorkflow Done backing up original state! +134ms
[SUCCESS] Preparing lint-staged...
[STARTED] Running tasks for staged files...
[STARTED] lint-staged.config.js — 2 files
[STARTED] *.{js,jsx,ts,tsx} — 0 file
[STARTED] *.{html,css,json,md,mdx,yml,yaml} — 2 files
[SKIPPED] *.{js,jsx,ts,tsx} — no files
[STARTED] prettier --write
[SUCCESS] prettier --write
[SUCCESS] *.{html,css,json,md,mdx,yml,yaml} — 2 files
[SUCCESS] lint-staged.config.js — 2 files
[SUCCESS] Running tasks for staged files...
[STARTED] Applying modifications from tasks...
  lint-staged:GitWorkflow Adding task modifications to index... +532ms
  lint-staged:execGit Running git command [
  'add',
  '--',
  'C:/dev/node/booleanize/package-lock.json',
  'C:/dev/node/booleanize/package.json'
] +584ms
  lint-staged:GitWorkflow Done adding task modifications to index! +55ms
  lint-staged:execGit Running git command [ 'diff', '--name-only', '--cached' ] +55ms
[SUCCESS] Applying modifications from tasks...
[STARTED] Cleaning up temporary files...
  lint-staged:GitWorkflow Dropping backup stash... +54ms
  lint-staged:execGit Running git command [ 'stash', 'list' ] +55ms
  lint-staged:execGit Running git command [ 'stash', 'drop', '--quiet', 'refs/stash@{0}' ] +66ms
  lint-staged:GitWorkflow Done dropping backup stash! +140ms
[SUCCESS] Cleaning up temporary files...
  lint-staged Tasks were executed successfully! +1s

Environment

  • OS: Windows 10
  • Node.js: 16.14.2
  • lint-staged: v13.0.0
@iiroj
Copy link
Member

iiroj commented Jun 1, 2022

Looks like listr2 is buggy. Maybe this is a duplicate of #1145

@iiroj
Copy link
Member

iiroj commented Jun 1, 2022

Does adding FORCE_COLOR=1 to your husky script improve it?

@wKovacs64
Copy link
Author

Does adding FORCE_COLOR=1 to your husky script improve it?

Nope.

@iiroj
Copy link
Member

iiroj commented Jun 1, 2022

Just to be clear, running the previous version of lint-staged through Husky doesn't behave in the same way?

V13 dropped support for Node.js 12 but I don't think we did anything else that should directly affect this.

To me it looks like listr2 should be updating the current line with new content, but ends up duplicating instead...

Maybe you can try running this PR locally to see if it helps: #1163. You can pretty much just copy-paste the code into your node_modules/.

@wKovacs64
Copy link
Author

wKovacs64 commented Jun 1, 2022

Confirming that previous version (12.4.0 and 12.5.0 at least) of lint-staged did NOT exhibit this behavior through husky. (Might've held on to an older version of listr2 via lockfile, though?)

Running that PR locally did help, though:

[STARTED] Preparing lint-staged...
[SUCCESS] Preparing lint-staged...
[STARTED] Running tasks for staged files...
[STARTED] lint-staged.config.js — 2 files
[STARTED] *.{js,jsx,ts,tsx} — 0 files
[STARTED] *.{html,css,json,md,mdx,yml,yaml} — 2 files
[SKIPPED] *.{js,jsx,ts,tsx} — no files
[STARTED] prettier --write
[SUCCESS] prettier --write
[SUCCESS] *.{html,css,json,md,mdx,yml,yaml} — 2 files
[SUCCESS] lint-staged.config.js — 2 files
[SUCCESS] Running tasks for staged files...
[STARTED] Applying modifications from tasks...
[SUCCESS] Applying modifications from tasks...
[STARTED] Cleaning up temporary files...
[SUCCESS] Cleaning up temporary files...
[lint-staged-13 163be8d2] chore(deps): update lint-staged to v13

@tupton
Copy link

tupton commented Jun 14, 2022

I'm also seeing what @wKovacs64 lists in the previous comment.

That's still different than the output when lint-staged is not invoked via husky.

It appears that lint-staged falls back to using the verbose listr renderer when invoked via husky for some reason.

Editing my husky pre-commit hook to use FORCE_COLOR=1 did seem to address that, though:

#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

FORCE_COLOR=1 npx lint-staged
❯ git commit
✔ Preparing lint-staged...
✔ Running tasks for staged files...
✔ Applying modifications from tasks...
✔ Cleaning up temporary files...

@NegatiV-64
Copy link

Had the same problem, fixed by setting FORCE_COLOR=0 npx lint-staged in pre-commit file

@theoradicella
Copy link

theoradicella commented Jun 17, 2022

Same problem here, just with windows, any fixes for this? FORCE_COLOR=1 didn't solve it.

@Waqqars987
Copy link

FORCE_COLOR=0

this did not work for me

@theoradicella
Copy link

theoradicella commented Jun 17, 2022

Only by installing version 12.4.1 and setting FORCE_COLOR=0 before lint-staged worked for me... And it stills logs without color in an ugly way. Is there any fix or someone working on this for version 13? this only happens on windows.
When setting FORCE_COLOR=1 on lint-staged@12.4.1 the same error happens. It seems to have something to do listr

@bryanltobing
Copy link

still has this issue in windows os

@iiroj
Copy link
Member

iiroj commented Jun 20, 2022

Can Windows users please to try to help me get this Draft PR #1163 working? I'm not on a Windows machine so I can't really get the Windows-specific TTY handle opened.

@Yiding-Aya
Copy link

Yiding-Aya commented Jun 20, 2022

This is what I get when test Draft PR #1163 on windows and put the js files in node_modules:

forceTTY error:
[Error: ENOENT: no such file or directory, open 'project path\CONOUT$'] {
  errno: -4058,
  code: 'ENOENT',
  syscall: 'open',
  path: 'propject path\\CONOUT$'
}

@cloudyan
Copy link

maybe help you:

this is a regression in git 2.36.0 -- for more info see here: https://twitter.com/pre_commit/status/1516492899306909696

@iiroj
Copy link
Member

iiroj commented Jun 23, 2022

Thank you @cloudyan. I think we should wait for a bit and not try to add any workarounds.

@stevenalbert
Copy link

I got the same result with version 13.0.2 with git version 2.24.0

I also tested line-staged version 12.5.0 with husky and both FORCE_COLOR=0 and FORCE_COLOR=1.

FORCE_COLOR=0 will resulted in no excessive output,
but FORCE_COLOR=1 will have excessive output the same as the report

@sishen654
Copy link

I downgraded to version 9. Although there is no color prompt, it can be output and used normally

@remcohaszing
Copy link

remcohaszing commented Jun 28, 2022

Git 3.17 2.37 was released yesterday and now this issue has gone. :)

@bryanltobing
Copy link

@remcohaszing isn't it 2.37 that was just released? already upgraded to that version but still got the same error.

@remcohaszing
Copy link

Sorry, no idea where that number came from. But yes, I ran into this issue earlier. This morning I updated to git 2.37 and the issue was gone.

@bryanltobing
Copy link

@remcohaszing are you using windows? what version of lint-staged that u used?

@remcohaszing
Copy link

Git: 2.37
OS: Pop!_OS 22.04
lint-staged: 13.0.2
Terminal emulator: Tilix 1.9.4
VTE version: 2.91
TERM environment variable: xterm-256color

I think that pretty much covers it

@dennisjlee
Copy link

Can Windows users please to try to help me get this Draft PR #1163 working? I'm not on a Windows machine so I can't really get the Windows-specific TTY handle opened.

@iiroj I tested your PR on Windows and it looks like you can't open conout$ or CONOUT$ as a regular file on Windows using fs (I get ENOENT: no such file or directory).

Would it make sense to borrow the technique of using node internals (process.binding('fs') from here, or depending on the reopen-tty library as a dependency?

@wKovacs64
Copy link
Author

Just to add a data point: updating git to v2.37.0 had no effect for me.

@iiroj
Copy link
Member

iiroj commented Jun 28, 2022

@dennisjlee thanks! Problem is I don't think I can develop it realistically since I don't run Windows OS. Would really appreciate any help I can get!

@dennisjlee
Copy link

@iiroj I'm happy to try to modify your PR to work on Windows. Should I try that and send it as a new PR, or just send comments on #1163 with suggested edits?

@tonyschwebach
Copy link

tonyschwebach commented Jul 1, 2022

FORCE_COLOR did not work for me using git 2.36 nor git 2.37. The best solution I found was running lint-staged in quite mode.

#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

echo 'running pre-commiting checks...'
npx lint-staged -q

@axmrnv
Copy link

axmrnv commented Jul 7, 2022

There is draft PR #1163, which should fix the problem, mentioned in #1145 (comment).

Until it's merged, you can use this workaround: typicode/husky#968 (comment). It works in both Windows 10 and macOS.

@pfeileon
Copy link

Could it be that this is fixed in git 2.37.0? See the changelog:

  • In Git 2.36 we revamped the way how hooks are invoked. One change
    that is end-user visible is that the output of a hook is no longer
    directly connected to the standard output of "git" that spawns the
    hook, which was noticed post release. This is getting corrected.
    (merge a082345372 ab/hooks-regression-fix later to maint).

git/git@a082345372

Still an issue in git version 2.37.3.

(Btw, I'm not a fan of the workaround mentioned by @axmrnv because it doesn't work in a lot of situations. @tonyschwebach 's solution always works.)

@nikita-reva
Copy link

It also works with "npx lint-staged --debug", if you don't mind the extra output.

@Kallywoo
Copy link

Kallywoo commented Dec 19, 2022

[ON WINDOWS, vscode w/ husky]: Found another temp fix which works for myself / serves me for now as others didn't, thought I'd post in case it helps anybody else and saves some time!

Searched for a while and stumbled across this comment: typicode/husky#968 (comment)

Example:

#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

exec >/dev/console 2>&1;

npx lint-staged

Seems to work just fine as far as I can tell - unsure for other use cases but no repeat logs for each text update on my side. Tested on latest husky & lint-staged versions.

@x-ray-s
Copy link

x-ray-s commented Dec 26, 2022

[ON WINDOWS, vscode w/ husky]: Found another temp fix which works for myself / serves me for now as others didn't, thought I'd post in case it helps anybody else and saves some time!

Searched for a while and stumbled across this comment: typicode/husky#968 (comment)

Example:

#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

exec >/dev/console 2>&1;

npx lint-staged

Seems to work just fine as far as I can tell - unsure for other use cases but no repeat logs for each text update on my side. Tested on latest husky & lint-staged versions.

This help me.

  • Windows 11
  • git version 2.34.1.windows.1
  • lint-staged 13.1.0

Somiona added a commit to Somiona/AoandonBot that referenced this issue Jan 5, 2023
tuomokar pushed a commit to tuomokar/hukka-website that referenced this issue Jan 6, 2023
@mhenke
Copy link

mhenke commented Jan 19, 2023

I thought I had something for Windows 10 with VS Code Terminal, TortoiseGit, Windows Command Terminal, and Git Bash but it failed on TortoiseGit.

image

#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

if sh -c ": >/dev/tty" >/dev/null 2>/dev/null; then
exec >/dev/tty 2>&1
else
exec >/dev/console 2>&1
fi

npx lint-staged

@mhenke
Copy link

mhenke commented Jan 20, 2023

same issue with intellij

14:19:31.867: [106801] git -c credential.helper= -c core.quotepath=false -c log.showSignature=false commit -F C:\Users\igem173\AppData\Local\Temp\1\git-commit-msg-.txt --
.husky/pre-commit: line 7: /dev/console: No such device or address
husky - pre-commit hook exited with code 1 (error)

@mhenke
Copy link

mhenke commented Jan 20, 2023

something like this works but doesn't give the output in TortoiseGit and IntelliJ

#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

if sh -c ": >/dev/tty" >/dev/null 2>/dev/null; then
exec >/dev/tty 2>&1
elif sh -c ": >/dev/console" >/dev/null 2>/dev/null; then
exec >/dev/console 2>&1
elif sh -c ": >/dev/tty0" >/dev/null 2>/dev/null; then
exec >/dev/tty0 2>&1
fi

npx lint-staged

image

@sdsa-cci
Copy link

sdsa-cci commented Jan 23, 2023

I thought I had something for Windows 10 with VS Code Terminal, TortoiseGit, Windows Command Terminal, and Git Bash but it failed on TortoiseGit.

image

#!/usr/bin/env sh . "$(dirname -- "$0")/_/husky.sh"

if sh -c ": >/dev/tty" >/dev/null 2>/dev/null; then exec >/dev/tty 2>&1 else exec >/dev/console 2>&1 fi

npx lint-staged

I faced a similar issue before. This was because the previous merge process had failed due to abrupt closure of terminal. I had to delete the .git/.MERGE_MSG.swp file to get the commits working properly again.

@Snaptags
Copy link

Snaptags commented Feb 6, 2023

We can't really use the
exec >/dev/console 2>&1
fix, because it only works e.g. in PowerShell, but breaks everything on MacOS or using Git Bash. :(

But: when using husky you actually can set the workaround globally on a per-machine basis. So each developer can work around the issue on demand and it's not per repository…

# ~/.huskyrc (that is c:\users\<add your username here>\.huskyrc)
exec >/dev/console 2>&1

Will still not work for people using both Git Bash as well as Powershell though…

@mhenke
Copy link

mhenke commented Feb 21, 2023

Can we have a non-graphical command output like --quiet and it shows only the results. I think the animations is causing the underlying issue?

@clemyan
Copy link

clemyan commented Feb 22, 2023

Environment

OS: Windows 10 Home 22H2 Build 19045.2604
Node: 19.5.0
lint-staged: 13.1.2
Git: git version 2.39.2.windows.1 (Installed via winget / scoop)

Investigation

I am experiencing the same issue and have traced this to git for windows (at least in the two setups I am using, one installed with winget and one with scoop) stripping ANSI escape sequences, causing previous output to not be cleared when it should.

See git-for-windows/git#4308

.git/hooks/pre-commit

#!/bin/sh
printf 'ANSI NOT \x1B[4DWORKING PROPERLY\n'
exit 1

This hooks can test if ANSI escape sequences are being processed properly. For me, ANSI escape sequences works properly when git commit is run from Git Bash, but not when using PowerShell. If you are experiencing excessive output from lint-stage, then your environment/setup is probably not processing ANSI escape sequences correctly (which you can test with the hook above).

Workarounds

Anything that forces the text or verbose renderer (e.g. --debug, FORCE_COLOR=0) will workaround the issue because those do not use ANSI escape sequences.

The exec > /dev/tty workaround also works for me.

@mhenke
Copy link

mhenke commented Feb 22, 2023

@clemyan is this what you wanted? I put the snippet in the pre-commit file for husky.
image

@clemyan
Copy link

clemyan commented Feb 23, 2023

@clemyan is this what you wanted? I put the snippet in the pre-commit file for husky

Oops I didn't word that quite correctly. Are you thinking I want someone do testing for me? What I was saying is that

  • I am also experiencing the original issue (excessive output).
  • I have done some investigation, and found out that git for windows is stripping ANSI in pre-commit hook, which causes the issue.
  • Thus, the issue is external and not directly related to lint-staged.
  • The way I found out / tested / verified ANSI processing is the problematic for me is using that hook script.
  • For anyone experiencing the issue, you can see if ANSI processing is the culprit for your setup.

I have edited my comment above to hopefully make this clear.


FWIW, your setup is not displaying ANSI sequences properly so you would see excessive output. In your setup, probably the best workaround/fix would be to set FORCE_COLOR=0 to force lint-stage to use the text renderer.

@iiroj
Copy link
Member

iiroj commented Mar 5, 2023

Can you try installing lint-staged@next (version 13.1.3) to see if it helps? I restored supports-color in place of colorette's isColorSupported util, a change that was introduced in 13.0.0.

This was linked to pull requests Mar 5, 2023
@artembatura
Copy link

@iiroj Tested 13.1.4 and looks like it working well (windows 10), thanks

@jakubjereczek
Copy link

In 13.1.2 this solution has fixed the issue - #1164 (comment). In 13.1.4 like @artembatura already mentioned above works well.

@damienbutt
Copy link

damienbutt commented Mar 13, 2023

Environment

OS: Windows 11 22H2 Build 22621.1344
Node: 18.15.0
lint-staged: 13.2.0
husky: 8.0.3
Git: 2.39.2.windows.1

This still seems to be an issue for me on Windows. Am I missing something?

Pre-commit hook

#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

yarn lint-staged

Output

Click to expand
◼ Preparing lint-staged...
◼ Preparing lint-staged...
◼ Running tasks for staged files...
◼ Preparing lint-staged...
◼ Running tasks for staged files...
◼ Applying modifications from tasks...
◼ Preparing lint-staged...
◼ Running tasks for staged files...
◼ Applying modifications from tasks...
◼ Cleaning up temporary files...
⠋ Preparing lint-staged...
◼ Running tasks for staged files...
◼ Applying modifications from tasks...
◼ Cleaning up temporary files...
⠙ Preparing lint-staged...
◼ Running tasks for staged files...
◼ Applying modifications from tasks...
◼ Cleaning up temporary files...
⠹ Preparing lint-staged...
◼ Running tasks for staged files...
◼ Applying modifications from tasks...
◼ Cleaning up temporary files...
✔ Preparing lint-staged...
◼ Running tasks for staged files...
◼ Applying modifications from tasks...
◼ Cleaning up temporary files...
✔ Preparing lint-staged...
⠹ Running tasks for staged files...
◼ Applying modifications from tasks...
◼ Cleaning up temporary files...
✔ Preparing lint-staged...
❯ Running tasks for staged files...
◼ Applying modifications from tasks...
◼ Cleaning up temporary files...
✔ Preparing lint-staged...
❯ Running tasks for staged files...
  ◼ .lintstagedrc.json — 1 file
◼ Applying modifications from tasks...
◼ Cleaning up temporary files...
✔ Preparing lint-staged...
❯ Running tasks for staged files...
  ⠹ .lintstagedrc.json — 1 file
◼ Applying modifications from tasks...
◼ Cleaning up temporary files...
✔ Preparing lint-staged...
❯ Running tasks for staged files...
  ❯ .lintstagedrc.json — 1 file
◼ Applying modifications from tasks...
◼ Cleaning up temporary files...
✔ Preparing lint-staged...
❯ Running tasks for staged files...
  ❯ .lintstagedrc.json — 1 file
    ◼ *?(test|spec).{js,jsx,ts,tsx} — 1 file
◼ Applying modifications from tasks...
◼ Cleaning up temporary files...
✔ Preparing lint-staged...
❯ Running tasks for staged files...
  ❯ .lintstagedrc.json — 1 file
    ◼ *?(test|spec).{js,jsx,ts,tsx} — 1 file
    ◼ *.{css,scss,md,html,json,yml,yaml} — 0 files
◼ Applying modifications from tasks...
◼ Cleaning up temporary files...
✔ Preparing lint-staged...
❯ Running tasks for staged files...
  ❯ .lintstagedrc.json — 1 file
    ⠹ *?(test|spec).{js,jsx,ts,tsx} — 1 file
    ◼ *.{css,scss,md,html,json,yml,yaml} — 0 files
◼ Applying modifications from tasks...
◼ Cleaning up temporary files...
✔ Preparing lint-staged...
❯ Running tasks for staged files...
  ❯ .lintstagedrc.json — 1 file
    ⠹ *?(test|spec).{js,jsx,ts,tsx} — 1 file
    ⠹ *.{css,scss,md,html,json,yml,yaml} — 0 files
◼ Applying modifications from tasks...
◼ Cleaning up temporary files...
✔ Preparing lint-staged...
❯ Running tasks for staged files...
  ❯ .lintstagedrc.json — 1 file
    ⠹ *?(test|spec).{js,jsx,ts,tsx} — 1 file
    ↓ *.{css,scss,md,html,json,yml,yaml} — no files [SKIPPED]
◼ Applying modifications from tasks...
◼ Cleaning up temporary files...
✔ Preparing lint-staged...
❯ Running tasks for staged files...
  ❯ .lintstagedrc.json — 1 file
    ❯ *?(test|spec).{js,jsx,ts,tsx} — 1 file
    ↓ *.{css,scss,md,html,json,yml,yaml} — no files [SKIPPED]
◼ Applying modifications from tasks...
◼ Cleaning up temporary files...
✔ Preparing lint-staged...
❯ Running tasks for staged files...
  ❯ .lintstagedrc.json — 1 file
    ❯ *?(test|spec).{js,jsx,ts,tsx} — 1 file
      ◼ yarn lint:fix
    ↓ *.{css,scss,md,html,json,yml,yaml} — no files [SKIPPED]
◼ Applying modifications from tasks...
◼ Cleaning up temporary files...
✔ Preparing lint-staged...
❯ Running tasks for staged files...
  ❯ .lintstagedrc.json — 1 file
    ❯ *?(test|spec).{js,jsx,ts,tsx} — 1 file
      ◼ yarn lint:fix
      ◼ yarn pretty:fix
    ↓ *.{css,scss,md,html,json,yml,yaml} — no files [SKIPPED]
◼ Applying modifications from tasks...
◼ Cleaning up temporary files...
✔ Preparing lint-staged...
❯ Running tasks for staged files...
  ❯ .lintstagedrc.json — 1 file
    ❯ *?(test|spec).{js,jsx,ts,tsx} — 1 file
      ⠹ yarn lint:fix
      ◼ yarn pretty:fix
    ↓ *.{css,scss,md,html,json,yml,yaml} — no files [SKIPPED]
◼ Applying modifications from tasks...
◼ Cleaning up temporary files...
✔ Preparing lint-staged...
❯ Running tasks for staged files...
  ❯ .lintstagedrc.json — 1 file
    ❯ *?(test|spec).{js,jsx,ts,tsx} — 1 file
      ⠸ yarn lint:fix
      ◼ yarn pretty:fix
    ↓ *.{css,scss,md,html,json,yml,yaml} — no files [SKIPPED]
◼ Applying modifications from tasks...
◼ Cleaning up temporary files...
✔ Preparing lint-staged...
❯ Running tasks for staged files...
  ❯ .lintstagedrc.json — 1 file
    ❯ *?(test|spec).{js,jsx,ts,tsx} — 1 file
      ⠼ yarn lint:fix
      ◼ yarn pretty:fix
    ↓ *.{css,scss,md,html,json,yml,yaml} — no files [SKIPPED]
◼ Applying modifications from tasks...
◼ Cleaning up temporary files...
✔ Preparing lint-staged...
❯ Running tasks for staged files...
  ❯ .lintstagedrc.json — 1 file
    ❯ *?(test|spec).{js,jsx,ts,tsx} — 1 file
      ⠴ yarn lint:fix
      ◼ yarn pretty:fix
    ↓ *.{css,scss,md,html,json,yml,yaml} — no files [SKIPPED]
◼ Applying modifications from tasks...
◼ Cleaning up temporary files...
✔ Preparing lint-staged...
❯ Running tasks for staged files...
  ❯ .lintstagedrc.json — 1 file
    ❯ *?(test|spec).{js,jsx,ts,tsx} — 1 file
      ⠦ yarn lint:fix
      ◼ yarn pretty:fix
    ↓ *.{css,scss,md,html,json,yml,yaml} — no files [SKIPPED]
◼ Applying modifications from tasks...
◼ Cleaning up temporary files...
✔ Preparing lint-staged...
❯ Running tasks for staged files...
  ❯ .lintstagedrc.json — 1 file
    ❯ *?(test|spec).{js,jsx,ts,tsx} — 1 file
      ⠧ yarn lint:fix
      ◼ yarn pretty:fix
    ↓ *.{css,scss,md,html,json,yml,yaml} — no files [SKIPPED]
◼ Applying modifications from tasks...
◼ Cleaning up temporary files...
✔ Preparing lint-staged...
❯ Running tasks for staged files...
  ❯ .lintstagedrc.json — 1 file
    ❯ *?(test|spec).{js,jsx,ts,tsx} — 1 file
      ⠇ yarn lint:fix
      ◼ yarn pretty:fix
    ↓ *.{css,scss,md,html,json,yml,yaml} — no files [SKIPPED]
◼ Applying modifications from tasks...
◼ Cleaning up temporary files...
✔ Preparing lint-staged...
❯ Running tasks for staged files...
  ❯ .lintstagedrc.json — 1 file
    ❯ *?(test|spec).{js,jsx,ts,tsx} — 1 file
      ⠏ yarn lint:fix
      ◼ yarn pretty:fix
    ↓ *.{css,scss,md,html,json,yml,yaml} — no files [SKIPPED]
◼ Applying modifications from tasks...
◼ Cleaning up temporary files...
✔ Preparing lint-staged...
❯ Running tasks for staged files...
  ❯ .lintstagedrc.json — 1 file
    ❯ *?(test|spec).{js,jsx,ts,tsx} — 1 file
      ⠋ yarn lint:fix
      ◼ yarn pretty:fix
    ↓ *.{css,scss,md,html,json,yml,yaml} — no files [SKIPPED]
◼ Applying modifications from tasks...
◼ Cleaning up temporary files...
✔ Preparing lint-staged...
❯ Running tasks for staged files...
  ❯ .lintstagedrc.json — 1 file
    ❯ *?(test|spec).{js,jsx,ts,tsx} — 1 file
      ⠙ yarn lint:fix
      ◼ yarn pretty:fix
    ↓ *.{css,scss,md,html,json,yml,yaml} — no files [SKIPPED]
◼ Applying modifications from tasks...
◼ Cleaning up temporary files...
✔ Preparing lint-staged...
❯ Running tasks for staged files...
  ❯ .lintstagedrc.json — 1 file
    ❯ *?(test|spec).{js,jsx,ts,tsx} — 1 file
      ⠹ yarn lint:fix
      ◼ yarn pretty:fix
    ↓ *.{css,scss,md,html,json,yml,yaml} — no files [SKIPPED]
◼ Applying modifications from tasks...
◼ Cleaning up temporary files...
✔ Preparing lint-staged...
❯ Running tasks for staged files...
  ❯ .lintstagedrc.json — 1 file
    ❯ *?(test|spec).{js,jsx,ts,tsx} — 1 file
      ⠸ yarn lint:fix
      ◼ yarn pretty:fix
    ↓ *.{css,scss,md,html,json,yml,yaml} — no files [SKIPPED]
◼ Applying modifications from tasks...
◼ Cleaning up temporary files...
✔ Preparing lint-staged...
❯ Running tasks for staged files...
  ❯ .lintstagedrc.json — 1 file
    ❯ *?(test|spec).{js,jsx,ts,tsx} — 1 file
      ⠼ yarn lint:fix
      ◼ yarn pretty:fix
    ↓ *.{css,scss,md,html,json,yml,yaml} — no files [SKIPPED]
◼ Applying modifications from tasks...
◼ Cleaning up temporary files...
✔ Preparing lint-staged...
❯ Running tasks for staged files...
  ❯ .lintstagedrc.json — 1 file
    ❯ *?(test|spec).{js,jsx,ts,tsx} — 1 file
      ⠴ yarn lint:fix
      ◼ yarn pretty:fix
    ↓ *.{css,scss,md,html,json,yml,yaml} — no files [SKIPPED]
◼ Applying modifications from tasks...
◼ Cleaning up temporary files...
✔ Preparing lint-staged...
❯ Running tasks for staged files...
  ❯ .lintstagedrc.json — 1 file
    ❯ *?(test|spec).{js,jsx,ts,tsx} — 1 file
      ⠦ yarn lint:fix
      ◼ yarn pretty:fix
    ↓ *.{css,scss,md,html,json,yml,yaml} — no files [SKIPPED]
◼ Applying modifications from tasks...
◼ Cleaning up temporary files...
✔ Preparing lint-staged...
❯ Running tasks for staged files...
  ❯ .lintstagedrc.json — 1 file
    ❯ *?(test|spec).{js,jsx,ts,tsx} — 1 file
      ⠧ yarn lint:fix
      ◼ yarn pretty:fix
    ↓ *.{css,scss,md,html,json,yml,yaml} — no files [SKIPPED]
◼ Applying modifications from tasks...
◼ Cleaning up temporary files...
✔ Preparing lint-staged...
❯ Running tasks for staged files...
  ❯ .lintstagedrc.json — 1 file
    ❯ *?(test|spec).{js,jsx,ts,tsx} — 1 file
      ⠇ yarn lint:fix
      ◼ yarn pretty:fix
    ↓ *.{css,scss,md,html,json,yml,yaml} — no files [SKIPPED]
◼ Applying modifications from tasks...
◼ Cleaning up temporary files...
✔ Preparing lint-staged...
❯ Running tasks for staged files...
  ❯ .lintstagedrc.json — 1 file
    ❯ *?(test|spec).{js,jsx,ts,tsx} — 1 file
      ⠏ yarn lint:fix
      ◼ yarn pretty:fix
    ↓ *.{css,scss,md,html,json,yml,yaml} — no files [SKIPPED]
◼ Applying modifications from tasks...
◼ Cleaning up temporary files...
✔ Preparing lint-staged...
❯ Running tasks for staged files...
  ❯ .lintstagedrc.json — 1 file
    ❯ *?(test|spec).{js,jsx,ts,tsx} — 1 file
      ⠋ yarn lint:fix
      ◼ yarn pretty:fix
    ↓ *.{css,scss,md,html,json,yml,yaml} — no files [SKIPPED]
◼ Applying modifications from tasks...
◼ Cleaning up temporary files...
✔ Preparing lint-staged...
❯ Running tasks for staged files...
  ❯ .lintstagedrc.json — 1 file
    ❯ *?(test|spec).{js,jsx,ts,tsx} — 1 file
      ⠙ yarn lint:fix
      ◼ yarn pretty:fix
    ↓ *.{css,scss,md,html,json,yml,yaml} — no files [SKIPPED]
◼ Applying modifications from tasks...
◼ Cleaning up temporary files...
✔ Preparing lint-staged...
❯ Running tasks for staged files...
  ❯ .lintstagedrc.json — 1 file
    ❯ *?(test|spec).{js,jsx,ts,tsx} — 1 file
      ⠹ yarn lint:fix
      ◼ yarn pretty:fix
    ↓ *.{css,scss,md,html,json,yml,yaml} — no files [SKIPPED]
◼ Applying modifications from tasks...
◼ Cleaning up temporary files...
✔ Preparing lint-staged...
❯ Running tasks for staged files...
  ❯ .lintstagedrc.json — 1 file
    ❯ *?(test|spec).{js,jsx,ts,tsx} — 1 file
      ✔ yarn lint:fix
      ◼ yarn pretty:fix
    ↓ *.{css,scss,md,html,json,yml,yaml} — no files [SKIPPED]
◼ Applying modifications from tasks...
◼ Cleaning up temporary files...
✔ Preparing lint-staged...
❯ Running tasks for staged files...
  ❯ .lintstagedrc.json — 1 file
    ❯ *?(test|spec).{js,jsx,ts,tsx} — 1 file
      ✔ yarn lint:fix
      ⠹ yarn pretty:fix
    ↓ *.{css,scss,md,html,json,yml,yaml} — no files [SKIPPED]
◼ Applying modifications from tasks...
◼ Cleaning up temporary files...
✔ Preparing lint-staged...
❯ Running tasks for staged files...
  ❯ .lintstagedrc.json — 1 file
    ❯ *?(test|spec).{js,jsx,ts,tsx} — 1 file
      ✔ yarn lint:fix
      ⠸ yarn pretty:fix
    ↓ *.{css,scss,md,html,json,yml,yaml} — no files [SKIPPED]
◼ Applying modifications from tasks...
◼ Cleaning up temporary files...
✔ Preparing lint-staged...
❯ Running tasks for staged files...
  ❯ .lintstagedrc.json — 1 file
    ❯ *?(test|spec).{js,jsx,ts,tsx} — 1 file
      ✔ yarn lint:fix
      ⠼ yarn pretty:fix
    ↓ *.{css,scss,md,html,json,yml,yaml} — no files [SKIPPED]
◼ Applying modifications from tasks...
◼ Cleaning up temporary files...
✔ Preparing lint-staged...
❯ Running tasks for staged files...
  ❯ .lintstagedrc.json — 1 file
    ❯ *?(test|spec).{js,jsx,ts,tsx} — 1 file
      ✔ yarn lint:fix
      ⠴ yarn pretty:fix
    ↓ *.{css,scss,md,html,json,yml,yaml} — no files [SKIPPED]
◼ Applying modifications from tasks...
◼ Cleaning up temporary files...
✔ Preparing lint-staged...
❯ Running tasks for staged files...
  ❯ .lintstagedrc.json — 1 file
    ❯ *?(test|spec).{js,jsx,ts,tsx} — 1 file
      ✔ yarn lint:fix
      ⠦ yarn pretty:fix
    ↓ *.{css,scss,md,html,json,yml,yaml} — no files [SKIPPED]
◼ Applying modifications from tasks...
◼ Cleaning up temporary files...
✔ Preparing lint-staged...
❯ Running tasks for staged files...
  ❯ .lintstagedrc.json — 1 file
    ❯ *?(test|spec).{js,jsx,ts,tsx} — 1 file
      ✔ yarn lint:fix
      ⠧ yarn pretty:fix
    ↓ *.{css,scss,md,html,json,yml,yaml} — no files [SKIPPED]
◼ Applying modifications from tasks...
◼ Cleaning up temporary files...
✔ Preparing lint-staged...
❯ Running tasks for staged files...
  ❯ .lintstagedrc.json — 1 file
    ❯ *?(test|spec).{js,jsx,ts,tsx} — 1 file
      ✔ yarn lint:fix
      ⠇ yarn pretty:fix
    ↓ *.{css,scss,md,html,json,yml,yaml} — no files [SKIPPED]
◼ Applying modifications from tasks...
◼ Cleaning up temporary files...
✔ Preparing lint-staged...
❯ Running tasks for staged files...
  ❯ .lintstagedrc.json — 1 file
    ❯ *?(test|spec).{js,jsx,ts,tsx} — 1 file
      ✔ yarn lint:fix
      ⠏ yarn pretty:fix
    ↓ *.{css,scss,md,html,json,yml,yaml} — no files [SKIPPED]
◼ Applying modifications from tasks...
◼ Cleaning up temporary files...
✔ Preparing lint-staged...
❯ Running tasks for staged files...
  ❯ .lintstagedrc.json — 1 file
    ❯ *?(test|spec).{js,jsx,ts,tsx} — 1 file
      ✔ yarn lint:fix
      ⠋ yarn pretty:fix
    ↓ *.{css,scss,md,html,json,yml,yaml} — no files [SKIPPED]
◼ Applying modifications from tasks...
◼ Cleaning up temporary files...
✔ Preparing lint-staged...
❯ Running tasks for staged files...
  ❯ .lintstagedrc.json — 1 file
    ❯ *?(test|spec).{js,jsx,ts,tsx} — 1 file
      ✔ yarn lint:fix
      ⠙ yarn pretty:fix
    ↓ *.{css,scss,md,html,json,yml,yaml} — no files [SKIPPED]
◼ Applying modifications from tasks...
◼ Cleaning up temporary files...
✔ Preparing lint-staged...
❯ Running tasks for staged files...
  ❯ .lintstagedrc.json — 1 file
    ❯ *?(test|spec).{js,jsx,ts,tsx} — 1 file
      ✔ yarn lint:fix
      ✔ yarn pretty:fix
    ↓ *.{css,scss,md,html,json,yml,yaml} — no files [SKIPPED]
◼ Applying modifications from tasks...
◼ Cleaning up temporary files...
✔ Preparing lint-staged...
❯ Running tasks for staged files...
  ❯ .lintstagedrc.json — 1 file
    ✔ *?(test|spec).{js,jsx,ts,tsx} — 1 file
    ↓ *.{css,scss,md,html,json,yml,yaml} — no files [SKIPPED]
◼ Applying modifications from tasks...
◼ Cleaning up temporary files...
✔ Preparing lint-staged...
❯ Running tasks for staged files...
  ✔ .lintstagedrc.json — 1 file
◼ Applying modifications from tasks...
◼ Cleaning up temporary files...
✔ Preparing lint-staged...
✔ Running tasks for staged files...
◼ Applying modifications from tasks...
◼ Cleaning up temporary files...
✔ Preparing lint-staged...
✔ Running tasks for staged files...
⠙ Applying modifications from tasks...
◼ Cleaning up temporary files...
✔ Preparing lint-staged...
✔ Running tasks for staged files...
⠹ Applying modifications from tasks...
◼ Cleaning up temporary files...
✔ Preparing lint-staged...
✔ Running tasks for staged files...
✔ Applying modifications from tasks...
◼ Cleaning up temporary files...
✔ Preparing lint-staged...
✔ Running tasks for staged files...
✔ Applying modifications from tasks...
⠹ Cleaning up temporary files...
✔ Preparing lint-staged...
✔ Running tasks for staged files...
✔ Applying modifications from tasks...
⠸ Cleaning up temporary files...
✔ Preparing lint-staged...
✔ Running tasks for staged files...
✔ Applying modifications from tasks...
✔ Cleaning up temporary files...
✔ Preparing lint-staged...
✔ Running tasks for staged files...
✔ Applying modifications from tasks...
✔ Cleaning up temporary files...
Done in 4.63s.

If I prefix the command in the hook with FORCE_COLOR=0, it fixes the excessive output but then doesn't display the glyphs.

Click to expand
[STARTED] Preparing lint-staged...
[SUCCESS] Preparing lint-staged...
[STARTED] Running tasks for staged files...
[STARTED] .lintstagedrc.json — 1 file
[STARTED] *?(test|spec).{js,jsx,ts,tsx} — 0 files
[STARTED] *.{css,scss,md,html,json,yml,yaml} — 1 file
[SKIPPED] *?(test|spec).{js,jsx,ts,tsx} — no files
[STARTED] yarn pretty:fix
[SUCCESS] yarn pretty:fix
[SUCCESS] *.{css,scss,md,html,json,yml,yaml} — 1 file
[SUCCESS] .lintstagedrc.json — 1 file
[SUCCESS] Running tasks for staged files...
[STARTED] Applying modifications from tasks...
[SUCCESS] Applying modifications from tasks...
[STARTED] Cleaning up temporary files...
[SUCCESS] Cleaning up temporary files...
Done in 2.30s.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.