Lint-staged: On v10.0.0-0, committing changes to a JS file from Github Desktop fails

Created on 21 Oct 2019  Â·  6Comments  Â·  Source: okonet/lint-staged

Description

When committing changes to a JS (flow) file using the Github Desktop app, I get an error that I reproduced below under Debug Logs (with the --debug flag active). The salient error message seems to be: error: unknown optionno-overlay'`
image

Steps to reproduce

Attempt to commit changes to a JS file (including flow syntax) from the Github Desktop app. As you can see in the debug logs, I am running prettier --write and eslint --fix on all staged JS files (plus git add). The error seems to occur when lint-staged runs:

git command [ 'stash',
  'save',
  '--quiet',
  '--include-untracked',
  '--keep-index',
  'lint-staged automatic backup' ]

if relevant, our .prettierrc config specifies flow as the parser for *.js files like so:

overrides:
- files: "*.js"
  options:
    parser: flow

Debug Logs


expand to view

Commit failed - exit code 1 received, with output: 'husky > pre-commit (node v11.11.0)
2019-10-21T17:38:19.221Z lint-staged:bin Running `[email protected]`
2019-10-21T17:38:19.223Z lint-staged Loading config using `cosmiconfig`
2019-10-21T17:38:19.234Z lint-staged Successfully loaded config from `/Users/andrew/Projects/next/node/package.json`:
{ '*.{css,js,json,less,md}': [ 'prettier --write', 'git add' ],
  '*.js': [ 'eslint --fix', 'git add' ] }
2019-10-21T17:38:19.234Z lint-staged:cfg Validating config
Running lint-staged with the following config:
{
  '*.{css,js,json,less,md}': [
    'prettier --write',
    'git add'
  ],
  '*.js': [
    'eslint --fix',
    'git add'
  ]
}
2019-10-21T17:38:19.239Z lint-staged:run Running all linter scripts
2019-10-21T17:38:19.239Z lint-staged:git Running git command [ 'rev-parse', '--show-toplevel' ]
2019-10-21T17:38:19.266Z lint-staged:run Resolved git directory to be `/Users/andrew/Projects/next`
2019-10-21T17:38:19.267Z lint-staged:git Running git command [ 'diff', '--staged', '--diff-filter=ACMR', '--name-only' ]
2019-10-21T17:38:19.276Z lint-staged:run Loaded list of staged files in git:
[ 'node/shared/components/rich-text/RichText.js' ]
2019-10-21T17:38:19.276Z lint-staged:gen-tasks Generating linter tasks
2019-10-21T17:38:19.284Z lint-staged:gen-tasks Generated task: 
{ pattern: '*.{css,js,json,less,md}',
  commands: [ 'prettier --write', 'git add' ],
  fileList:
   [ '/Users/andrew/Projects/next/node/shared/components/rich-text/RichText.js' ] }
2019-10-21T17:38:19.284Z lint-staged:gen-tasks Generated task: 
{ pattern: '*.js',
  commands: [ 'eslint --fix', 'git add' ],
  fileList:
   [ '/Users/andrew/Projects/next/node/shared/components/rich-text/RichText.js' ] }
Preparing... [started]
2019-10-21T17:38:19.287Z lint-staged:git Backing up original state...
2019-10-21T17:38:19.287Z lint-staged:file Trying to access `/Users/andrew/Projects/next/.git/MERGE_HEAD`
2019-10-21T17:38:19.291Z lint-staged:file Unable to access file `/Users/andrew/Projects/next/.git/MERGE_HEAD` with error:
2019-10-21T17:38:19.291Z lint-staged:file Error: ENOENT: no such file or directory, access '/Users/andrew/Projects/next/.git/MERGE_HEAD'
2019-10-21T17:38:19.291Z lint-staged:git Running git command [ 'ls-files', '--others', '--exclude-standard' ]
2019-10-21T17:38:19.331Z lint-staged:git Running git command [ 'stash',
  'save',
  '--quiet',
  '--include-untracked',
  '--keep-index',
  'lint-staged automatic backup' ]
