@putout/plugin-add-missing-parens

2.0.1 • Public • Published

@putout/plugin-add-missing-parens NPM version

The JavaScript exception "tagged template cannot be used with optional chain" occurs when the tag expression of a tagged template literal is an optional chain, or if there's an optional chain between the tag and the template.

(c) MDN

🐊Putout plugin adds ability to add missing parens. Check out in 🐊Putout Editor. Merged to @putout/plugin-parens.

Install

npm i @putout/plugin-add-missing-parens

Rule

{
    "rules": {
        "add-missing-parens": "on"
    }
}

❌ Example of incorrect code

getConsoleLog?.()``;
String?.raw``;
String?.raw!``;

await asyncFn()?.filter((x) => x);

✅ Example of correct code

(getConsoleLog?.())``;
(String?.raw)``;
String?.raw!``;

(await asyncFn())?.filter((x) => x);

License

MIT

Package Sidebar

Install

npm i @putout/plugin-add-missing-parens

Weekly Downloads

614

Version

2.0.1

License

MIT

Unpacked Size

5.49 kB

Total Files

4

Last publish

Collaborators

  • coderaiser