Questions tagged [lint-staged]
98 questions
1
vote
0 answers
Jest `--findRelatedTests` runs all tests during lint-staged
I've noticed that our pre-commit script is running too long. After some investigation, I found it is running ALL the tests in the source code, rather than just the tests related to staged files.
I tested by staging a file that breaks a test. When…

HaveSpacesuit
- 3,572
- 6
- 40
- 59
1
vote
3 answers
How to fix "lint-staged failed due to a git error"
For some reason, lint-staged keeps failing, showing the lint-staged due to a git error.
Using version v13.0.3.
✖ lint-staged failed due to a git error.
Cleaning up temporary files...
Any lost modifications can be restored from a git stash:
…

Toomuchrice4u
- 328
- 4
- 9
1
vote
1 answer
eslint removing semicolons after prettier adds them
I'm trying to have es lint and then prettier run pre commit. But es lint or lint staged or someone or something keeps removing my semicolons driving me insane. My app is a basic node js app with no typescript.
This is what my setup includes and I've…

pbuzz007
- 747
- 1
- 5
- 15
1
vote
1 answer
lint-staged for elixir/phoenix projects
How would one lint files staged to commit, not all files in the project, using mix credo, mix format, etc?
In the JavaScript ecosystem this is accomplished with lint-staged and husky. Elixir has its version of the husky package called git_hooks, but…

user13653
- 303
- 3
- 7
1
vote
1 answer
lint-staged prettier write doesn't end
I am using Husky and lint-staged in a React (TypeScript) project.
My files look like this:
package.json
"check-types": "tsc --pretty --noEmit",
"fix-eslint:staged": "yarn check-eslint:staged --fix",
"fix-format:staged": "prettier…

newbie
- 530
- 1
- 9
- 36
1
vote
1 answer
Pre-commit hook is not working | Husky and Lintstaged
I'm trying to use typescript pre-commit Husky hooks with LintStaged, but when I do a commit, the pre-commit script is not running, I just receive the common git response after commits.
.huskyrc.json
{
"hooks": {
"pre-commit":…

Thierry P. Oliveira
- 526
- 9
- 16
1
vote
2 answers
How to configure lint-stage to work with backend files?
Prompt with lint-stage.
The front is angular, the back is dot net.
On the front, the lint-stage is successfully used with husky, in order to format the commited files in a pre-commit hook. I'm trying to attach the back by analogy to the…

Kirill_Cyber
- 51
- 4
1
vote
0 answers
Lint staged + ESLint are testing all files instead of staged
I want to test my code on the pre-commit hook. To achieve it I installed husky, and list-staged.
Here's the config:
"scripts": {
"test": "eslint --ext .ts,.tsx ./**/*",
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
…

Yoskutik
- 1,859
- 2
- 17
- 43
1
vote
1 answer
lint-staged added path to command
I have the following package.json:
"scripts": {
"lint": "npm run v2:lint",
"v2:lint": "cd ./v2 && npm run lint && cd .."
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"lint-staged": {
"*.{js, json}": "npm run…

jamesdeath123
- 4,268
- 11
- 52
- 93
1
vote
1 answer
pre commit rules failing when used with lint-staged
I am trying to set the pre commit git hooks for angular5 project. I am using husky with lint-staged. Prettier and stylelint linters run fine. But when lint-staged encounters 'ng lint', it just throws error:
Project…

Sneha Vantamuri
- 29
- 2
- 4
1
vote
1 answer
lint-staged + commitizen configuration suitable for command-line and Intellij
I'm trying to build such a configuration which would work for both command line and Intellij.
Here is a part of my package.json
"config": {
"commitizen": {
"path": "cz-conventional-changelog"
}
},
"husky": {
"hooks": {
"pre-commit":…

humkins
- 9,635
- 11
- 57
- 75
1
vote
1 answer
Husky/lint-staged pre-commit formatting issue
Running husky/lint-staged hook for pre-commit formatting (working fine).
Having one strange bug where for some reason on one file it keeps formatting the file with a spacing of 1 tab instead of 2 spaces.
(husky/lint-staged seems to rewrite/reformat…

uidevthing
- 1,781
- 2
- 12
- 24
0
votes
0 answers
How to setup lint-staged with turbo monorepo?
I have a turbo monorepo, with packages/... and apps/app-a, apps/app-b .
I have set up husky pre-commit hook, which will run pnpm dlx lint-staged
I want lint-staged to run lint script from the closest to the staged file package.json file.
So for…

Nez Nez
- 33
- 5
0
votes
0 answers
Does Playwright have equivalent functionality to "--findRelatedTests" in Jest?
I will be running Playwright VR Tests with a pre-commit hook. My test files are co-located with each compoinent. Instead of running all tests each time, I am looking for a feature (or other solution) that will only run the tests in directories that…

mel-miller
- 31
- 2
0
votes
0 answers
Husky git hook deletes changes in unstaged files when lint staged fails
I have installed husky to use it as a pre commit git hook. I am also using lint-staged. My package.json has following scripts:
"lint-staged": {
"src/**/*.{ts,tsx,css,md,json}": "yarn run format",
"*.{ts,tsx}": "yarn run lint:fix"
},
…

Leff
- 1,968
- 24
- 97
- 201