Skip to content

Commit

Permalink
fix: re-add @vue/language-plugin-pug as optional peer dep
Browse files Browse the repository at this point in the history
  • Loading branch information
simonhaenisch committed Jul 1, 2024
1 parent 235be2f commit 3929ec3
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,15 @@
"repository": "simonhaenisch/prettier-plugin-organize-imports",
"homepage": "https://github.com/simonhaenisch/prettier-plugin-organize-imports#readme",
"peerDependencies": {
"@vue/language-plugin-pug": "^2.0.24",

This comment has been minimized.

Copy link
@johnsoncodehk

johnsoncodehk Jul 1, 2024

Contributor

This is actually not needed. The plugin name is interpreted as an absolute path when executing createParsedCommandLine, so there is no reliance on relative directory imports.

This comment has been minimized.

Copy link
@simonhaenisch

simonhaenisch Jul 1, 2024

Author Owner

Hm but the package won't even exist if the end user doesn't have it installed, right?

It's just an optional peer dependency, so the package manager wouldn't even complain if the end user doesn't install it (at least that's how i remember it).

This comment has been minimized.

Copy link
@johnsoncodehk

johnsoncodehk Jul 1, 2024

Contributor

Whether you need to add peer dependencies does not depend on whether the package needs to exist, but on whether prettier-plugin-organize-imports needs to import @vue/language-plugin-pug.

For 3 cases:

  • User does not have @vue/language-plugin-pug installed, @vue/language-plugin-pug is not added to vueCompilerOptions: nothing happens

  • The user has not installed @vue/language-plugin-pug, but when @vue/language-plugin-pug is added to vueCompilerOptions A module not found error will be thrown when createParsedCommandLine.

  • The user installed @vue/language-plugin-pug, @vue/language-plugin-pug was added to vueCompilerOptions: @vue/language-plugin-pug will be import based on the tsconfig directory when createParsedCommandLine.

In either case, prettier-plugin-organize-imports does not participate in the loading of @vue/language-plugin-pug, so adding it as peer dependency has no effect.

This comment has been minimized.

Copy link
@simonhaenisch

simonhaenisch Jul 2, 2024

Author Owner

Yes ok, thanks for the long explanation. I'm aware it has no effect, I just wanted to add it as an optional peer dependency to indicate that it's supported.

But I guess you're right, there are other language plugins that should also just work. I'll remove it again when I do the next release.

"prettier": ">=2.0",
"typescript": ">=2.9",
"vue-tsc": ">=2.0.24"
"vue-tsc": "^2.0.24"
},
"peerDependenciesMeta": {
"@vue/language-plugin-pug": {
"optional": true
},
"vue-tsc": {
"optional": true
}
Expand Down

0 comments on commit 3929ec3

Please sign in to comment.