dprint-plugin-prettier icon indicating copy to clipboard operation
dprint-plugin-prettier copied to clipboard

Allow plugins to be configured from outside the package without developer intervention

Open midgleyc opened this issue 3 years ago • 1 comments

Looking at https://github.com/dprint/dprint-plugin-prettier/issues/12#issuecomment-1100716319 and https://github.com/dprint/dprint-plugin-prettier/commit/478d47781b21f9fc375446f8c2993a7a4d5f8e1c, it looks like the way to implement a new plugin is:

  • confirm that it can run in a browser
  • install it as a dependency
  • import it in messageProcessor (now main.ts)
  • add it to plugins

Is this correct? If so, given a plugin that can run in a browser, could you allow a plugin array to be configured in dprint.json, and use await import('prettier-plugin-name') or some other form of dynamic require to install user configured (and user-installed) plugins? I think this would require at least node 14 for top-level await, but 12 has just gone end-of-life.

I ask this because while it would be feasible for you to add everyone's plugins one by one, that seems like potentially a lot of overhead (and version increments) compared with having configuration available for a user to do it themselves.

midgleyc avatar May 16 '22 13:05 midgleyc

+1 Definitely, I think this is the biggest issue with the project right now.

gunta avatar Jun 21 '22 13:06 gunta