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

Document usage with pnpm #334

Closed
jorgegonzalez opened this issue Jul 5, 2018 · 8 comments
Closed

Document usage with pnpm #334

jorgegonzalez opened this issue Jul 5, 2018 · 8 comments

Comments

@jorgegonzalez
Copy link
Contributor

jorgegonzalez commented Jul 5, 2018

To get XO to work on a pnpm directory, all ESLint-related XO-dependencies must be installed as a devDependency. This can be accomplished with the following command:

(
  export PKG=xo;
  npm info "xo@latest" dependencies --json | command sed 's/[\{\},]//g ; s/: /@/g' | grep "\"eslint" | xargs pnpm i -D "$PKG@latest"
)

To fix the eslint-plugin-import issues (#270), eslint-import-resolver-node must also be installed:

pnpm install --save-dev eslint-import-resolver-node

Finally, if "prettier" is set to true in XO's config, it must be installed too:

pnpm install --save-dev prettier

I think it would be prudent to document this in the README.

@sindresorhus
Copy link
Member

sindresorhus commented Jul 5, 2018

I don't think projects should have to document how to work with a random package manager. Why would you even use pnpm for this specific use-case if you have to go through so much trouble? I understand pnpm can be beneficial for disk size sometimes, but I don't really see how it's worth it in this case.

@sindresorhus
Copy link
Member

// @zkochan

@jorgegonzalez
Copy link
Contributor Author

jorgegonzalez commented Jul 5, 2018

pnpm is not a "random" package manager. It's used by several major companies and has a dedicated and growing user base.

And the idea is that if a user has chosen pnpm as their primary package manager, and they want to use XO, they can. If a user wants to run XO on a project or environment where pnpm is required, they can. Running 3 commands isn't that much trouble, and properly documenting helps everyone.

@zkochan
Copy link

zkochan commented Jul 5, 2018

It is probably this issue: import-js/eslint-plugin-import#828

eslint-plugin-import incorrectly implements the node resolution algorithm. They would accept a pull request to fix this issue. Although standard works with no issues. I don't know how they achieved it.

@zkochan
Copy link

zkochan commented Jul 5, 2018

But the issue is about noting this info in the README to improve DX of pnpm users.

Of course, it would be too much to add a big how-to block but maybe it would be fine just to link in this issue or a gist somewhere with steps how to make it work with pnpm

Something like:

If you use pnpm, you should read this issue

@jorgegonzalez
Copy link
Contributor Author

jorgegonzalez commented Jul 11, 2018

Closing this, as someone searching for "xo and pnpm" will be able to find this issue easily. Didn't mean to annoy or upset anyone.

@yoursunny
Copy link

To get XO to work on a pnpm directory, all ESLint-related XO-dependencies must be installed as a devDependency.

It is unnecessary to add the ESLint dependencies to devDependency: XO can work as long as they appear in top-level node_modules.
Therefore, I'm using a script to create symbolic links:
https://github.com/yoursunny/NDNts/blob/77126a22f89bb7386cb75be2ca4fab27c46af5ac/mk/link-xo-deps.js

@zkochan
Copy link

zkochan commented Jun 6, 2020

You can do that with raw pnpm

Using three settings: shamefully-hoist, hoist, and hoist-pattern

https://pnpm.js.org/en/npmrc#hoist-pattern

yoursunny added a commit to yoursunny/NDNts that referenced this issue Jun 12, 2020
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

4 participants