biome style/useTrimStartEnd: fix changes program behavior
Hypothesis Nemotron 3 Super predicted to fire fired 1×
numeric/string coercion: + vs template literal, objects with toString/valueOf, Symbol, BigInt
Program
Output
(no stdout) TypeError: obj.trimLeft is not a function
(no stdout) TypeError: obj.trimStart is not a function
- fired
- 1 before · 0 after
- runs
- each version twice, same file name, no network
Judge Nemotron 3 Ultra advisory intended-change · low
The rule intentionally replaces the deprecated aliases trimLeft/trimRight with the standard trimStart/trimEnd methods. The program calls trimLeft on a plain object that lacks either method, so both the original and fixed code throw a TypeError; the only difference is the method name in the error message, which directly reflects the documented rewrite.
Explanation Nemotron 3 Super unverified
The original method name trimLeft does not exist on objects; it was incorrectly assumed to be available like on strings. Renaming it to trimStart preserves the same incorrect assumption—both are undefined for plain objects—so the TypeError persists unchanged. The behavior differs only in the method name referenced in the error message, but the underlying semantics (attempting to call a non-existent method on an object) remain identical, making the rewrite ineffective at fixing the core issue. No actual behavioral change occurs beyond the error’s label.
Reproduce
- file
prog.js(the before program)- minimized program
- r1-p004.js
- evidence sheet
- r1-p004.md
- regression fixture
- r1-p004.js the minimized program with a header stating the observed change, for the tool's test suite
node prog.js bunx @biomejs/biome lint --only=style/useTrimStartEnd --write prog.js node prog.js
Upstream search GitHub issues Tavily Nemotron 3 Super + Ultra
useTrimStartEnd fix · style/useTrimStartEnd trimLeft method call · style/useTrimStartEnd deprecated string methods · style/useTrimStartEnd object trimLeft usage
no duplicate or related report 20 hits triaged
Details
- program
- Coercion Interactions
- hazard
- numeric/string coercion: + vs template literal, objects with toString/valueOf, Symbol, BigInt
- oracle
stderr before: TypeError: obj.trimLeft is not a function stderr after: TypeError: obj.trimStart is not a function- run
- 2026-10-17T21-07-19-761Z-tpod-biome-style_useTrimStartEnd
generated program (4 lines) and the fix's diff
--- orig.js 2026-10-17 17:07:30.919672857 -0400 +++ fixed.js 2026-10-17 17:07:31.183675697 -0400 @@ -1,4 +1,4 @@ let obj = { toString: () => ' abc ' }; -console.log((obj).trimLeft() + 'def'); +console.log((obj).trimStart() + 'def');
rule documentation given to the models
Summary - Name: useTrimStartEnd - Fix: safe - Default severity: info - Available from version: 1.9.0 - Diagnostic category: lint/style/useTrimStartEnd Description Enforce the use of `String.trimStart()` and `String.trimEnd()` over `String.trimLeft()` and `String.trimRight()`. 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 `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) Examples Invalid ```js,expect_diagnostic const foo = bar.trimLeft(); ``` ```js,expect_diagnostic const foo = bar.trimRight(); ``` Valid ```js const foo = bar.trimStart(); ``` ```js const foo = bar.trimEnd(); ```