Questions tagged [lint-staged]
98 questions
0
votes
1 answer
lint-staged react 18 not working with prettier
I'm trying to run prettier before committing my changes using Husky + lint-staged, but it is not working. It does find the files, but it fails when it tries to apply "prettier --write"
Err: 'prettier' is not recognized as an internal or external…

deiabasile
- 37
- 3
0
votes
1 answer
How to prevent git push when there are eslint errors?Husky, lint-staged, eslint
Hi StackOverflow community,
I'm having trouble preventing a git push when there are eslint errors in my code. I'm using eslint with husky and lint-staged to catch linting errors before they are committed to the repository. However, when there are…
0
votes
1 answer
Stylelint will not ignore "custom-property-pattern" rule
I am trying to run stylelint --fix as part of a Husky hook with npx lint-staged.
However, it keeps failing because we are using snake case for our in-house css variables. There are also some kebab case variables in our scss from Bootstrap and the…

Steve
- 14,401
- 35
- 125
- 230
0
votes
0 answers
Lint staged broken for lerna: ERR! lerna Unknown arguments: [file paths]
Currently I am using lerna@3.22.1. I am having problems with lerna in lint-staged. I'm receiving a weird error:
ERR! lerna Unknown arguments: and after that the path for all the committed files.
package.json in root folder:
scripts: {
...
…

afriedman111
- 1,925
- 4
- 25
- 42
0
votes
1 answer
Husky with lint-staged is keep on running forever for the failure cases
In my project, here is the project structure:
client/
.git/
services/
nest-services/
package.json
apps/
app1/
..
appn/
// no package.json…

Pradip
- 509
- 1
- 5
- 22
0
votes
0 answers
Set specific eslint rules for just lint-staged
I'd like to have no-console as 'warn' in my eslint config (eslintrc) when coding, but in my lint-staged (where I run eslint --fix in addition to prettier --write) I'd want it to be 'no-console': 'error', so that it wont push up code with console.log…

dreamc4t
- 9
- 3
0
votes
1 answer
how to get the staged files in custom lint-staged scripts and how to debug the custom script file?
I have lint-staged + husky configured in my app and
I need to run a custom lint-staged script on precommit.
Here is my package.json
//package.json
"lint-staged": {
"app/**/*.js": "node ./lint-staged-scripts/customScript"
}
In the…

codermonk
- 84
- 6
0
votes
1 answer
Lint-staged aborts check with the first failing file; "Error: Unknown argument"
With "lint-staged": "^13.0.3" and the following .lintstagedrc config:
{
"src/**/*.{ts,html}": [
"ng lint"
],
"src/**/*.scss": [
"npx stylelint **/*.scss"
]
}
I'm trying to run npx lint-staged -q on the following files (all of them…

noamyg
- 2,747
- 1
- 23
- 44
0
votes
0 answers
Husky pre-commit hook not triggering using lint-staged
New to husky and having problems running pre-commit hook.
pre-commit file (I have husky install script):
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"
npx lint-staged
.eslintrc:
{
"root": true,
"parser": "@typescript-eslint/parser",
…

moze
- 322
- 1
- 5
- 14
0
votes
2 answers
Husky can't resolve paths of tsconfig.ts
I'm using Jest to make my unit tests and I have custom paths in my tsconfig.json which works all fines in local.
But when I try to commit my changes through husky and lint-staged, it makes errors like "can't find test files" or "can't resolve…
user17014580
0
votes
1 answer
lint-staged generates new .eslintcache file on commit
I'm creating a new Vue project via npm init vue@latest and select everything (Eslint with Prettier)
I'm using the following setup
OS: Win11
node: v17.4
npm: v8.4
I setup lint-staged via npx mrm@2 lint-staged. For testing purposes I add a new file…
user17298649
0
votes
1 answer
Setting up lint-staged generates a file with a number containing information about installed packages
I'm creating a new Vue project via npm init vue@latest and select everything (Eslint with Prettier)
I'm using the following setup
OS: Win11
node: v17.4
npm: v8.4
After creating a new project via PowerShell I open up Visual Studio Code and use its…
user17298649
0
votes
0 answers
Unable to run lint-staged + eslint in monorepo
whenever I try to run eslint with lint-staged on commit I get the following error regarding the parserOptions.project:
I have the following project structure for a simple Node JS backend + React Frontend. Each module has its own eslint+tsconfig and…

Declan Fitzpatrick
- 152
- 2
- 3
- 12
0
votes
2 answers
Lint Staged does not access subfolders
I'm running the npx lint-staged command and noticed that if I have the following tree:
src
/sub-folder-x
- file-x
/sub-folder-y
- file-y
The eslint and prettier cannot find files in subfolders.
How do I get the stage to run on all subfolders…

THIAGO DE BONIS
- 760
- 7
- 22
0
votes
1 answer
husky pre-commit hook for 'test' does not finish
Hi i installed husky & lint-stage so as to have pre-commit hooks for lint & tests, for the staged files.
The pre-commit hook works, when i go to git commit -m 'something', and the commands are triggered.
What i have so far in terms of files…

Theo Itzaris
- 4,321
- 3
- 37
- 68