prettierx
Version:
prettierX - a less opinionated fork of the Prettier code formatter
23 lines (20 loc) • 467 B
JavaScript
;
function preprocess(ast, options) {
switch (options.parser) {
case "json":
case "json5":
case "json-stringify":
case "__js_expression":
case "__vue_expression":
return {
...ast,
type: options.parser.startsWith("__") ? "JsExpressionRoot" : "JsonRoot",
node: ast,
comments: [],
rootMarker: options.rootMarker,
};
default:
return ast;
}
}
module.exports = preprocess;