Skip to content

Commit

Permalink
fix(useExplicitLengthCheck): docs (#2735)
Browse files Browse the repository at this point in the history
  • Loading branch information
Sec-ant committed May 6, 2024
1 parent 84b256f commit 3bbaee0
Showing 1 changed file with 5 additions and 5 deletions.
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

0 comments on commit 3bbaee0

Please sign in to comment.