Questions tagged [lint-staged]

98 questions
4
votes
0 answers

lint-staged and tslint "warning" severity

In my project I use tslint with "defaultSeverity": "warning" option. Is there a way to configure lint-staged to catch warnings too and abort commit if they occurs? My lint-staged configuration: "lint-staged": { …
user3452568
  • 283
  • 3
  • 14
3
votes
2 answers

Unable to commit due to Husky failure in node application

I have created a node application and installed Husky7.0.4 and lint-staged12.3.5 following are the configuration for .husky/pre-commit --- file #!/bin/sh . "$(dirname "$0")/_/husky.sh" npm run pre-commit and following are the package.json…
Avinash A
  • 665
  • 1
  • 7
  • 22
3
votes
1 answer

`npx mrm@2 lint-staged` crashes with `Error: .git can't be found (...)`

I am trying to set up lint-staged following the instructions from the prettier documentation. When I run npx mrm@2 lint-staged, I get the following error: Error: .git can't be found (see https://typicode.github.io/husky/#/?id=custom-directory) …
mgottsch
  • 559
  • 1
  • 3
  • 12
3
votes
0 answers

Using lint-staged to check this commit is going to build ok?

When using husky and lint-staged is it possible to check what is staged builds in the pre-commit? Kind of like this? "lint-staged": { "**/*.{js,jsx,ts,tsx,css,md}": [ "prettier --write", "yarn build" ] } If I try this I get a…
user1259167
  • 447
  • 5
  • 15
3
votes
1 answer

How to configure lint-staged to run eslint and prettier scripts

I have this setup: // package.json ... "scripts": { ... "lint": "eslint --fix {src,test}/**/*.{js,ts,jsx,tsx} --no-error-on-unmatched-pattern", "style": "prettier --write {src,test}/**/* ./*.{json,*.json} !package-lock.json -u…
user16435030
3
votes
1 answer

How to use dotnet format to format the whole project inside a subfolder?

I have a .Net 5 app and want to use dotnet format. First I added commitlint, husky and lint-staged to the repository. The folder structure looks like . ├── package.json └── MyCsharpProject ├── MyCsharpProject.sln └── Assembly1 The…
Question3r
  • 2,166
  • 19
  • 100
  • 200
3
votes
0 answers

Trying to removed unused imports with a pre-commit hook but imports that are being used are getting removed

I just installed eslint-plugin-unused-imports. When I commit, it does all its linting work and removed a bunch of imports even though many of those imports are being used in the file. May or may not be worth noting, this project has a bunch of…
bonum_cete
  • 4,730
  • 6
  • 32
  • 56
3
votes
1 answer

lint-staged in Angular monorepo

I'm trying to set up lint-staged with my Angular monorepo workspace, however I can't make it work. When ng lint --files is executed with changed file it errors that *file* is not part of a TypeScript project. If I run ng lint --files it…
Sergey
  • 7,184
  • 13
  • 42
  • 85
3
votes
1 answer

"lint-staged" package is not committing the updated files after running "ng lint --fix" in Intellij idea

I have configured lint-staged as following in my Angular 7 app. "husky": { "hooks": { "pre-commit": "lint-staged" } }, "lint-staged": { "linters": { "*.ts": "ng lint --fix my-app --files" }, "relative": true …
Ansuman
  • 1,404
  • 4
  • 14
  • 32
3
votes
1 answer

Argument list too long - lint-staged -> tslint

In our project we ran into a weird issue after integrating lint-staged along with prettier and tslint. The idea was to apply prettier and then tslint to all files in the commit using husky pre-commit git hook. In order for the whole project to…
3
votes
2 answers

Husky giving error SyntaxError: Use of const in strict mode

I am using Husky with Lint-staged and Stylelint "scripts": { "precommit": "lint-staged", }, "lint-staged": { "*.scss": ["stylelint --syntax scss" ] }, OS - Latest OSX Node - 6.10.0 NPM - 3.10.00 I'm getting this error on git…
Jitendra Vyas
  • 148,487
  • 229
  • 573
  • 852
2
votes
0 answers

lint-staged taking a long time for a single file ng lint

I recently created an Angular 13 project and added ESLint configuration to my app. I have a few libraries so I added ESLinting to those projects as well. I set up husky and lint-staged to run ng lint fix and prettier fix on the staged files. When I…
afriedman111
  • 1,925
  • 4
  • 25
  • 42
2
votes
0 answers

Use global package.json in pnpm workspace for Linter/Prettier

I configured my project into pnpm workspace with : |-node_modules |-package.json (A) |-eslintrc |-app1 | |-node_modules | |-package.json (B) | |-app.ts |-app2 | |-node_modules | |-package.json (C) | |-app.ts |-packages | |-lib1 | | …
2
votes
0 answers

Husky never runs lint-staged on commit

I want to check the staged files with linter on commit. And that's how I configured package.json "scripts": { ... "lint": "eslint .", "lint:ts": "eslint . --ext .ts --ext .tsx", }, "husky": { "hooks": { "pre-commit":…
scripter2021
  • 341
  • 2
  • 10
2
votes
0 answers

How do I fix path not finding issue in husky and lint-staged?

Since my package.json and .git are not on the same level, I referred to the custom directory of the docs. error yarn run v1.22.17 error Couldn't find a package.json file in "/Users/home/project" info Visit https://yarnpkg.com/en/docs/cli/run for…
yjlee
  • 363
  • 1
  • 14