diff --git a/crates/ruff_dev/src/generate_ty_options.rs b/crates/ruff_dev/src/generate_ty_options.rs index bf8a5e4c2f..27d4865089 100644 --- a/crates/ruff_dev/src/generate_ty_options.rs +++ b/crates/ruff_dev/src/generate_ty_options.rs @@ -222,6 +222,13 @@ fn format_snippet( .chain(scope) .join("."); + // Some examples show headers which would show up in `pyproject.toml`, + if matches!(configuration, ConfigurationFile::TyToml) { + if example.contains("tool.ty") { + return (String::new(), example.replace("tool.ty.", "")); + } + } + // Ex) `[[tool.ty.xx]]` if example.starts_with(&format!("[[{header}")) { return (String::new(), example.to_string()); @@ -232,13 +239,6 @@ fn format_snippet( return (String::new(), example.to_string()); } - // Some examples show headers which would show up in `pyproject.toml`, - if matches!(configuration, ConfigurationFile::TyToml) { - if example.starts_with("[[tool.ty") || example.starts_with("[tool.ty") { - return (String::new(), example.replace("tool.ty.", "")); - } - } - if header.is_empty() { (String::new(), example.to_string()) } else { diff --git a/crates/ty/docs/configuration.md b/crates/ty/docs/configuration.md index 1da19b4bea..eeffda659b 100644 --- a/crates/ty/docs/configuration.md +++ b/crates/ty/docs/configuration.md @@ -31,7 +31,7 @@ Valid severities are: === "ty.toml" ```toml - [tool.ty.rules] + [rules] possibly-unresolved-reference = "warn" division-by-zero = "ignore" ```