# unicorn/no-console-spaces

> Disallow spaces at the edges of strings where `console.log()` already adds one

`console.log()` puts a space between its arguments. If a string ends with a space before the next argument, or starts with one after the previous argument, you get two spaces. For example, `console.log("Total: ", 5)` prints `Total:  5`.

The rule checks `console.log()`, `console.debug()`, `console.info()`, `console.warn()`, and `console.error()`.

`--fix` trims the reported string at both ends.

{/* Generated by src/codegen/lint-rule-docs.ts. Do not edit this section. */}

## Configure

Off by default. To turn it on:

```toml bunfig.toml
[lint.rules]
"unicorn/no-console-spaces" = "error" # or "warn"
```

{/* End of the generated section. */}

## Examples

Reported:

{/* bad {"count": 3} */}
```js
console.log("Total: ", total);
console.error(path, " was not found");
console.info(`Saved ${count} files `, "in", elapsed);
```

Not reported:

{/* good */}
```js
console.log("Total:", total);
console.error(path, "was not found");
console.info(`Saved ${count} files`, "in", elapsed);
```

Spaces at the start of the first argument and at the end of the last one are allowed, because nothing is printed next to them:

{/* good */}
```js
console.log("  Total:", total);
console.log("Done ");
```
