Standard: Why ES6's Template literals not support by Standard?

Created on 10 Aug 2016  路  2Comments  路  Source: standard/standard

Hi i'm new to standard, and i love its simple and powerful.

But i have a question

i have write code like

const ms = new Date() - start
ctx.set('X-Response-Time', '${ms}ms')

but i got the warning on first line: " 'ms' is defined but never used at xx col xx ";

I wonder why this warning happen? i think it should be now take as a warning ( in Eslint it is not);
and it's there have a way to ignore this kind of warning?

Best wishes.

question

Most helpful comment

Your code will set the header to the string "${ms}ms", you need to use backticks (```) in order to use template strings.

e.g.

const ms = new Date() - start
ctx.set('X-Response-Time', `${ms}ms`)

All 2 comments

Your code will set the header to the string "${ms}ms", you need to use backticks (```) in order to use template strings.

e.g.

const ms = new Date() - start
ctx.set('X-Response-Time', `${ms}ms`)

ok锛宼hanks

Was this page helpful?
0 / 5 - 0 ratings

Related issues

christianalfoni picture christianalfoni  路  3Comments

rbecheras picture rbecheras  路  3Comments

jcalfee picture jcalfee  路  3Comments

Alexsey picture Alexsey  路  3Comments

feross picture feross  路  3Comments