Skip to content
This repository has been archived by the owner on Aug 31, 2023. It is now read-only.

🐛 <TITLE>lint/style/useTemplate suggested error with // #4109

Closed
1 task done
whiter001 opened this issue Dec 29, 2022 · 0 comments · Fixed by biomejs/biome#114
Closed
1 task done

🐛 <TITLE>lint/style/useTemplate suggested error with // #4109

whiter001 opened this issue Dec 29, 2022 · 0 comments · Fixed by biomejs/biome#114
Labels
A-Linter Area: linter L-JavaScript Langauge: JavaScript S-Bug: confirmed Status: report has been confirmed as a valid bug

Comments

@whiter001
Copy link

Environment information

>rome --version
Rome CLI version 11.0.0


### What happened?

```bash
>rome check .\demo.js
.\demo.js:1:22 lint/style/useTemplate  FIXABLE  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

  × Template literals are preferred over string concatenation.

  > 1 │ const timestampMsg = 'timestamp: ' + Date.now() // timestamp
      │                      ^^^^^^^^^^^^^^^^^^^^^^^^^^
    2 │

  i Suggested fix: Use a TemplateLiteral.

    1   │ - const·timestampMsg·=·'timestamp:·'·+·Date.now()·//·timestamp
      1 │ + const·timestampMsg·=·`timestamp:·${Date.now()·//·timestamp}`·//·timestamp
    2 2 │


Checked 1 file(s) in 1910µs
Found 1 error(s)
Error: some errors were emitted while running checks

Expected result

 const·timestampMsg·=·`timestamp:·${Date.now()·`·//·timestamp

Code of Conduct

  • I agree to follow Rome's Code of Conduct
@whiter001 whiter001 added the S-To triage Status: user report of a possible bug that needs to be triaged label Dec 29, 2022
@MichaReiser MichaReiser added S-Bug: confirmed Status: report has been confirmed as a valid bug A-Linter Area: linter L-JavaScript Langauge: JavaScript and removed S-To triage Status: user report of a possible bug that needs to be triaged labels Dec 29, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A-Linter Area: linter L-JavaScript Langauge: JavaScript S-Bug: confirmed Status: report has been confirmed as a valid bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants