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

fix(expiring-todo-comments): support monorepos #2159

Merged
merged 2 commits into from
Oct 29, 2023

Conversation

mmkal
Copy link
Contributor

@mmkal mmkal commented Jun 24, 2023

Fixes #403
Maybe related: #1871

The basic change: pass the file-being-linted dirname rather than cwd to read-pkg-up. Using cwd meant it would find a monorepo's root package directory. Basically this:

- packageResult = readPkgUp.sync({normalize: false});
+ packageResult = readPkgUp.sync({normalize: false, cwd: dirname});

For review, worth viewing without whitespace, since a few functions were indented to live inside a helper which knows about the file-being-linted's directory name: https://github.com/sindresorhus/eslint-plugin-unicorn/pull/2159/files?w=1

I haven't added tests because I didn't see any that were actually exercising read-pkg-up so far, but maybe I missed something?

This could introduce new errors, or make others go away, so I think it qualifies as a breaking change. I think it makes sense for the dependency to depend on the package.json nearest the file being linted though.

@mmkal mmkal force-pushed the expiring-todos-monorepo branch 2 times, most recently from ed2c502 to 247850d Compare June 24, 2023 20:34
The basic change: pass the file being linted dirname rather than cwd. Using cwd meant it would find a monorepo's root package directory.
@sindresorhus sindresorhus merged commit ac51d40 into sindresorhus:main Oct 29, 2023
21 checks passed
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

Successfully merging this pull request may close these issues.

expiring-todo-comments package conditions don't work in a multi-package project layout
2 participants