This rule raises an issue when trimLeft() or trimRight() methods are used on strings.
The trimLeft() and trimRight() methods are deprecated aliases for trimStart() and trimEnd().
While they still work, they exist only for backward compatibility and may be removed in future JavaScript versions.
The newer method names are preferred because:
Using deprecated methods can make your code appear outdated and may cause issues if these aliases are eventually removed from JavaScript engines.
Using deprecated methods may lead to maintenance issues if the aliases are removed in future JavaScript versions. While the immediate impact is minimal, it can affect code consistency and maintainability.
Replace trimLeft() with trimStart() and trimRight() with trimEnd(). These methods have
identical functionality.
const text = ' hello world '; const leftTrimmed = text.trimLeft(); // Noncompliant const rightTrimmed = text.trimRight(); // Noncompliant
const text = ' hello world '; const leftTrimmed = text.trimStart(); const rightTrimmed = text.trimEnd();