diff --git a/.claude/skills/biome-developer/SKILL.md b/.claude/skills/biome-developer/SKILL.md index dc9c47c878a2..479eb8d739b6 100644 --- a/.claude/skills/biome-developer/SKILL.md +++ b/.claude/skills/biome-developer/SKILL.md @@ -138,6 +138,34 @@ if let Some(directive) = VueDirective::cast_ref(&element) } ``` +### Cargo Dependencies: `workspace = true` vs `path = "..."` + +Internal `biome_*` crates listed under `[dev-dependencies]` **MUST** use `path = "../"`, not `workspace = true`. Using `workspace = true` for dev-dependencies can cause Cargo to resolve the crate from the registry instead of the local workspace, which is incorrect. + +Regular `[dependencies]` still use `workspace = true` as normal — this rule only applies to `[dev-dependencies]`. + +**DO:** +- Use `path = "../biome_foo"` for all `biome_*` dev-dependencies +- Preserve any extra attributes like `features` when converting + +**DON'T:** +- Do NOT use `workspace = true` for `biome_*` crates in `[dev-dependencies]` + +**Example:** +```toml +# WRONG: may resolve from registry +[dev-dependencies] +biome_js_parser = { workspace = true } +biome_formatter = { workspace = true, features = ["countme"] } + +# CORRECT: always resolves locally +[dev-dependencies] +biome_js_parser = { path = "../biome_js_parser" } +biome_formatter = { path = "../biome_formatter", features = ["countme"] } +``` + +All crates live as siblings under `crates/`, so the relative path is always `../biome_`. + ### Legacy and Deprecated Syntax **DO:** diff --git a/AGENTS.md b/AGENTS.md index 59606926abff..1e52363253d2 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -363,6 +363,7 @@ Before opening a PR, verify: - Claim patterns are "widely used" or "common" without evidence - Implement legacy/deprecated syntax without checking with the user first - Make assumptions about API design - inspect actual code structure first +- Use `workspace = true` for `biome_*` crates in `[dev-dependencies]` — use `path = "../biome_*"` instead ✅ **Do:** - Ask the user if unsure about changesets diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index a57db24f7f37..b196a365b9c0 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -341,7 +341,21 @@ To know the technical details of how our formatter works and how to write test, [Workspace dependencies](https://doc.rust-lang.org/cargo/reference/workspaces.html#the-dependencies-table) are used, and many dependencies are defined in Cargo.toml in the root. -Internal crates are loaded with `workspace = true` for each crate. About `dev-dependencies`, we use [path dependencies](https://doc.rust-lang.org/cargo/reference/specifying-dependencies.html#specifying-path-dependencies) to avoid requiring the published version of these crates. +Internal crates (`biome_*`) are loaded with `workspace = true` under `[dependencies]`. + +However, for `[dev-dependencies]`, internal `biome_*` crates **must** use [path dependencies](https://doc.rust-lang.org/cargo/reference/specifying-dependencies.html#specifying-path-dependencies) instead of `workspace = true`. This avoids resolving these crates from the registry when they are only needed for testing. + +```toml +[dependencies] +biome_parser = { workspace = true } # OK: workspace = true for regular deps + +[dev-dependencies] +biome_test_utils = { path = "../biome_test_utils" } # CORRECT +biome_formatter = { path = "../biome_formatter", features = ["countme"] } # CORRECT with features +# biome_test_utils = { workspace = true } # WRONG: do not use workspace for dev-deps +``` + +All internal crates live as siblings under `crates/`, so the relative path is always `../biome_`. ## Node.js development diff --git a/crates/biome_cli/Cargo.toml b/crates/biome_cli/Cargo.toml index fa90e6ebcc08..a1cb59f88ae6 100644 --- a/crates/biome_cli/Cargo.toml +++ b/crates/biome_cli/Cargo.toml @@ -82,10 +82,10 @@ tracing-subscriber = { workspace = true, features = ["env-filter", "json"] tracing-tree = "0.4.1" [dev-dependencies] -biome_css_formatter = { workspace = true } -biome_js_formatter = { workspace = true } -biome_json_formatter = { workspace = true } -biome_json_parser = { workspace = true } +biome_css_formatter = { path = "../biome_css_formatter" } +biome_js_formatter = { path = "../biome_js_formatter" } +biome_json_formatter = { path = "../biome_json_formatter" } +biome_json_parser = { path = "../biome_json_parser" } directories = { workspace = true } insta = { workspace = true } regex = { workspace = true } diff --git a/crates/biome_css_analyze/Cargo.toml b/crates/biome_css_analyze/Cargo.toml index c2d43d6f4124..3a2344f8d29f 100644 --- a/crates/biome_css_analyze/Cargo.toml +++ b/crates/biome_css_analyze/Cargo.toml @@ -40,8 +40,8 @@ serde = { workspace = true, features = ["derive"] } [dev-dependencies] biome_css_parser = { path = "../biome_css_parser" } -biome_fs = { workspace = true } -biome_plugin_loader = { workspace = true } +biome_fs = { path = "../biome_fs" } +biome_plugin_loader = { path = "../biome_plugin_loader" } biome_test_utils = { path = "../biome_test_utils" } camino = { workspace = true } criterion = { package = "codspeed-criterion-compat", version = "*" } diff --git a/crates/biome_css_formatter/Cargo.toml b/crates/biome_css_formatter/Cargo.toml index 42c4993d8bb7..0bec6f05ae00 100644 --- a/crates/biome_css_formatter/Cargo.toml +++ b/crates/biome_css_formatter/Cargo.toml @@ -33,7 +33,7 @@ biome_suppression = { workspace = true } biome_configuration = { path = "../biome_configuration" } biome_css_parser = { path = "../biome_css_parser" } biome_css_syntax = { path = "../biome_css_syntax", features = ["scss"] } -biome_formatter = { workspace = true, features = ["countme"] } +biome_formatter = { path = "../biome_formatter", features = ["countme"] } biome_formatter_test = { path = "../biome_formatter_test" } biome_fs = { path = "../biome_fs" } biome_parser = { path = "../biome_parser" } diff --git a/crates/biome_deserialize/Cargo.toml b/crates/biome_deserialize/Cargo.toml index 5923b80cbaeb..b138cf527784 100644 --- a/crates/biome_deserialize/Cargo.toml +++ b/crates/biome_deserialize/Cargo.toml @@ -28,7 +28,7 @@ serde_json = { workspace = true, optional = true } smallvec = { workspace = true, optional = true } [dev-dependencies] -biome_deserialize_macros = { workspace = true } +biome_deserialize_macros = { path = "../biome_deserialize_macros" } [features] camino = ["dep:camino"] diff --git a/crates/biome_graphql_parser/Cargo.toml b/crates/biome_graphql_parser/Cargo.toml index 044974f24368..f6442af86979 100644 --- a/crates/biome_graphql_parser/Cargo.toml +++ b/crates/biome_graphql_parser/Cargo.toml @@ -29,7 +29,7 @@ tracing = { workspace = true } unicode-bom = { workspace = true } [dev-dependencies] -biome_test_utils = { workspace = true } +biome_test_utils = { path = "../biome_test_utils" } criterion = { package = "codspeed-criterion-compat", version = "*" } insta = { workspace = true } quickcheck = { workspace = true } diff --git a/crates/biome_grit_parser/Cargo.toml b/crates/biome_grit_parser/Cargo.toml index 4cc6d7e9767b..9d1e0ac14121 100644 --- a/crates/biome_grit_parser/Cargo.toml +++ b/crates/biome_grit_parser/Cargo.toml @@ -30,7 +30,7 @@ tracing = { workspace = true } unicode-bom = { workspace = true } [dev-dependencies] -biome_test_utils = { workspace = true } +biome_test_utils = { path = "../biome_test_utils" } insta = { workspace = true } quickcheck = { workspace = true } quickcheck_macros = { workspace = true } diff --git a/crates/biome_html_formatter/Cargo.toml b/crates/biome_html_formatter/Cargo.toml index 86f9deddc0b6..8f1ffe0b72d6 100644 --- a/crates/biome_html_formatter/Cargo.toml +++ b/crates/biome_html_formatter/Cargo.toml @@ -28,13 +28,13 @@ schemars = { workspace = true, optional = true } serde = { workspace = true, optional = true } [dev-dependencies] -biome_configuration = { workspace = true } -biome_formatter = { workspace = true, features = ["countme"] } -biome_formatter_test = { workspace = true } -biome_fs = { workspace = true } -biome_html_parser = { workspace = true } -biome_parser = { workspace = true } -biome_service = { workspace = true } +biome_configuration = { path = "../biome_configuration" } +biome_formatter = { path = "../biome_formatter", features = ["countme"] } +biome_formatter_test = { path = "../biome_formatter_test" } +biome_fs = { path = "../biome_fs" } +biome_html_parser = { path = "../biome_html_parser" } +biome_parser = { path = "../biome_parser" } +biome_service = { path = "../biome_service" } biome_test_utils = { path = "../biome_test_utils" } camino = { workspace = true } countme = { workspace = true, features = ["enable"] } diff --git a/crates/biome_html_parser/Cargo.toml b/crates/biome_html_parser/Cargo.toml index 2bd0512a6148..61267563268a 100644 --- a/crates/biome_html_parser/Cargo.toml +++ b/crates/biome_html_parser/Cargo.toml @@ -26,8 +26,8 @@ biome_unicode_table = { workspace = true } tracing = { workspace = true } [dev-dependencies] -biome_string_case = { workspace = true } -biome_test_utils = { workspace = true } +biome_string_case = { path = "../biome_string_case" } +biome_test_utils = { path = "../biome_test_utils" } camino = { workspace = true } criterion = { package = "codspeed-criterion-compat", version = "*" } insta = { workspace = true } diff --git a/crates/biome_js_analyze/Cargo.toml b/crates/biome_js_analyze/Cargo.toml index 9deacca8e9aa..c23f8477479c 100644 --- a/crates/biome_js_analyze/Cargo.toml +++ b/crates/biome_js_analyze/Cargo.toml @@ -57,10 +57,10 @@ serde = { workspace = true, features = ["derive"] } smallvec = { workspace = true } [dev-dependencies] -biome_fs = { workspace = true } +biome_fs = { path = "../biome_fs" } biome_js_parser = { path = "../biome_js_parser", features = ["tests"] } -biome_plugin_loader = { workspace = true } -biome_service = { workspace = true } +biome_plugin_loader = { path = "../biome_plugin_loader" } +biome_service = { path = "../biome_service" } biome_test_utils = { path = "../biome_test_utils" } criterion = { package = "codspeed-criterion-compat", version = "*" } insta = { workspace = true, features = ["glob"] } diff --git a/crates/biome_js_formatter/Cargo.toml b/crates/biome_js_formatter/Cargo.toml index de01910e44ef..f8dd6a948a48 100644 --- a/crates/biome_js_formatter/Cargo.toml +++ b/crates/biome_js_formatter/Cargo.toml @@ -40,7 +40,7 @@ smallvec = { workspace = true } unicode-width = { workspace = true } [dev-dependencies] -biome_formatter = { workspace = true, features = ["countme"] } +biome_formatter = { path = "../biome_formatter", features = ["countme"] } biome_formatter_test = { path = "../biome_formatter_test" } biome_fs = { path = "../biome_fs" } biome_js_factory = { path = "../biome_js_factory" } diff --git a/crates/biome_js_parser/Cargo.toml b/crates/biome_js_parser/Cargo.toml index f795d64a08aa..fc1663eb2ec5 100644 --- a/crates/biome_js_parser/Cargo.toml +++ b/crates/biome_js_parser/Cargo.toml @@ -38,11 +38,11 @@ smallvec = { workspace = true } tracing = { workspace = true } [dev-dependencies] -biome_configuration = { workspace = true } -biome_deserialize = { workspace = true } -biome_fs = { workspace = true } -biome_service = { workspace = true } -biome_test_utils = { workspace = true } +biome_configuration = { path = "../biome_configuration" } +biome_deserialize = { path = "../biome_deserialize" } +biome_fs = { path = "../biome_fs" } +biome_service = { path = "../biome_service" } +biome_test_utils = { path = "../biome_test_utils" } camino = { workspace = true } criterion = { package = "codspeed-criterion-compat", version = "*" } insta = { workspace = true } diff --git a/crates/biome_js_type_info/Cargo.toml b/crates/biome_js_type_info/Cargo.toml index ecb626a8f0a7..169a1196c03f 100644 --- a/crates/biome_js_type_info/Cargo.toml +++ b/crates/biome_js_type_info/Cargo.toml @@ -24,9 +24,9 @@ paste = "1.0.15" rustc-hash = { workspace = true } [dev-dependencies] -biome_js_formatter = { workspace = true } -biome_js_parser = { workspace = true } -biome_test_utils = { workspace = true } +biome_js_formatter = { path = "../biome_js_formatter" } +biome_js_parser = { path = "../biome_js_parser" } +biome_test_utils = { path = "../biome_test_utils" } insta = { workspace = true } [lints] diff --git a/crates/biome_json_analyze/Cargo.toml b/crates/biome_json_analyze/Cargo.toml index 286653753ca7..a060b951009d 100644 --- a/crates/biome_json_analyze/Cargo.toml +++ b/crates/biome_json_analyze/Cargo.toml @@ -33,7 +33,7 @@ camino = { workspace = true } rustc-hash = { workspace = true } [dev-dependencies] -biome_configuration = { workspace = true } +biome_configuration = { path = "../biome_configuration" } biome_json_parser = { path = "../biome_json_parser" } biome_test_utils = { path = "../biome_test_utils" } criterion = { package = "codspeed-criterion-compat", version = "*" } diff --git a/crates/biome_json_formatter/Cargo.toml b/crates/biome_json_formatter/Cargo.toml index ba72376c31f1..33bfbf254039 100644 --- a/crates/biome_json_formatter/Cargo.toml +++ b/crates/biome_json_formatter/Cargo.toml @@ -34,7 +34,7 @@ schemars = { workspace = true, optional = true } serde = { workspace = true, features = ["derive"], optional = true } [dev-dependencies] -biome_formatter = { workspace = true, features = ["countme"] } +biome_formatter = { path = "../biome_formatter", features = ["countme"] } biome_formatter_test = { path = "../biome_formatter_test" } biome_fs = { path = "../biome_fs" } biome_json_parser = { path = "../biome_json_parser" } diff --git a/crates/biome_json_parser/Cargo.toml b/crates/biome_json_parser/Cargo.toml index 5382088f2678..bc9920ceefa5 100644 --- a/crates/biome_json_parser/Cargo.toml +++ b/crates/biome_json_parser/Cargo.toml @@ -31,7 +31,7 @@ tracing = { workspace = true } unicode-bom = { workspace = true } [dev-dependencies] -biome_test_utils = { workspace = true } +biome_test_utils = { path = "../biome_test_utils" } criterion = { package = "codspeed-criterion-compat", version = "*" } insta = { workspace = true } quickcheck = { workspace = true } diff --git a/crates/biome_json_value/Cargo.toml b/crates/biome_json_value/Cargo.toml index 21795923a088..dedcd039ad7a 100644 --- a/crates/biome_json_value/Cargo.toml +++ b/crates/biome_json_value/Cargo.toml @@ -21,7 +21,7 @@ rustc-hash = { workspace = true } static_assertions = { workspace = true } [dev-dependencies] -biome_json_parser = { workspace = true } +biome_json_parser = { path = "../biome_json_parser" } [lints] workspace = true diff --git a/crates/biome_markdown_formatter/Cargo.toml b/crates/biome_markdown_formatter/Cargo.toml index 60aacd79484b..12ad4b029f65 100644 --- a/crates/biome_markdown_formatter/Cargo.toml +++ b/crates/biome_markdown_formatter/Cargo.toml @@ -18,11 +18,11 @@ schemars = { workspace = true, optional = true } serde = { workspace = true, features = ["derive"], optional = true } [dev-dependencies] -biome_configuration = { workspace = true } -biome_formatter_test = { workspace = true } +biome_configuration = { path = "../biome_configuration" } +biome_formatter_test = { path = "../biome_formatter_test" } biome_fs = { path = "../biome_fs" } -biome_markdown_parser = { workspace = true } -biome_parser = { workspace = true } +biome_markdown_parser = { path = "../biome_markdown_parser" } +biome_parser = { path = "../biome_parser" } biome_service = { path = "../biome_service", features = ["markdown"] } camino = { workspace = true } countme = { workspace = true, features = ["enable"] } diff --git a/crates/biome_module_graph/Cargo.toml b/crates/biome_module_graph/Cargo.toml index b7b7b297fce1..c0e75c979229 100644 --- a/crates/biome_module_graph/Cargo.toml +++ b/crates/biome_module_graph/Cargo.toml @@ -42,12 +42,12 @@ serde_json = { workspace = true } static_assertions = { workspace = true } [dev-dependencies] -biome_deserialize = { workspace = true } -biome_js_formatter = { workspace = true } -biome_js_parser = { workspace = true } -biome_json_parser = { workspace = true } -biome_json_value = { workspace = true } -biome_test_utils = { workspace = true } +biome_deserialize = { path = "../biome_deserialize" } +biome_js_formatter = { path = "../biome_js_formatter" } +biome_js_parser = { path = "../biome_js_parser" } +biome_json_parser = { path = "../biome_json_parser" } +biome_json_value = { path = "../biome_json_value" } +biome_test_utils = { path = "../biome_test_utils" } divan = { package = "codspeed-divan-compat", version = "=4.2.1" } insta = { workspace = true } walkdir = { workspace = true } diff --git a/crates/biome_plugin_loader/Cargo.toml b/crates/biome_plugin_loader/Cargo.toml index 4f14221ed983..e5ef7dc4dc79 100644 --- a/crates/biome_plugin_loader/Cargo.toml +++ b/crates/biome_plugin_loader/Cargo.toml @@ -38,7 +38,7 @@ schemars = { workspace = true, optional = true } serde = { workspace = true } [dev-dependencies] -biome_js_parser = { workspace = true } +biome_js_parser = { path = "../biome_js_parser" } insta = { workspace = true } [target.'cfg(unix)'.dependencies] diff --git a/crates/biome_service/Cargo.toml b/crates/biome_service/Cargo.toml index da6d7e644097..4e61f6f46d8e 100644 --- a/crates/biome_service/Cargo.toml +++ b/crates/biome_service/Cargo.toml @@ -86,7 +86,7 @@ tracing = { workspace = true, features = ["attributes", "log"] web-time = { workspace = true } [dev-dependencies] -biome_configuration = { workspace = true, features = ["test-utils"] } +biome_configuration = { path = "../biome_configuration", features = ["test-utils"] } insta = { workspace = true } [features] diff --git a/crates/biome_tailwind_parser/Cargo.toml b/crates/biome_tailwind_parser/Cargo.toml index bfe2f2f48143..9e32906f1f17 100644 --- a/crates/biome_tailwind_parser/Cargo.toml +++ b/crates/biome_tailwind_parser/Cargo.toml @@ -26,7 +26,7 @@ biome_unicode_table = { workspace = true } tracing = { workspace = true } [dev-dependencies] -biome_test_utils = { workspace = true } +biome_test_utils = { path = "../biome_test_utils" } camino = { workspace = true } criterion = { package = "codspeed-criterion-compat", version = "*" } insta = { workspace = true } diff --git a/crates/biome_yaml_formatter/Cargo.toml b/crates/biome_yaml_formatter/Cargo.toml index cba11db73f85..a74ba160cbcd 100644 --- a/crates/biome_yaml_formatter/Cargo.toml +++ b/crates/biome_yaml_formatter/Cargo.toml @@ -28,7 +28,7 @@ schemars = { workspace = true, optional = true } serde = { workspace = true, features = ["derive"], optional = true } [dev-dependencies] -biome_formatter = { workspace = true, features = ["countme"] } +biome_formatter = { path = "../biome_formatter", features = ["countme"] } biome_yaml_parser = { path = "../biome_yaml_parser" } [features] diff --git a/crates/biome_yaml_parser/Cargo.toml b/crates/biome_yaml_parser/Cargo.toml index d7a88ae62ed5..9181ae0e576b 100644 --- a/crates/biome_yaml_parser/Cargo.toml +++ b/crates/biome_yaml_parser/Cargo.toml @@ -22,7 +22,7 @@ biome_yaml_syntax = { workspace = true } tracing = { workspace = true } [dev-dependencies] -biome_test_utils = { workspace = true } +biome_test_utils = { path = "../biome_test_utils" } insta = { workspace = true } quickcheck = { workspace = true } quickcheck_macros = { workspace = true }