lint-staged: v11.2.4 is broken for config .lintstagedrc
Description
Steps to reproduce
- upgrade to v11.2.4, and run
npx lint-staged
- nothing happens, it starts working after downgrading to
v11.2.3
Environment
- OS: Windows
- Node.js: v14.17.6
lint-staged
: v11.2.4
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 15
- Comments: 29 (9 by maintainers)
Thanks @kelvindecosta, I opened a PR that will fix the issue: https://github.com/okonet/lint-staged/pull/1033
Have the same issue with 11.2.4 - exit 1 without any output. maxOS 11.6, yarn 3.0.2
–version & --help work as expected
Hey @si-saaref, the bug described in this issue was fixed as of v11.2.5. If you’re using an updated version of
lint-staged
, then you don’t need any of the specific advice offered in this thread, because you won’t run into this specific issue anymore.This isn’t a great place to ask for general support. But, I’ve included some below anyway.
It looks like you’re trying to use two different package managers at once:
npx
is a command provided by NPM, the built-in Node.js package manager.yarn
is a command provided by Yarn, a competing package manager you can optionally install.You should choose one package manager for your project and stick with it. Each has its advantages and disadvantages. At a very high level, Yarn 3 is easier to use, but harder to set up; NPM 8 is built into Node.js 16, but harder to use.
If you want to use NPM, you will run
npx lint-staged
, and your.lintstagedrc
will look something like this:And then going forward, any time you see a command that includes
yarn
, you will need to learn how to rewrite it for NPM.Package management is one of the least welcoming aspects of the Node.js ecosystem. Many docs and tutorials will assume you use either NPM or Yarn (and often older, incompatible versions, too). But once you learn how to adjust commands for your package manager of choice, it should be smooth sailing.
If you need further assistance, I’d recommend searching and asking on Stack Overflow: https://stackoverflow.com/tags/node.js
Hey everyone!
Ran into the same issue on Linux.
yarn lint-staged
exits with1
.I think the issue is with the
resolveConfig
function. For some reason, it works when I rename.lintstagedrc
->.lintstagedrc.json
.Hope this helps!
Probably related to this: https://github.com/okonet/lint-staged/pull/981.
Let me open a revert PR.
Hey @aaronadamsCA, you mean it works with v11.2.5, don’t you?
Update: yeah I can confirm that it works with v11.2.5
@VladimirGrenaderov there was a compatibility “fix” in PR https://github.com/okonet/lint-staged/pull/981 that should have handled the yaml configurations, but it seems to be broken. I now managed to replicate the bug so I’ll try and come up with a fix. Sorry about that!
Are you by chance using
yaml
configuration? That was the one thing not supported directly bylilconfig
.@w3nda or @VladimirGrenaderov, can you try editing
lint-staged?
directly in your project via node_modules to add some debug messages?So edit this file
node_modules/lint-staged/lib/index.js
and add:This might indicate if the bug is indeed with
lilconfig
.