简体   繁体   English

eslint无法识别模板文字

[英]eslint not recognizing template literal

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

Which gives two errors 这给出了两个错误

  1. 'perunString' is defined but never used 'perunString'已定义但从未使用过
  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 ${ . 请注意从%{${的更改。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM