Files
test-repo/tests/integration/print-doc.js
T

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

28 lines
653 B
JavaScript
Raw Normal View History

2021-01-28 00:29:34 +02:00
/** @type {import('prettier')} */
2022-07-20 23:18:24 +08:00
import prettier from "../config/prettier-entry.js";
2021-01-28 00:29:34 +02:00
function printDoc(doc) {
// This dummy plugin ignores the input and simply returns the given doc.
// This is to make sure that the doc will go through all the stages a real doc
// returned by a real plugin would go (e.g. `propagateBreaks`).
const dummyPlugin = {
parsers: {
dummy: {
parse: () => ({}),
astFormat: "dummy",
},
},
printers: {
dummy: {
print: () => doc,
},
},
};
return prettier.format("_", {
plugins: [dummyPlugin],
parser: "dummy",
});
}
export default printDoc;