Skip to content

Commit

Permalink
chore: add String.
Browse files Browse the repository at this point in the history
  • Loading branch information
chansuke committed Jun 14, 2024
1 parent cc77c20 commit c007dbe
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ use biome_rowan::{AstSeparatedList, BatchMutationExt, TextRange, TokenText};
use crate::JsRuleAction;

declare_rule! {
/// Enforce the use of `trimStart()` and `trimEnd()` over `trimLeft()` and `trimRight()`.
/// Enforce the use of `String.trimStart()` and `String.trimEnd()` over `String.trimLeft()` and `String.trimRight()`.
///
/// While `trimLeft()` and `trimRight()` are aliases for `trimStart()` and `trimEnd()`,
/// While `String.trimLeft()` and `String.trimRight()` are aliases for `String.trimStart()` and `String.trimEnd()`,
/// only using the latter pair ensures consistency and is preferable for their direction-independent wording.
///
/// Note that `trimStart()` and `trimEnd()` methods do not take any parameters. Any arguments passed to these methods will be ignored.
/// Note that `String.trimStart()` and `String.trimEnd()` methods do not take any parameters. Any arguments passed to these methods will be ignored.
/// See the MDN documentation for more details:
/// - [String.prototype.trimStart()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/trimStart)
/// - [String.prototype.trimEnd()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/trimEnd)
Expand Down Expand Up @@ -71,7 +71,7 @@ impl Rule for UseTrimStartEnd {
let args = arguments.args();

if !args.is_empty() {
// If arguments are present, it suggests this function call may not be intended for `trimStart()` or `trimEnd()`,
// If arguments are present, it suggests this function call may not be intended for `String.trimStart()` or `String.trimEnd()`,
// as these methods do not accept parameters according to the specification:
// - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/trimStart#parameters
// - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/trimEnd#parameters
Expand Down

0 comments on commit c007dbe

Please sign in to comment.