17

everytime I code like this ${row.name}, I get this error "eslint.org/docs/rules/no-template-curly-in-string Unexpected template string expression".

Any help?

enter image description here

2

3 Answers 3

35

ES6 template strings should be used with backquotes, not single quotes. Replace this :

'delete the item ${row.name}'

With this :

`delete the item ${row.name}`

And here is the ESLint example as requested in the comments : http://eslint.org/docs/rules/no-template-curly-in-string#examples

Sign up to request clarification or add additional context in comments.

Comments

2

If you are not using an ES6 template string and actually want the dollar sign to print to the screen, place the following above the string declaration.

/* eslint-disable no-template-curly-in-string */

Comments

0

Sometimes its necessary to use templating characters within string, like inside anchor tags, etc.

'<a href="${' +
'OrganizationInfo.PrivacyPolicy}" target="_blank" >Privacy Policy</a>'

Breaking the string worked for me.

Comments