Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@putout/plugin-apply-template-literals

coderaiser19.8kMIT3.0.0

🐊Putout plugin adds ability to apply template literals

putout, putout-plugin, putout-plugin-apply, plugin, template-literals

readme

@putout/plugin-apply-template-literals NPM version

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