Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plugin is not loaded when using pnpm #51

Closed
brattonross opened this issue Apr 26, 2021 · 8 comments
Closed

Plugin is not loaded when using pnpm #51

brattonross opened this issue Apr 26, 2021 · 8 comments

Comments

@brattonross
Copy link

First, thanks for your hard work on this plugin!

When installing dependencies using pnpm and then running prettier I get the warning: Ignored unknown option { importOrder: [...] }.

If I remove node_modules, install dependencies with npm, and then run prettier, the files are formatted as expected.

@byara
Copy link
Collaborator

byara commented Jun 13, 2021

Hey @brattonross thanks for reporting this. That is true, we did not test the setup with pnpm. Could you maybe send a PR to fix that issue?

@ayusharma
Copy link
Collaborator

This is a valid issue. I also tried to integrate the plugin in the https://github.com/verdaccio/verdaccio. I could not manage it. We'll keep you updated if there is a solution.

@ayusharma
Copy link
Collaborator

The reason is that the prettier plugins are picked automatically from the node_modules and the pnpm has a different architecture. I think this issue is out of scope of this plugin and requires discussion in the prettier project.

@brattonross
Copy link
Author

Thank you for taking a look at the issue! I agree that it sounds like it is out of scope for this plugin.

The prettier docs seem to suggest that you can manually specify plugins / directories to search for plugins, and although I haven't tried it myself I imagine that this could be a workaround for pnpm users.

@nirtamir2
Copy link

nirtamir2 commented Jan 22, 2022

Inspired by simonhaenisch/prettier-plugin-organize-imports#34 (comment)
I solved it by adding to .prettierrc.js:

module.exports = {
  plugins: [
    require.resolve("@trivago/prettier-plugin-sort-imports"),
  ],
};

@shanu-mol
Copy link

shanu-mol commented Feb 2, 2023

Inspired by simonhaenisch/prettier-plugin-organize-imports#34 (comment) I solved it by adding to .prettierrc.js:

module.exports = {
  plugins: [
    require.resolve("@trivago/prettier-plugin-sort-imports"),
  ],
};

For all, Who are using typescript. This will also work with .prettierrc.json

{
 "plugins": ["@trivago/prettier-plugin-sort-imports"]
}

@acelaya
Copy link

acelaya commented Aug 1, 2023

For all, Who are using typescript. This will also work with .prettierrc.json

{
 "plugins": ["@trivago/prettier-plugin-sort-imports"]
}

I can confirm this also works if the config is defined in package.json

@qiutian00
Copy link

{
 "plugins": ["@trivago/prettier-plugin-sort-imports"]
}

It works ha ha.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants