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(linter): error on dependencies that are only in devDependencies instead of production dependencies #18780

Merged
merged 1 commit into from
Aug 22, 2023

Conversation

jaysoo
Copy link
Member

@jaysoo jaysoo commented Aug 22, 2023

This PR makes it so that packages listed under devDependencies are not counted as correct. User must add the dependency to dependencies, peerDependencies, or optionalDependencies since devDependencies are not installed for the end user (consumer of the published project).

For example, say I have a project with this package.json:

{
  // ...
  "devDependencies": {
    "foo": "1.0.0"
  }
}

And in my project I have import 'foo' somewhere in the source code.

In the existing version of the dep checks rule, it will not error out. However, if a consumer installed my published package, they will get an error because foo package is not installed. The fix in this PR will force the user to move foo to dependencies, peerDependencies, or optionalDependencies.

Current Behavior

Adding a dependency to devDependencies satisfies the dep check.

Expected Behavior

Dependency cannot only be in devDependencies.

Related Issue(s)

Fixes #

@jaysoo jaysoo requested a review from a team as a code owner August 22, 2023 18:01
@jaysoo jaysoo requested a review from JamesHenry August 22, 2023 18:01
@vercel
Copy link

vercel bot commented Aug 22, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
nx-dev ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 22, 2023 7:32pm

@meeroslav meeroslav merged commit 9ffea2b into nrwl:master Aug 22, 2023
3 checks passed
FrozenPandaz pushed a commit that referenced this pull request Aug 23, 2023
…nstead of production dependencies (#18780)

(cherry picked from commit 9ffea2b)
@jaysoo jaysoo deleted the fix/dep-check-lint-standalone branch August 23, 2023 11:40
@github-actions
Copy link

This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 29, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants