eslint不识别模板文字 [英] eslint not recognizing template literal

查看:1014
本文介绍了eslint不识别模板文字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  const perunString = perun.times(100).toFixed(2).toString(); 
return`%{perunString}%`;

哪两个错误


  1. 'perunString'被定义但从未使用

  2. 字符串必须使用单引号


 `%{perunString}%`

//之后
`$ {perunString}%`
/ pre>

请注意从%{ $ {


const perunString = perun.times(100).toFixed(2).toString();
return `%{perunString} %`;

Which gives two errors

  1. 'perunString' is defined but never used
  2. Strings must use single quotes

解决方案

You have an error in your template interpolation syntax that is probably causing both errors:

// Before
`%{perunString} %`

// After
`${perunString} %`

Note the change from %{ to ${.

这篇关于eslint不识别模板文字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