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.

No staged files match any of provided globs

See original GitHub issue

Description

Folder Structure

folder Structure

Both client and server have package.json with different lint-staged config

client/package.json

"husky": {
    "hooks": {
      "pre-commit": "lint-staged",
      "pre-push": "lint-staged"
    }
  },
  "lint-staged": {
    "*": [
      "prettier --write",
      "eslint",
      "git add"
    ]
  }

server/package.json

"husky": {
    "hooks": {
      "pre-commit": "lint-staged",
      "pre-push": "lint-staged"
    }
  },
  "lint-staged": {
    "*.js": [
      "prettier --write",
      "eslint",
      "git add"
    ]
  }

lint-stage is working on the staged files of the server folder but not working staged files of the client folder instead it complains about No staged files match any of provided globs. But if I run npx lint-staged -d from the client folder using cmd, lint-stage works on staged files of the client folder.

Environment

  • OS: Windows 10
  • Node.js: v10.15.0
  • lint-staged: 9.2.0

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:14
  • Comments:23

github_iconTop GitHub Comments

39reactions
uzikiloncommented, Mar 22, 2020

removing the node_modules folder and running npm install solved this for me.

8reactions
aloeugenecommented, Mar 19, 2020

I have the same issue.

Folder structure is the following:

client
  package.json // with local pre-commit rules (src/**/*.{js,jsx})

server
  package.json // with local pre-commit rules (src/**/*.ts)

The one in the ‘server’ folder works fine, but the one in client just throws: No staged files match any of provided globs

Both husky and lint-staged versions in both directories are the same.

Read more comments on GitHub >

github_iconTop Results From Across the Web

No staged files match any of provided globs - Stack Overflow
The problem is caused by the cache,you can try to change your code as you like.Then git add.,Then git commit -m ... you...
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 >
Files changed (35) - Renovate Bot Package Diff
A git stash is created before running any tasks, so in case of errors any lost changes can be ... logger.log('No staged files...
Read more >
Diving into Husky and Lint-staged | Laurie on Tech
Pre-push · Run ESLint against all the files: eslint '*.js' · Diff against main : eslint --no-error-on-unmatched-pattern $(git diff main... --name- ...
Read more >
lint-staged: Lint Your Staged Files | Karuppiah's Blog
lint-staged will take care of passing the file path of the staged files as it's the one that knows which files are staged...
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