Questions tagged [lint-staged]

98 questions
2
votes
1 answer

lerna run build command fails in lint-staged

I am working on a React monorepo and I have the below scripts in the root package.json: "scripts": { "build": "lerna run build", }, "husky": { "hooks": { "pre-commit": "lint-staged", } }, lint-staged.config.js module.exports =…
newbie
  • 530
  • 1
  • 9
  • 36
2
votes
1 answer

Could not parse lint-staged config

When running lint-staged I get the following error - This is my lint-staged config file - module.exports = { 'src/**/*.ts': ['eslint --fix', () => 'tsc --noEmit'], '**/*.{ts,js,json,yaml}': 'prettier --write', '**/*': 'inflint -c…
2
votes
0 answers

How do I get `npx mrm lint-staged` working

I am aware of lint-staged not running on precommit but none of the solutions helped me. I ran npx mrm lint-staged, but the pre-commit hook is not running. I went to check .git/hooks, and no hook was created here by husky. I have tried uninstalling…
Samson
  • 1,336
  • 2
  • 13
  • 28
2
votes
2 answers

lint-staged run different commands for different folders

My project folder is setup with two subfoders, frontend and backend to house codes respectively. Therefore in the root folder I have: - backend - package.json - other backend codes - frontend - package.json - other frontend codes -…
jamesdeath123
  • 4,268
  • 11
  • 52
  • 93
2
votes
1 answer

Husky + lint-staged not working on Windows (command not found)

I cannot seem to get husky and lint-staged to work on my Windows 10 machine. Currently my setup is as follows: .huskyrc.json { "hooks": { "pre-commit": "lint-staged" } } .lintstagedrc (though it seems not to matter whats in here since the…
Raul Špilev
  • 288
  • 4
  • 18
2
votes
1 answer

husk does not execute the precommit while I commit new files

I'm using husky v4.3.0 lint-staged 10.4.0 prettier v2.1 on create-react-app. package.json: "husky": { "hooks": { "pre-commit": "lint-staged" } }, "lint-staged": { "src/**/*.{ts, tsx}": [ "eslint --fix", "git add" …
Slim
  • 5,527
  • 13
  • 45
  • 81
2
votes
1 answer

Why is lint-staged running on unstaged files with my configuration?

I have husky and lint-staged set up in my package.json file and it runs, but on all files, whereas I would expect it to run on only staged files. "husky": { "hooks": { "pre-commit": "lint-staged" } }, "lint-staged": { "./**/*.js": [ …
zeckdude
  • 15,877
  • 43
  • 139
  • 187
2
votes
2 answers

lint-staged is running ng -lint for all the changed files instead of only staged files

I am trying to use husky with lint-staged for pre commit git hooks in angular5. Prettier formats only the staged files. But when I run ng lint command it runs on all the changed files instead of running on only staged files(I have 4 files modified,…
2
votes
0 answers

Linting only newly added files

I'm using lint-staged along with husky to run linters against all the staged files before commit. But my codebase is old; so don't want to run linters against existing (modified) files for now. Is there a way to run linters only against newly…
karthikaruna
  • 3,042
  • 7
  • 26
  • 37
2
votes
3 answers

Is there a way to run lint-staged only on new files (the ones that were untracked by git before)

On my project written in Typescript I want to start enforcing type annotations for returned types and parameter types of all functions. For that I created a separate tslint config that extends my main config and adds this rule on top of that. I'm…
dKab
  • 2,658
  • 5
  • 20
  • 35
1
vote
1 answer

Lint-staged throwing ESLint warning for ignored Storybook config file

I am currently developing a component library in React within a mono-repository. I have the lint-staged package to run my linting and unit testing NPM scripts when I make a commit to the repository. I'm currently experiencing a warning "File ignored…
1
vote
0 answers

validation error while committing code on git

I was working on angular java project. and while committing code i found below error. × Validation Error: Invalid value for 'linters': { '.@(js)': [ 'eslint --fix', 'git add' ], '.@(ts)': [ 'tslint --fix', 'git add' ] } Advanced configuration has…
1
vote
1 answer

Lint Staged: No staged files match any configured task

I have a react js application where i added husky with lint-staged. This is my lint staged config inside package.json file: "lint-staged": { "**/*.{js, ts, tsx}": [ "yarn format" ] }, NOTE: if i run yarn lint-staged i get No…
Asking
  • 3,487
  • 11
  • 51
  • 106
1
vote
0 answers

husky / lint-staged not running custom command or printing errors

I am trying to upgrade from husky@4.8 and lint-staged@11.2 to husky@8.0 and lint-staged@@13.1 for my Nx repo. It seems that the only configuration I used to need was the following in package.json: "scripts: { "lint:fix": "ng lint -- --fix && npm…
afriedman111
  • 1,925
  • 4
  • 25
  • 42
1
vote
1 answer

Add ts-prune to lint-staged

I'd like to run ts-prune in order to detect dead code on the files staged for commit using lint-staged. I've tried the following: "find-deadcode": "ts-prune -e", ... "lint-staged": { "*.{js,ts,tsx}": [ "npm run find-deadcode", "eslint…
rfc1484
  • 9,441
  • 16
  • 72
  • 123