dprint icon indicating copy to clipboard operation
dprint copied to clipboard

Ability to specify the same plugin twice with different configuration?

Open dsherret opened this issue 2 years ago • 1 comments

Would it be useful to be able to specify the same plugin twice with different configuration (ex. maybe an object could be specified in the plugins array)? What would be some of the use cases? Maybe #711 covers any potential use cases and this is not necessary.

dsherret avatar Jul 21 '23 01:07 dsherret

I think I've encountered this issue. I have a folder with files where lines must end with a semicolon, while the rest of the codebase doesn't use semicolons.

Currently, the only option I've found is to exclude the folder from formatting and format it manually. In a more perfect world, I could define:

{
  "formatters": [
    {
      "formatter": "typescript",
      "semiColons": "asi",
      "excludes": ["myfolder"]
    },
    {
      "formatter": "typescript",
      "semiColons": "always",
      "includes": ["myfolder"]
    },
  ],
  "plugins": [
    // maybe it could be used instead of the formatter value
    "https://plugins.dprint.dev/typescript-0.88.7.wasm"
  ]
}

Bessonov avatar Dec 11 '24 00:12 Bessonov