Skip to content

Integrated Monorepos

Some repositories have a single package.json, but consist of multiple projects with configuration files across the repository. A good example is the Nx integrated monorepo style.

Let’s assume some of these projects are applications (“apps”) which have their own ESLint configuration files and Cypress configuration and test files. This may result in those files getting reported as unused, and consequently also the dependencies they import and refer to.

In that case, we could configure the ESLint and Cypress plugins like this:

knip.json
{
"eslint": {
"config": ["**/.eslintrc.json"]
},
"cypress": {
"entry": ["apps/**/cypress.config.ts", "apps/**/cypress/e2e/*.spec.ts"]
}
}

Adapt the file patterns to your project, and the relevant config and entry files and dependencies should no longer be reported as unused.

ISC License © 2024 Lars Kappert