Closed PixeledCode closed 1 year ago
I was not able to reproduce this with turbo@1.9.1
(latest as of today).
Can you try with that version and we can reopen if it's still broken?
I think I know what's going on here: lint-staged
is passing the list of changed files to the yarn lint
script. This script is not configured in such a way to handle individual files, as it is fanning out to running lint in each workspace. In this case I would configure lint-staged
to use eslint
directly, which can accept individual file paths.
I have same issue with Jest.
Root package.json
:
"lint-staged": {
"*.{js,ts,tsx}": [
"eslint --fix",
"turbo run test"
]
},
And have packages/ui/package.json
:
"test": "jest",
But "lint-staged" passes modified file name as an argument and tries to run task "test" in that file:
turbo run test:
ERROR run failed: error preparing engine: Could not find the following tasks in project: /dev/turborepo-demo/packages/ui/src/Button/Button.tsx
Turbo error: error preparing engine: Could not find the following tasks in project: /dev/turborepo-demo/packages/ui/src/Button/Button.tsx
My turbo.json
:
{
"$schema": "https://turbo.build/schema.json",
"pipeline": {
"build": {
"dependsOn": ["^build"],
"outputs": ["dist/**"]
},
"lint": {},
"test": {},
"dev": {
"cache": false,
"persistent": true
}
}
}
Current fix is adding --cwd
:
"turbo run test --cwd=./packages/ui -- --findRelatedTests --bail"
What version of Turborepo are you using?
1.8.8
What package manager are you using / does the bug impact?
Yarn v1
What operating system are you using?
Mac
Describe the Bug
The bug is related to #3364. Although it worked there, in my case, I am getting some other error after following the steps.
error An unexpected error occurred: "Cannot create property '-node-bit-dev' on string '{\"-node-bit-dev\":\"\"}'".
Repo: https://github.com/CivicDataLab/opub-mono.git
Full Error:
Expected Behavior
I should be able to use
husky
withlint-staged
To Reproduce
lint-staged
inpackage.json
<- This will break commitReproduction Repo
https://github.com/CivicDataLab/opub-mono.git