requireTemplateStrings

Requires the use of template strings instead of string concatenation.

Types: Boolean or Object

Values:

  • true
  • Object:
    • "allExcept": array of quoted exceptions:
      • "stringConcatenation" ignores strings concatenated with other strings

Version: ES6

Example

"requireTemplateStrings": true
"requireTemplateStrings": { "allExcept": ["stringConcatenation"] }
Valid
function sayHi(name) {
    return `How are you, ${name}?`;
}
`a ${b + c}`
`a ${a()}`
Valid for { "allExcept": ["stringConcatenation"] }
function sayBye(name) {
    return `It was good seeing you, ${name}! Let's hang out again sometime and` +
        ' grab some chicken and waffles.';
}
Invalid
function sayHi(name) {
    return 'How are you, ' + name + '?';
}
"a" + (b + c)
"a" + a()
Rule source
Test source