Preparing... [failed]
→ error: unknown option `no-overlay'
usage: git checkout [<options>] <branch>
   or: git checkout [<options>] [<branch>] -- <file>...

    -q, --quiet           suppress progress reporting
    -b <branch>           create and checkout a new branch
    -B <branch>           create/reset and checkout a branch
    -l                    create reflog for new branch
    --detach              detach HEAD at named commit
    -t, --track           set upstream info for new branch
    --orphan <new-branch>
                          new unparented branch
    -2, --ours            checkout our version for unmerged files
    -3, --theirs          checkout their version for unmerged files
    -f, --force           force checkout (throw away local modifications)
    -m, --merge           perform a 3-way merge with the new branch
    --overwrite-ignore    update ignored files (default)
    --conflict <style>    conflict style (merge or diff3)
    -p, --patch           select hunks interactively
    --ignore-skip-worktree-bits
                          do not limit pathspecs to sparse entries only
    --ignore-other-worktrees
                          do not check if another worktree is holding the given ref
    --recurse-submodules[=<checkout>]
                          control recursive updating of submodules
    --progress            force progress reporting

error: unknown option `no-overlay'
usage: git checkout [<options>] <branch>
   or: git checkout [<options>] [<branch>] -- <file>...

    -q, --quiet           suppress progress reporting
    -b <branch>           create and checkout a new branch
    -B <branch>           create/reset and checkout a branch
    -l                    create reflog for new branch
    --detach              detach HEAD at named commit
    -t, --track           set upstream info for new branch
    --orphan <new-branch>
                          new unparented branch
    -2, --ours            checkout our version for unmerged files
    -3, --theirs          checkout their version for unmerged files
    -f, --force           force checkout (throw away local modifications)
    -m, --merge           perform a 3-way merge with the new branch
    --overwrite-ignore    update ignored files (default)
    --conflict <style>    conflict style (merge or diff3)
    -p, --patch           select hunks interactively
    --ignore-skip-worktree-bits
                          do not limit pathspecs to sparse entries only
    --ignore-other-worktrees
                          do not check if another worktree is holding the given ref
    --recurse-submodules[=<checkout>]
                          control recursive updating of submodules
    --progress            force progress reporting

husky > pre-commit hook failed (add --no-verify to bypass)'

Environment

  • OS: macOS Catalina
  • Node.js: 11.11.0
  • lint-staged: 10.0.0-0
? Needs Validation ?

Most helpful comment

Similar problem here

 lint-staged:git Done backing up merge state!
 lint-staged:git Running git command [ 'ls-files', '--deleted' ]
 lint-staged:git Running git command [
  'stash',
  'save',
  '--include-untracked',
  '--keep-index',
  'lint-staged automatic backup'
]
Preparing... [failed]
→ error: unknown option 'ignore-skip-worktree-entries'
usage: git update-index [<options>] [--] [<file>...]

    -q                    continue refresh even when index needs update
    --ignore-submodules   refresh: ignore submodules
    --add                 do not ignore new files
    --replace             let files replace directories and vice-versa
    --remove              notice files missing from worktree
    --unmerged            refresh even if index contains unmerged entries
    --refresh             refresh stat information
    --really-refresh      like --refresh, but ignore assume-unchanged setting
    --cacheinfo <mode>,<object>,<path>
                          add the specified entry to the index
    --chmod (+|-)x        override the executable bit of the listed files
    --assume-unchanged    mark files as "not changing"
    --no-assume-unchanged
                          clear assumed-unchanged bit
    --skip-worktree       mark files as "index-only"
    --no-skip-worktree    clear skip-worktree bit
    --info-only           add to index only; do not add content to object database
    --force-remove        remove named paths even if present in worktree
    -z                    with --stdin: input lines are terminated by null bytes
    --stdin               read list of paths to be updated from standard input
    --index-info          add entries from standard input to the index
    --unresolve           repopulate stages #2 and #3 for the listed paths
    -g, --again           only update entries that differ from HEAD
    --ignore-missing      ignore files missing from worktree
    --verbose             report actions to standard output
    --clear-resolve-undo  (for porcelains) forget saved unresolved conflicts
    --index-version <n>   write index in this format
    --split-index         enable or disable split index
    --untracked-cache     enable/disable untracked cache
    --test-untracked-cache
                          test if the filesystem supports untracked cache
    --force-untracked-cache
                          enable untracked cache without testing the filesystem
    --force-write-index   write out the index even if is not flagged as changed
    --fsmonitor           enable or disable file system monitor
    --fsmonitor-valid     mark files as fsmonitor valid
    --no-fsmonitor-valid  clear fsmonitor valid bit

