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

[Feature Request] - Missing dependencies #87

Open
Netail opened this issue Aug 11, 2024 · 5 comments
Open

[Feature Request] - Missing dependencies #87

Netail opened this issue Aug 11, 2024 · 5 comments
Labels
enhancement New feature or request

Comments

@Netail
Copy link

Netail commented Aug 11, 2024

Summary

When working in a mono repo, you can import packages from the node_modules which are used by other packages within the mono repo, but not listed in the dependency list of the package you are working in. It might be nice to give the user a heads up to include the dependency in their dependency list too.

Example

{
  "name": "package-a",
  "dependencies": {
    "react": "^18"
  }
}
{
  "name": "package-b",
  "dependencies": {
    "react": "^18"
  }
}
{
  "name": "package-c",
  "dependencies": {}
}

As both package a & b use react, the react is installed in the root node_modules, thus allowing it to be imported by package c too. When react is also used in the source code of package c, it should be listed in the dependency or dev dependency list

@QuiiBz QuiiBz added the enhancement New feature or request label Aug 12, 2024
@QuiiBz
Copy link
Owner

QuiiBz commented Aug 12, 2024

That's a cool idea, but I'm not sure how we could reliably detect if another package is using a dependency that isn't specified in its own dependencies / devDependencies. At a first glance, we would have to analyze the source code for all packages to detect any import statements, which might be expensive.

Do you have any other idea in mind?

@Netail
Copy link
Author

Netail commented Aug 13, 2024

That's a good question, to which I do not have the answer to :(

@alSergey
Copy link

alSergey commented Sep 3, 2024

eslint-plugin-import has a similar rule.

@Netail
Copy link
Author

Netail commented Sep 3, 2024

eslint-plugin-import has a similar rule.

Does it work with monorepo's?

@alSergey
Copy link

alSergey commented Sep 3, 2024

Yes, it looks for dependencies in the nearest package.json file. I use it in my monorepo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants