question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Lint staged not working, no error, no warning

See original GitHub issue

I followed this example https://github.com/okonet/lint-staged#installation-and-setup

Have this in my package.json

 "scripts": {
    
    "pre-commit": "lint-staged"
  },

and added this to my .lintstagedrc file

{
	"*.css": "stylelint",
	"*.scss": "stylelint --syntax=scss"
}

Latest OSX, Node version v6.10.0 and npm version 3.10.10

I had stylelint installed already and my stylelint works fine if I run via my grunt task. grunt stylelint

I made a change to my existing .scss file but don’t get anything in CLI when I add files to staging and commit. Things just work like there is no lint-staged.

Edited

I followed this article https://medium.com/@okonetchnikov/make-linting-great-again-f3890e1ad6b8

// package.json
...
"scripts" {
 "lint-staged": "lint-staged",
 "stylelint-staged": "stylelint --syntax scss"
},
"lint-staged": {
 "*.js": "eslint",
 "*.scss": "stylelint-staged"
},
"pre-commit": "lint-staged"
...

and it worked but I get this warning too after linting errors

pre-commit: 
pre-commit: We've failed to pass the specified git pre-commit hooks as the `lint-staged`
pre-commit: hook returned an exit code (1). If you're feeling adventurous you can
pre-commit: skip the git pre-commit hooks by adding the following flags to your commit:
pre-commit: 
pre-commit:   git commit -n (or --no-verify)
pre-commit: 
pre-commit: This is ill-advised since the commit is broken.
pre-commit: 

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:8
  • Comments:22 (5 by maintainers)

github_iconTop GitHub Comments

4reactions
jitendravyascommented, May 12, 2017

I ran rm -rf node_modules and npm install again. after deleting .git/hooks/pre-commit file and setup everything again from here https://github.com/okonet/lint-staged#installation-and-setup

Now I’m back to this error again https://github.com/okonet/lint-staged/issues/165#issuecomment-301003092

1reaction
luckspcommented, Sep 20, 2019

i ran npm ci because I couldn’t get lint-staged to work either. On re-install i saw a message in terminal:

husky > Setting up git hooks Husky requires Git >= 2.13.2, please update Git husky > Failed to install

So i ran git --version. I am on 2.9. So I updated git to 2.23 and ran npm ci again with a successful install.

now when I try to commit files my lint-staged hook runs and I see errors as expected.

Read more comments on GitHub >

github_iconTop Results From Across the Web

lint-staged not running on precommit - Stack Overflow
The problem for me was I ran "npx mrm lint-staged" like the official website says but it only set the husky and lint-staged...
Read more >
lint-staged - npm
Linter commands work on a subset of all staged files, defined by a glob pattern. lint-staged uses micromatch for matching files with the ......
Read more >
Lint Staged With Husky for Pre-commit Validations - YouTube
Learn how to use lint staged with husky to implement linting and formatting your code with Prettier and Eslint on pre-commit.
Read more >
Husky + Lint-Staged on a React TypeScript Project
Using the ESLint auto-fix and Lint-Staged: problem solved! · “src/**/*.{js,ts,jsx,tsx}” tells that lint-staged will run some action just over the ...
Read more >
using ESLint in lint-staged is preventing me from checking in ...
the balloon show no errors only warnings. My peers using VSCode do not have any issues so I assume this is a Webstorm...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found