Environment

  • OS: macOS Catalina 10.15.3
  • Node.js: 12.16.1
  • lint-staged: 10.0.8
  • Sourcetree Desktop: 4.0.1
  • Git: 2.23.0
  • Husky: 4.2.3

PS

  • git: 2.23.0 and husky: 3.1.0 and lint-staged: 10.0.8 is ok!
  • git: 2.23.0 and husky: 4.2.3 and lint-staged: 9.5.0 is ok!
  • git: 2.23.0 and husky: 4.2.3 and lint-staged: 10.0.8 is error!
  • git: 2.25.1 and husky: 4.2.3 and lint-staged: 10.0.8 is ok!

Fix

sudo launchctl config user path $PATH

All 6 comments

Does it work from the command line? There's obviously no no-overlay found in the codebase of lint-staged (git-stashes branch or master), so I really have no idea where it's coming from. Does it happen on the current latest version?

Maybe you could re-test it with v10.0.0-beta.3?

I've getting the same error on VS Code on 10.0.7
error: unknown option 'no-overlay'

Similar problem here, but with the following error:

error: unknown option ignore-skip-worktree-entries

That is from the GitHub Desktop app though - committing from an iTerm terminal works fine as usual!

Environment

  • OS: macOS Catalina
  • Node.js: 12.16.1
  • lint-staged: 10.0.8
  • GitHub Desktop: 2.3.1

Similar problem here

 lint-staged:git Done backing up merge state!
 lint-staged:git Running git command [ 'ls-files', '--deleted' ]
 lint-staged:git Running git command [
  'stash',
  'save',
  '--include-untracked',
  '--keep-index',
  'lint-staged automatic backup'
]
Preparing... [failed]
→ error: unknown option 'ignore-skip-worktree-entries'
usage: git update-index [<options>] [--] [<file>...]

    -q                    continue refresh even when index needs update
    --ignore-submodules   refresh: ignore submodules
    --add                 do not ignore new files
    --replace             let files replace directories and vice-versa
    --remove              notice files missing from worktree
    --unmerged            refresh even if index contains unmerged entries
    --refresh             refresh stat information
    --really-refresh      like --refresh, but ignore assume-unchanged setting
    --cacheinfo <mode>,<object>,<path>
                          add the specified entry to the index
    --chmod (+|-)x        override the executable bit of the listed files
    --assume-unchanged    mark files as "not changing"
    --no-assume-unchanged
                          clear assumed-unchanged bit
    --skip-worktree       mark files as "index-only"
    --no-skip-worktree    clear skip-worktree bit
    --info-only           add to index only; do not add content to object database
    --force-remove        remove named paths even if present in worktree
    -z                    with --stdin: input lines are terminated by null bytes
    --stdin               read list of paths to be updated from standard input
    --index-info          add entries from standard input to the index
    --unresolve           repopulate stages #2 and #3 for the listed paths
    -g, --again           only update entries that differ from HEAD
    --ignore-missing      ignore files missing from worktree
    --verbose             report actions to standard output
    --clear-resolve-undo  (for porcelains) forget saved unresolved conflicts
    --index-version <n>   write index in this format
    --split-index         enable or disable split index
    --untracked-cache     enable/disable untracked cache
    --test-untracked-cache
                          test if the filesystem supports untracked cache
    --force-untracked-cache
                          enable untracked cache without testing the filesystem
    --force-write-index   write out the index even if is not flagged as changed
    --fsmonitor           enable or disable file system monitor
    --fsmonitor-valid     mark files as fsmonitor valid
    --no-fsmonitor-valid  clear fsmonitor valid bit

Environment

  • OS: macOS Catalina 10.15.3
  • Node.js: 12.16.1
  • lint-staged: 10.0.8
  • Sourcetree Desktop: 4.0.1
  • Git: 2.23.0
  • Husky: 4.2.3

PS

  • git: 2.23.0 and husky: 3.1.0 and lint-staged: 10.0.8 is ok!
  • git: 2.23.0 and husky: 4.2.3 and lint-staged: 9.5.0 is ok!
  • git: 2.23.0 and husky: 4.2.3 and lint-staged: 10.0.8 is error!
  • git: 2.25.1 and husky: 4.2.3 and lint-staged: 10.0.8 is ok!

Fix

sudo launchctl config user path $PATH

I was getting similar error. Closing VS code & its terminal and opening fresh terminal fixed it.

Was this page helpful?
0 / 5 - 0 ratings