Search code examples
rubocoplint-staged

Lintstaged process is stuck when running rubocop command


I try to lint my .rb files while committing.

Here is my .lintstagedrc file:

{
    "*.rb": [
      "bundle exec rubocop --require rubocop-airbnb",
    ]
}

Lint-staged is setup with husky.

When I change a .rb file, it tries to run the command but it is stuck. I tried to run the command with the debug flags on, but I did not see any useful information:

lint-staged:bin Running `[email protected]` on Node.js v18.19.0 (darwin) 
....
....
....
....
[COMPLETED] Preparing lint-staged...
[STARTED] Running tasks for staged files...
[STARTED] .lintstagedrc — 3 files
[STARTED] *.rb — 1 file
[STARTED] *.erb — 0 files
[SKIPPED] *.erb — no files
[STARTED] bundle exec rubocop --version
=> Froze

What can be the root cause?

Env

  • Running lint-staged 15.2.0
  • Running node 18.19.0
  • Running rubocop-airbnb 6.0.0
  • Commands run fine locally
  • bundle exec erblint & bundle exec htmlbeautifier commands go through when added into the lintstagedrc file

Solution

  • This problem was fixed by v15.2.1. Try to update lint-staged.