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.
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.
// @zkochan
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.
It is probably this issue: https://github.com/benmosher/eslint-plugin-import/issues/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.
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
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.
To get XO to work on a
pnpmdirectory, all ESLint-related XO-dependencies must be installed as adevDependency.
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
You can do that with raw pnpm
Using three settings: shamefully-hoist, hoist, and hoist-pattern
Most helpful comment
pnpmis 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
pnpmas their primary package manager, and they want to use XO, they can. If a user wants to run XO on a project or environment wherepnpmis required, they can. Running 3 commands isn't that much trouble, and properly documenting helps everyone.