fixhunt

biome style/useTrimStartEnd: fix changes program behavior

fix-changes-behaviorlabelled safeintrospection-only · lowno match
Findings / 2026-10-17T21-07-19-761Z-tpod-biome-style_useTrimStartEnd / r1-p005biome 2.5.156 → 6 lines2026-10-17 21:07 UTC

Hypothesis Nemotron 3 Super predicted to fire fired 1×

exceptions thrown inside the code the fix removes or rewrites

Program

before
1let s = null;
2try {
3 console.log(s.trimLeft());
4} catch (e) {
5 console.log(e.name + ': ' + e.message);
6}
after
1let s = null;
2try {
3 console.log(s.trimStart());
4} catch (e) {
5 console.log(e.name + ': ' + e.message);
6}

Output

stdout beforeexit 0
TypeError: Cannot read properties of null (reading 'trimLeft')
stdout afterexit 0
TypeError: Cannot read properties of null (reading 'trimStart')
fired
1 before · 0 after
runs
each version twice, same file name, no network

Judge Nemotron 3 Ultra advisory introspection-only · low

The program throws a TypeError because `s` is null, and the error message includes the method name that was called. The fix changes `trimLeft` to its alias `trimStart`, so the only difference is the method name quoted in the error message, which is source-text introspection.

Explanation Nemotron 3 Super unverified

The original call `s.trimLeft()` attempts to access property `trimLeft` on `null`, causing a TypeError with message mentioning `trimLeft`. After rewriting to `s.trimStart()`, the same error occurs but now references `trimStart` in the message string (`Cannot read properties of null (reading 'trimStart')`). Although both throw identical exception types, the error message differs because it includes the accessed property name. Since observable output (the printed message) changes, the transformation alters program behavior and is not semantics‑preserving.

Reproduce

file
prog.js (the before program)
minimized program
r1-p005.js
evidence sheet
r1-p005.md
regression fixture
r1-p005.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 · biome lint rule trimStart replacement · null object method invocation error

no duplicate or related report 18 hits triaged

Details

program
Exception Safety
hazard
exceptions thrown inside the code the fix removes or rewrites
oracle
stdout before: TypeError: Cannot read properties of null (reading 'trimLeft') stdout after: TypeError: Cannot read properties of null (reading 'trimStart')
run
2026-10-17T21-07-19-761Z-tpod-biome-style_useTrimStartEnd
generated program (6 lines) and the fix's diff
1let s = null;
2try {
3 console.log(s.trimLeft());
4} catch (e) {
5 console.log(e.name + ': ' + e.message);
6}
--- orig.js	2026-10-17 17:07:31.355677548 -0400
+++ fixed.js	2026-10-17 17:07:31.629680495 -0400
@@ -1,6 +1,6 @@
 let s = null;
 try {
-  console.log(s.trimLeft());
+  console.log(s.trimStart());
 } catch (e) {
   console.log(e.name + ': ' + e.message);
 }
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();
 ```