plugin.js 438 B

1234567891011121314151617181920212223242526
  1. "use strict";
  2. const prettier = require("prettier/local");
  3. const concat = prettier.doc.builders.concat;
  4. module.exports = {
  5. languages: [
  6. {
  7. name: "foo",
  8. parsers: ["foo-parser"],
  9. extensions: [".foo"]
  10. }
  11. ],
  12. parsers: {
  13. "foo-parser": {
  14. parse: text => ({ text }),
  15. astFormat: "foo-ast"
  16. }
  17. },
  18. printers: {
  19. "foo-ast": {
  20. print: path => concat(["!", path.getValue().text])
  21. }
  22. }
  23. };