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.

Glob issues with 4.2.2 and Prettier

See original GitHub issue

Starting with lint-staged version 4.2.2 I have glob issues when using with husky and prettier. Here’s my lint-staged config:

"lint-staged": {
  "{app,test,config}/**/*.js": [
    "prettier --single-quote --tab-width 4 --print-width 100 --no-bracket-spacing --write",
    "eslint --fix --max-warnings 0",
    "git add"
  ]
}

And here’s the error from prettier:

husky > npm run -s precommit (node v6.11.3)

 ❯ Running tasks for {app,test,config}/**/*.js
   ✖ prettier --single-quote --tab-width 4 --print-width 100 --no-bracket-spacing --write
     → TypeError: patterns must be a string or an array of strings
     eslint --fix --max-warnings 0
     git add
✖ prettier --single-quote --tab-width 4 --print-width 100 --no-bracket-spacing --write found some errors. Please fix them and try committing again.

Unable to expand glob patterns: {app,test,config}/**/*.js 4 100 /home/user/dev/my-app/app/entity/myEntity.js !**/node_modules/** !./node_modules/**
TypeError: patterns must be a string or an array of strings

Anyways, thanks for making this awesome tool and if I have time this weekend I’d be glad to look into this problem myself, just wanted to get this out for others to look at ASAP.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:24 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
luftywiranda13commented, Sep 25, 2017

@cloud-walker IMO it’s not a good approach to name your npm scripts like this:

"scripts": {
  "eslint": "eslint ...",
  "stylelint": "stylelint ...",
  "jest": "jest..."
}

could you try to rename those scripts, for example to be:

"scripts": {
  "lint:js": "eslint src/** tools/**",
  "lint:styles": "stylelint \"src/**/*.css\"",
}

after that, run npm run precommit again. does lint-staged work as expected?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Issues updating ender 3 with a 4.2.2 board. : r/ender3 - Reddit
I tried moving the z, x, and y axes seperately but no go. Dissabling the stepper motors does work and the bed and...
Read more >
TypeScript and Prettier with Yarn PnP not working in 2021.1
Imports for npm packages are not being resolved and TypeScript defaults to the bundled language version I think which is 4.2.2. Prettier is...
Read more >
Prettier+ - Visual Studio Marketplace
Extension for Visual Studio Code - Prettier (code formatter) for the VS Code.
Read more >
Release Notes for MongoDB 4.4
All JIRA issues closed in 4.4.18 · 4.4.18 Changelog ... WT-7995 : Fix the global visibility that it cannot go beyond checkpoint visibility....
Read more >
Creality Ender 3 V2 Upgrades V4.2.7 Silent Board, 32 Bit ...
The Board is Optimized by Circuit, effectively solve the Heating Problem. ... Una para mi Ender 3 V2 que venia con la 4.2.2,...
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