pnpm: PNPM breaks lint-staged?

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 1
  • Comments: 16 (3 by maintainers)

Commits related to this issue

Most upvoted comments

For anyone that may be following this, it is no longer an issue in pnpm@^4.0.0.

Im trying to migrate from yarn to PNPM but lint-staged isnt working

"lint-staged": {
    "*.{js,ts,tsx}": [
      "pnpm eslint --fix",
      "prettier --write",
      "git add --force"
    ],
    "*.{ts,tsx}": [
      "pnpm run find-dead-code"
    ],
    "*.{md,graphql}": [
      "prettier --write",
      "git add --force"
    ],
    "*.css": [
      "stylelint --fix",
      "git add --force"
    ]
  },

ive tried both the npmrc fix above and adding rjxs but get × pnpm eslint --fix: ‘pnpm’ is not recognized as an internal or external command, operable program or batch file.

@nieltg I don’t remember. I don’t use lint-staged anymore, because pretty-quick fits my needs and is better maintained.

Another workaround which has worked for me - installing rxjs explicitly.

This is an issue with listr. Closing.

I will open a PR on that repo shortly. https://github.com/SamVerschueren/listr/pull/127

Yes, I ran pnpm i -D rxjs and the lint-staged script worked.

package.json after pnpm install:

{
  "name": "lint-staged-416",
  "version": "0.1.0",
  "devDependencies": {
    "husky": "^1.1.4",
    "lint-staged": "^8.0.5",
    "rxjs": "^6.3.3"
  },
  "husky": {
    "hooks": {
      "pre-commit": "lint-staged"
    }
  },
  "lint-staged": {
    "*.js": [
      "echo"
    ]
  }
}