biome: π Nested biome.json files in monorepo not detected
Environment information
CLI:
Version: 1.4.0
Color support: true
Platform:
CPU Architecture: aarch64
OS: macos
Environment:
BIOME_LOG_DIR: unset
NO_COLOR: unset
TERM: "xterm-256color"
JS_RUNTIME_VERSION: "v16.14.0"
JS_RUNTIME_NAME: "node"
NODE_PACKAGE_MANAGER: "npm/8.3.1"
Biome Configuration:
Status: Loaded successfully
Formatter disabled: false
Linter disabled: false
Organize imports disabled: false
VCS disabled: true
Workspace:
Open Documents: 0
What happened?
I have created a repo here that reproduces the error
https://github.com/ozziexsh/biome-monorepo-error
I have a root biome.json
file which has a rule "noUndeclaredVariables": "error"
and a packages/one/biome.json
that has
"extends": ["../../biome.json"],
"javascript": {
"globals": ["someGlobal"]
}
which should allow a global variable only in the packages/one
folder. The VSCode extension highlights this global as undeclared, the same output happens while running the lint command via the cli.
If you add the global to the root biome.json
the error goes away.
Expected result
The packages/one/biome.json
file should be respected in the packages/one
folder
Code of Conduct
- I agree to follow Biomeβs Code of Conduct
About this issue
- Original URL
- State: closed
- Created 7 months ago
- Reactions: 3
- Comments: 16 (9 by maintainers)
Iβll take on this task.
Nesting configuration files are a known limitation. You can track progresses and/or help in #2228
As a workaround, I suggest you to always have a
biome.json
file at the root of your project, and useinclude
/ignore
/overrides
to identify the folders that need to be checked.I have a specific use case here, I use biome in a monorepo, where there is a an API app and a front end app, the API app enforces a rule to prevent using the process.env global outside of a few files, because the api is configured by a single package file. However, the front app uses nextjs, and it has its own idiomatic rules, I find using overrides at the root a bit cumbersome.
For me, the need is that Iβm trying to share a common
biome.json
config among internal projects inside a turbo monorepo. But also expose it as an NPM package for other projects to be able to consume it.e.g.
Yes, the same output happens while running the lint command via the cli