3.0.0 β’ Published 3 months ago
@putout/plugin-apply-template-literals v3.0.0
@putout/plugin-apply-template-literals
Template literals are literals delimited with backtick (`) characters, allowing for multi-line strings, string interpolation with embedded expressions, and special constructs called tagged templates. Template literals are sometimes informally called template strings, because they are used most commonly for string interpolation (to create strings by doing substitution of placeholders
(c) MDN
πPutout plugin adds ability to apply template literals
. Check out in πPutout Editor.
Install
npm i @putout/plugin-apply-template-literals
Rule
{
"rules": {
"apply-template-literals": "on"
}
}
β Example of incorrect code
const line = '("' + name + '")';
β Example of correct code
const line = `("${name}")`;
Comparison
Linter | Rule | Fix |
---|---|---|
π Putout | apply-template-literals | β |
β£ ESLint | prefer-template | β |
License
MIT