Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(useExplicitLengthCheck): docs #2735

Merged
merged 1 commit into from
May 6, 2024
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ declare_rule! {
/// const isNotEmpty = !(foo.length === 0);
/// ```
/// ```js,expect_diagnostic
/// if (foo.length || bar.length) {}
/// if (foo.length) {}
/// ```
/// ```js,expect_diagnostic
/// const biome = foo.length ? 1 : 2
Expand All @@ -112,13 +112,13 @@ declare_rule! {
/// ```
///
/// ## Caveats
/// This rule assumes that the `length` property is always numeric, even if it actually is not.
/// In the example below the rule will trigger a warning, even though the `length` property is a string.
/// ```js
/// This rule assumes that the `length`/`size` property is always numeric, even if it actually is not.
/// In the example below the rule will trigger a warning, even though the `size` property is a string.
/// ```js,expect_diagnostic
/// const foo1 = { size: "small" }; if (foo1.size) {}
/// ```
/// To properly handle this case, type inference would be required, which is not supported by Biome at the moment.
/// We recommend disabling this rule when working with non-numeric `length` properties.
/// We recommend disabling this rule when working with non-numeric `length`/`size` properties.
///
pub UseExplicitLengthCheck {
version: "next",
Expand Down