You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
At ArangoDB (Apache 2.0 licensed NoSQL multi-model database with an embedded V8 environment) we're using an aql template tag to support queries without the risk of injection attacks (think SQL).
This means we have plenty of code that looks like this:
constresult=db._query(aql` FOR x IN 1..5 RETURN x`).toArray();
However prettier seems to think that's unreadable and instead formats it as this:
constresult=db._query(aql` FOR x IN 1..5 RETURN x`).toArray();
Curiously this seems to be triggered by the final .toArray(). Without it, prettier plays nice:
constresult=db._query(aql` FOR x IN 1..5 RETURN x`);
The minimal test case seems to be this:
x.y(``).z();
Observations:
x.y needs to be a method, using a function (x(...).z();) doesn't trigger the behaviour
z() needs to be a method call, using a property access (x.y(...).z;) also doesn't trigger it (though something like x.y(...).z.a() triggers it again, as does x.y(...).z().a)
the template string needs to contain at least one linebreak
the length and content of the template string is otherwise irrelevant
So it seems to be doing the right thing UNLESS there's a second chained method call, even if the method takes no arguments.
The text was updated successfully, but these errors were encountered:
At ArangoDB (Apache 2.0 licensed NoSQL multi-model database with an embedded V8 environment) we're using an
aql
template tag to support queries without the risk of injection attacks (think SQL).This means we have plenty of code that looks like this:
However prettier seems to think that's unreadable and instead formats it as this:
Curiously this seems to be triggered by the final
.toArray()
. Without it, prettier plays nice:The minimal test case seems to be this:
Observations:
x.y
needs to be a method, using a function (x(...).z();
) doesn't trigger the behaviourz()
needs to be a method call, using a property access (x.y(...).z;
) also doesn't trigger it (though something likex.y(...).z.a()
triggers it again, as doesx.y(...).z().a
)So it seems to be doing the right thing UNLESS there's a second chained method call, even if the method takes no arguments.
The text was updated successfully, but these errors were encountered: