avocadowastaken/prettier-plugin-prisma

not working when trying to use with prettier.format function ?

liesislukas opened this issue · 1 comments

I have schema code built by other tools i build and in this use case i want to have a function where i can provide generated code and get nice formatted schema to write to schema file.

I tried @umidbekk plugin but it failed to do the job with error which seem like prettier is looking like prettier thinks it's javascript, while it's not. And i don't see any way to tell prettier that it's prisma schema. Any hints?

  const prettier = require("prettier");
  let result = prettier.format(code, {
      parser: "babel", plugins: ["prettier-plugin-prisma"]
    });

image

also posted at prisma repo prisma/prisma#1761

Hey @liesislukas, you're using babel parser, so prettier thinks that you're parsing the ES file.

Passing the prisma parser should work.