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

Wrong defaults in Lerna repo #14

Open
alistair-hmh opened this issue Oct 4, 2018 · 5 comments
Open

Wrong defaults in Lerna repo #14

alistair-hmh opened this issue Oct 4, 2018 · 5 comments

Comments

@alistair-hmh
Copy link

I am using a Lerna repo which puts a package.json in the root of the repo, as well as all the subprojects for the repo in packages/.

Example:

. tree lerna-mono-repo/
├── package.json
├── node_modules/
│   └── xo/...
└── packages/
    ├── sub-repo-a
    │   └── package.json
    └── sub-repo-b.svg
        └── package.json

Each of my sub-packages in the Lerna repo has different XO rules.

When I edit the code in Sublime for a sub-package, it shows me default XO rules, when I would expect to see the rules working from the package I'm editing.

Is there a way to make the closest package.json to the file being edited - as the package.json the rules are picked from?

@alistair-hmh
Copy link
Author

Apologies, I just saw this: https://github.com/xojs/xo#monorepo - trying this now...

@alistair-hmh
Copy link
Author

The suggestion in the XO documentation only seems to work if the root package.json contains the XO config. In the mono-repo I'm working with, I have to have different settings for each package, for example, one package is a React app, another is a standard Node module.

Is XO just the wrong tool for the job here?

@sindresorhus
Copy link
Member

Is there a way to make the closest package.json to the file being edited - as the package.json the rules are picked from?

That's how it should work. Otherwise it's a bug. It uses the closest package.json as long as it doesn't contains {"xo": false}.

@sindresorhus sindresorhus changed the title Wrong Defaults in Lerna Repo Wrong defaults in Lerna repo Oct 5, 2018
@sindresorhus
Copy link
Member

This might be related to xojs/xo#279.

@alistair-hmh
Copy link
Author

Thanks. Yes, that looks like the exact same thing I'm experiencing.

For now, I'm forced to drop Sublime for VSCode for this mono-repo project. Not a huge deal, but I'll look forward to switching back.

(In case it's useful to know, I am using the {xo: false} in the root package, and not in the sub-packages. Also, I open the Sublime project from the Lerna mono-repo root. I can open Sublime from each subpackage and the linting works fine, but then my desktop gets littered with windows.)

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

2 participants