Closed OyvindSabo closed 4 years ago
Consider the following example
import { formatQuery } from 'gremlint'; const unformattedQuery = `g.V().has('person', 'name', 'marko').shortestPath(). with(ShortestPath.target, __.has('name', 'josh')).with(ShortestPath.distance, 'weight')`; const formattedQuery = formatQuery(unformattedQuery, { indentation: 0, maxLineLength: 80, shouldPlaceDotsAfterLineBreaks: false, }); console.log(formattedQuery);
Even if we only want the default config, we still need to pass it as an argument. The following will give a TypeScript error:
import { formatQuery } from 'gremlint'; const unformattedQuery = `g.V().has('person', 'name', 'marko').shortestPath(). with(ShortestPath.target, __.has('name', 'josh')).with(ShortestPath.distance, 'weight')`; const formattedQuery = formatQuery(unformattedQuery, {}); console.log(formattedQuery);
And the following will give a type error:
import { formatQuery } from 'gremlint'; const unformattedQuery = `g.V().has('person', 'name', 'marko').shortestPath(). with(ShortestPath.target, __.has('name', 'josh')).with(ShortestPath.distance, 'weight')`; const formattedQuery = formatQuery(unformattedQuery); console.log(formattedQuery);
All of these approaches should be possible.
This was less of a concern when formatQuery was only used by the gremlint.com website, but now that Gremlint is exposed as a library, it should be a bit more developer friendly.
formatQuery
Consider the following example
Even if we only want the default config, we still need to pass it as an argument. The following will give a TypeScript error:
And the following will give a type error:
All of these approaches should be possible.
This was less of a concern when
formatQuery
was only used by the gremlint.com website, but now that Gremlint is exposed as a library, it should be a bit more developer friendly.