🐊Putout plugin adds ability to add missing parens. Check out in 🐊Putout Editor.
npm i @putout/plugin-parens
{
"rules": {
"parens/add-missing": "on",
"parens/remove-useless": "on"
}
}
The JavaScript exception "invalid assignment left-hand side" occurs when there was an unexpected assignment somewhere. It may be triggered when a single
=
sign was used instead of==
or===
.(c) MDN
To disable use:
{
"rules": {
"parens/add-missing-for-assign": "off"
}
}
-a && b = a;
+a && (b = a);
To disable use:
{
"rules": {
"parens/add-missing-for-await": "off"
}
}
await asyncFn().filter(Boolean);
(await asyncFn()).filter(Boolean);
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
Checkout in 🐊Putout Editor.
{
"rules": {
"parens/add-missing-for-template": "off"
}
}
getConsoleLog?.()``;
String?.raw``;
String?.raw!``;
(getConsoleLog?.())``;
(String?.raw)``;
(String?.raw)!``;
To disable use:
{
"rules": {
"parens/remove-useless-for-await": "off"
}
}
Checkout in 🐊Putout Editor.
const s = (await m());
const s = await m();
MIT