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

Package detail

@putout/plugin-convert-template-to-string

coderaiser45.1kMIT3.0.0

🐊Putout plugin adds ability to find and remove useless template string

putout, putout-plugin, plugin, remove, useless, template

readme

@putout/plugin-convert-template-to-string NPM version

  • Template literals are literals delimited with backticks (`), allowing embedded expressions called substitutions.
  • The String object is used to represent and manipulate a sequence of characters.

(c) MDN

🐊Putout plugin adds ability to find and convert Template Literals to calling of String constructor.

Install

npm i @putout/plugin-convert-template-to-string

Rule

{
    "rules": {
        "convert-template-to-string": "on"
    }
}

❌ Example of incorrect code

const s = `${a + b}`;

✅ Example of correct code

const s = String(a + b);

License

MIT