Closed pt232 closed 1 year ago
I'm guessing that lint-staged is calling npm run lint
and passes it some file arguments. Since npm run lint
calls turbo run lint
, this argument is getting passed directly, becoming:
turbo run lint {path-to-file}/apps/web/pages/index.tsx`
turbo interprets that last argument as a task name, which it isn't.
Try changing your .lintstagedrc
file to:
{
"*.{js,ts,tsx}": ["npm run format", "npm run lint --"],
"*.json": ["npm run format"]
}
(notice the extra --
after npm run lint
)
Ultimately you're trying to produce this command: turbo run lint -- <path>
https://turbo.build/repo/docs/reference/command-line-reference#turbo-run-task
Great, now it works. Adding the --
directly to the lint-staged config file didn't work out, but I added it to the package.json as follows:
{
"scripts": {
"build": "turbo run build",
"dev": "turbo run dev --parallel",
- "lint": "turbo run lint",
+ "lint": "turbo run lint --",
"format": "prettier --write \"**/*.{ts,tsx,md}\"",
"prepare": "husky install"
},
}
Great! Glad it worked out @pt232!
Are you all sure it work? It does not throw error now, BUT the range is not scoped as lint-staged, it's command effect on ALL files in you moorepo!
I just modified 3 files in my monorepo project, but the lint-staged with prettier
cost almost 10 mins!
And what's worse, these config and ignore files in every project of monorepo cannot effect on their own project now
Can confirm this wont fix, will behave the same as calling your lint script directly from the git hook without lint-staged
Added --
but still not work with bun 1.1.20
What version of Turborepo are you using?
1.7.0
What package manager are you using / does the bug impact?
npm
What operating system are you using?
Windows
Describe the Bug
I would like to use
turbo
scripts (liketurbo run lint
) in combination with lint-staged. However, I get the following error message when linting:index.tsx in this case is the file where I made changes for the commit.
If I add the changed file to the turbo.json file, then it works. But I guess that's not the point. π Maybe this problem is also related to lint-staged rather than turborepo.
By the way: other npm scripts (like
npm run format
) run without errors.Thanks for your help!
Expected Behavior
I would have expected to be able to run simple
turbo
scripts. But maybe the whole thing is not possible at all.To Reproduce
Run the following commands to reproduce this issue:
npx lint-staged --concurrent false
to the .husky/pre-commit hookI have the following package.json:
And the following turbo.json:
Reproduction Repo
No response