CLI:
Version: 1.1.0
Color support: true
Platform:
CPU Architecture: aarch64
OS: macos
Environment:
BIOME_LOG_DIR: unset
NO_COLOR: unset
TERM: "xterm-256color"
JS_RUNTIME_VERSION: "v20.5.0"
JS_RUNTIME_NAME: "node"
NODE_PACKAGE_MANAGER: "npm/9.8.0"
Biome Configuration:
Status: Loaded successfully
Formatter disabled: false
Linter disabled: false
Organize imports disabled: true
VCS disabled: true
Workspace:
Open Documents: 0
Discovering running Biome servers...
[whole buncha stuff]
Biome 1.1.0 is newly warning on this for me:
const err = new Error("this is an error");
console.log("\n--------\nERROR:\n" + err.toString());
However, it is changing this to:
const err = new Error("this is an error");
console.log(`\n--------\nERROR:\n${err.toString()}`);
The .toString()
call is always redundant in this case, since the template literal1 effectively invokes .toString()
for each expression. You can verify this using the following snippet:
const a = new Error();
a.toString = () => "hi";
console.log(`a: ${a}`); // Logs: "a: hi"
If the point of lint/style/useTemplate
is to avoid redundant calculations, it seems to me that this should be:
const err = new Error("this is an error");
console.log(`\n--------\nERROR:\n${err}`);
At least when untagged. I haven't tried tagged template literals, but Biome isn't creating those either. ↩
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too