Fix parent XO config resolution from nested package cwd#883
Conversation
|
I think this is still a bit risky. The fix depends on It also means XO can now pick up an unrelated ancestor config above the actual project, which feels broader than the issue needs. I think we should either avoid relying on this undocumented behavior, or add an explicit test that shows this wider ancestor lookup is intentional. I suggest opening an issue on cosmicconfig to clarify. |
|
Thanks, agreed. I removed the The follow-up now uses an explicit fallback only for a parent I also added a regression test for the negative case where an ancestor Ran:
I did not open a cosmiconfig issue for now because this PR no longer depends on that undocumented behavior. |
2732f23 to
63d7c84
Compare
63d7c84 to
87862e0
Compare
Summary
Fixes XO config resolution when running from a nested package in a monorepo.
What changed
package.jsonXO config from a nested packagecwd.Why
Issue #733 reports that packages in a monorepo do not pick up the root XO config. The previous search stopped before reaching the monorepo root.
Testing
npm run buildnpm run test:setupnpx ava dist/test/resolve-config.test.jsnode dist/cli.js lib/resolve-config.ts test/resolve-config.test.tsgit diff --checkNote: I also checked
npm test; it currently stops at the lint step on both this branch andupstream/mainwith the same pre-existing@typescript-eslint/no-unnecessary-type-assertionreports inlib/utils.tsandlib/xo.ts.Fixes #733