prefer-string-trim-start-end
March 27, 2026 ยท View on GitHub
๐ Prefer String#trimStart() / String#trimEnd() over String#trimLeft() / String#trimRight().
๐ผ This rule is enabled in the following configs: โ
recommended, โ๏ธ unopinionated.
๐ง This rule is automatically fixable by the --fix CLI option.
String#trimLeft() and String#trimRight() are aliases of String#trimStart() and String#trimEnd(). This is to ensure consistency and use direction-independent wording.
Examples
// โ
const foo = bar.trimLeft();
// โ
const foo = bar.trimStart();
// โ
const foo = bar.trimRight();
// โ
const foo = bar.trimEnd();