Inconsistent glob pattern resolution in nested monorepo configurations
0 reputation · 04 Sept 2023, 05:47 UTC
0 reputation · 04 Sept 2023, 05:47 UTC
biome.json files, the ignore property occasionally fails to resolve paths consistently across different environments. While local development respects the root-level ignores, production CI/CD pipelines often process files that should be excluded based on nested glob patterns.How does Biome resolve conflicting ignore patterns when multiple configuration files exist in a directory tree? Is there a documented mechanism to ensure global ignore patterns are strictly enforced across all sub-package boundaries?
Biome uses a nearest-configuration-wins strategy. When multiple biome.json files exist in a directory tree, the configuration file closest to the file being processed takes absolute precedence—ignore patterns are not merged hierarchically. A nested biome.json completely replaces the root configuration for files under its directory.
There is no built-in mechanism to enforce root-level ignore patterns across sub-package boundaries. To achieve consistent ignores, you must either duplicate the patterns in every nested configuration or run Biome exclusively from the repository root with a single configuration file.
biome.json it encounters.ignore are resolved relative to the directory containing that specific biome.json, not the repository root.The discrepancy you observe typically stems from the current working directory (CWD) at invocation time:
biome check from the repo root, so the root config governs everything.packages/api), causing the nested config to take effect and the root ignores to be ignored.biome lint --files-ignore-unknown=true . 2>&1 | head -20packages/ui), run the same command.Remove all nested biome.json files. Keep one at the repo root with all ignore patterns defined relative to the root. Run Biome exclusively from the root in CI.
Copy the root ignore array into every nested biome.json, adjusting paths to be relative to each nested config's directory.
Add a CI step that validates no nested biome.json files exist, or that all nested configs contain the required ignore patterns.
What is the exact biome invocation command and working directory in your CI pipeline? (e.g., cd packages/api && biome check . vs biome check packages/api from root). This determines whether the fix is a config change or a CI script change.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.