How to setup lint-staged with turbo monorepo?

I have a turbo monorepo, with packages/... and apps/app-a, apps/app-b . I have set up husky pre-commit hook, which will run pnpm dlx lint-staged

I want lint-staged to run lint script from the closest to the staged file package.json file. So for example:

  1. staged foo.js from apps/app-a - it will run the lint script described in apps/app-a/package.json
  2. bar.js from apps/app-b will run lint from apps/app-b/package.json

etc.

Is that possible?

I tried to setup lintsatgedrc.json in the apps/app-a and apps/app-b folders, with

{ "*.{ts,tsx}": ["pnpm run lint", "pnpm run check-types"]
}

But its always try to run the lint and chack-types scripts from the monorepo's root package.json.

Related questions 0 npm ERR! code EJSONPARSE npm install with husky and lint-staged 1 pre commit rules failing when used with lint-staged 24 How do I get lint-staged working with Husky version 6 Related questions 0 npm ERR! code EJSONPARSE npm install with husky and lint-staged 1 pre commit rules failing when used with lint-staged 24 How do I get lint-staged working with Husky version 6 1 how to get the staged files in custom lint-staged scripts and how to debug the custom script file? 8 How to setup lint-staged for Vue projects? 0 Husky and lint-staged unable to run gulp command 4 error Command failed with exit code 1">lint-staged custom config > error Command failed with exit code 1 Load 4 more related questions Show fewer related questions Reset to default

Know someone who can answer? Share a link to this question via email, Twitter, or Facebook.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

You Might Also Like