Skip to content

Commit

Permalink
fix(lint/useTemplate): preserve leading non-string addition (#70)
Browse files Browse the repository at this point in the history
  • Loading branch information
Conaclos authored Aug 30, 2023
1 parent d22ccef commit 8f85469
Show file tree
Hide file tree
Showing 21 changed files with 1,014 additions and 733 deletions.
42 changes: 42 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,48 @@ Read our [guidelines for writing a good changelog entry](https://github.com/biom
### Formatter
### JavaScript APIs
### Linter

### Enhancements

- [useTemplate](https://biomejs.dev/lint/rules/useTemplate/) now reports all string concatenations.

Previously, the rule ignored concatenation of a value and a newline or a backquote.
For example, the following concatenation was not reported:

```js
v + "\n";
"`" + v + "`";
```

The rule now reports these cases and suggests the following code fixes:

```diff
- v + "\n";
+ `${v}\n`;
- v + "`";
+ `\`${v}\``;
```

### Bug fixes

- Fix [rome#4713](https://github.com/rome/tools/issues/4713).

Previously, [useTemplate](https://biomejs.dev/lint/rules/useTemplate/) made the following suggestion:

```diff
- a + b + "px"
+ `${a}${b}px`
```

This breaks code where `a` and `b` are numbers.

Now, the rule makes the following suggestion:

```diff
- a + b + "px"
+ `${a + b}px`
```

### Parser
### VSCode

Expand Down
Loading

0 comments on commit 8f85469

Please sign in to comment.