tools icon indicating copy to clipboard operation
tools copied to clipboard

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

Open whiter001 opened this issue 3 years ago • 0 comments

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

  • [X] I agree to follow Rome's Code of Conduct

whiter001 avatar Dec 29 '22 02:12 whiter001