Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions .claude/skills/biome-developer/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "../<crate_name>"`, 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_<name>`.

### Legacy and Deprecated Syntax

**DO:**
Expand Down
1 change: 1 addition & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 15 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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_<name>`.

## Node.js development

Expand Down
8 changes: 4 additions & 4 deletions crates/biome_cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down
4 changes: 2 additions & 2 deletions crates/biome_css_analyze/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "*" }
Expand Down
2 changes: 1 addition & 1 deletion crates/biome_css_formatter/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
Expand Down
2 changes: 1 addition & 1 deletion crates/biome_deserialize/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down
2 changes: 1 addition & 1 deletion crates/biome_graphql_parser/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down
2 changes: 1 addition & 1 deletion crates/biome_grit_parser/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down
14 changes: 7 additions & 7 deletions crates/biome_html_formatter/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"] }
Expand Down
4 changes: 2 additions & 2 deletions crates/biome_html_parser/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down
6 changes: 3 additions & 3 deletions crates/biome_js_analyze/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"] }
Expand Down
2 changes: 1 addition & 1 deletion crates/biome_js_formatter/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
Expand Down
10 changes: 5 additions & 5 deletions crates/biome_js_parser/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down
6 changes: 3 additions & 3 deletions crates/biome_js_type_info/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion crates/biome_json_analyze/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "*" }
Expand Down
2 changes: 1 addition & 1 deletion crates/biome_json_formatter/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
Expand Down
2 changes: 1 addition & 1 deletion crates/biome_json_parser/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down
2 changes: 1 addition & 1 deletion crates/biome_json_value/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
8 changes: 4 additions & 4 deletions crates/biome_markdown_formatter/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"] }
Expand Down
12 changes: 6 additions & 6 deletions crates/biome_module_graph/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down
2 changes: 1 addition & 1 deletion crates/biome_plugin_loader/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion crates/biome_service/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion crates/biome_tailwind_parser/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down
2 changes: 1 addition & 1 deletion crates/biome_yaml_formatter/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion crates/biome_yaml_parser/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down
Loading