Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

After update to 15.0.1, lerna + nx + lint-staged fails #1338

Closed
ac10n opened this issue Oct 17, 2023 · 2 comments · Fixed by #1339
Closed

After update to 15.0.1, lerna + nx + lint-staged fails #1338

ac10n opened this issue Oct 17, 2023 · 2 comments · Fixed by #1339

Comments

@ac10n
Copy link

ac10n commented Oct 17, 2023

Please note that debug logs are useless, as the task succeeds when run directly, or via lerna while nx is false.

In this PR in Taquito, after updating to lint-staged 15.x (this commit: 3b5e372c6d02082667c4934691c4079c36988c83) , the task npm run commit fails with the following errors:

@taquito/utils: > @taquito/utils@17.3.2 precommit
@taquito/utils: > lint-staged
✔ Preparing lint-staged...
@taquito/utils: ❯ Running tasks for staged files...
@taquito/utils:   ❯ package.json — 2 files
@taquito/utils:     ❯ {src,test}/**/*.ts — 1 file
@taquito/utils:       ✔ prettier --write
@taquito/utils:       ✔ eslint --fix
@taquito/utils: ◼ Applying modifications from tasks...
@taquito/utils: ◼ Cleaning up temporary files...
@taquito/utils: file:///home/alireza/work/ecad/taquito/node_modules/listr2/dist/index.js:914
@taquito/utils:         task.subtasks.some((subtask) => subtask.rendererOptions.collapseSubtasks === false) || // if any of the subtasks has failed
@taquito/utils:                                                                 ^
@taquito/utils: TypeError: Cannot read properties of undefined (reading 'collapseSubtasks')
@taquito/utils:     at file:///home/alireza/work/ecad/taquito/node_modules/listr2/dist/index.js:914:65
@taquito/utils:     at Array.some (<anonymous>)
@taquito/utils:     at file:///home/alireza/work/ecad/taquito/node_modules/listr2/dist/index.js:914:23
@taquito/utils:     at Array.flatMap (<anonymous>)
@taquito/utils:     at _DefaultRenderer.renderer (file:///home/alireza/work/ecad/taquito/node_modules/listr2/dist/index.js:810:18)
@taquito/utils:     at _DefaultRenderer.create (file:///home/alireza/work/ecad/taquito/node_modules/listr2/dist/index.js:713:30)
@taquito/utils:     at _DefaultRenderer.update (file:///home/alireza/work/ecad/taquito/node_modules/listr2/dist/index.js:694:23)
@taquito/utils:     at file:///home/alireza/work/ecad/taquito/node_modules/listr2/dist/index.js:686:14
@taquito/utils:     at Timeout._onTimeout (file:///home/alireza/work/ecad/taquito/node_modules/listr2/dist/index.js:537:9)
@taquito/utils:     at listOnTimeout (node:internal/timers:569:17)
@taquito/utils: Node.js v18.18.1
@taquito/utils: npm ERR! Lifecycle script `precommit` failed with error: 
@taquito/utils: npm ERR! Error: command failed 
@taquito/utils: npm ERR!   in workspace: @taquito/utils@17.3.2 
@taquito/utils: npm ERR!   at location: /home/alireza/work/ecad/taquito/packages/taquito-utils 

Project config:
packages/taquito-utils/package.json:

  "scripts": {
    "lint": "eslint --ext .js,.ts .",
    "precommit": "lint-staged"
  },
  "lint-staged": {
    "{src,test}/**/*.ts": [
      "prettier --write",
      "eslint --fix"
    ]
  },

.husky/pre-commit:

#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npm run precommit

package.json:

    "commit": "git-cz",
    "precommit": "lerna run --concurrency 1 --stream precommit",

and finally, lerna.json:

{
  "useNx": true,
  "version": "17.3.2"
}

Please note that if I set "useNx": false, everything will be fine.

  • OS: Fedora 38
  • Node.js: 18.18.1
  • lint-staged: 15.0.1
@iiroj
Copy link
Member

iiroj commented Oct 17, 2023

Thanks for the issue. Can you try "re-creating" your package-lock.json, I guess this might be related to some dependencies being wonky.

rm -rf node_modules package-lock.json
npm install

This will basically nuke the local modules and the lockfile, and then install fresh packages.

Let me know if it helps! Might also help to check out the Listr2 version is as expected:

% npm ls listr2 
lint-staged@15.0.1 /Volumes/Development/lint-staged
└── listr2@7.0.1

@iiroj
Copy link
Member

iiroj commented Oct 17, 2023

Never mind, there is an upstream lissue opened already: listr2/listr2#694

@iiroj iiroj linked a pull request Oct 18, 2023 that will close this issue
iiroj added a commit that referenced this issue Oct 19, 2023
This should fix issue #1338 by updating `listr2@7.0.2`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

2 participants