Skip to main content

๐ŸŒŽ Monorepo support

General guidelinesโ€‹

While Sheriff can technically be used at the root of monorepos, it's not recommended.
It works best when applied to individual packages within a monorepo.

Examplesโ€‹

โ”œโ”€โ”€ apps
โ”‚ โ”œโ”€โ”€ website
โ”‚ โ”‚ โ””โ”€โ”€ eslint.config.js
โ”‚ โ”œโ”€โ”€ docs
โ”‚ โ”‚ โ””โ”€โ”€ eslint.config.js
โ”œโ”€โ”€ packages
โ”‚ โ”œโ”€โ”€ ui
โ”‚ โ”‚ โ””โ”€โ”€ eslint.config.js
โ”‚ โ”œโ”€โ”€ utils
โ”‚ โ”‚ โ””โ”€โ”€ eslint.config.js
โ”‚ โ”œโ”€โ”€ types
โ”‚ โ”‚ โ””โ”€โ”€ eslint.config.js
โ”œโ”€โ”€ node_modules
โ”œโ”€โ”€ README
โ”œโ”€โ”€ package.json
โ”œโ”€โ”€ pnpm-lock.yaml
โ””โ”€โ”€ .gitignore
โ”œโ”€โ”€ apps
โ”‚ โ”œโ”€โ”€ website
โ”‚ โ”œโ”€โ”€ docs
โ”œโ”€โ”€ packages
โ”‚ โ”œโ”€โ”€ ui
โ”‚ โ”œโ”€โ”€ utils
โ”‚ โ”œโ”€โ”€ types
โ”œโ”€โ”€ node_modules
โ”œโ”€โ”€ eslint.config.js
โ”œโ”€โ”€ README
โ”œโ”€โ”€ package.json
โ”œโ”€โ”€ pnpm-lock.yaml
โ””โ”€โ”€ .gitignore

Usage in VSCodeโ€‹

To make use of the ESLint VScode extension in monorepos, use the eslint.workingDirectories setting.

Setup with npm init sheriff-configโ€‹

If you want to use npm init sheriff-config to bootstrap Sheriff in one of your workspace' packages, you can actually do so by following the general usage rules of workspaces, Sheriff will try to mimic the behaviour of popular monorepo CLI tools, so it will feel seamless, intuitive and familiar.

Run the command from the root of your monorepo, and then filter by the workspace you want to apply Sheriff to. A chain of prompts will start to guide you through the correct process of installation.

Examples:

npm init sheriff-config --filter=packages/my-package