patternfly / patternfly/patternfly-react

Bug - react-code-editor - unsatisfied peer dependency from @monaco/react

Open Beginner friendly
#11,923 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Stale
Dominant language
TypeScript
Stars
862
Forks
392
Avg merge
4d 8h
Merged PRs (30d)
9

Description

Describe the problem

@patternfly/react-code-editor has:

  • dependency on @monaco-editor/react

  • devDependency on monaco-editor

@monaco-editor/react has:

  • peer dependency "monaco-editor": ">= 0.25.0 [ 1"

I (@hawtio/react) have a peer+dev dependency on @patternfly/react-code-editor and during yarn install I get Some peer dependencies are incorrectly met by dependencies; run yarn explain peer-requirements for details.

The details:

$ yarn explain peer-requirements pce8ff
Package @patternfly/react-code-editor@npm:5.4.18 [9caf3] is requested to provide monaco-editor by its descendants

@patternfly/react-code-editor@npm:5.4.18 [9caf3]
└─ @monaco-editor/react@npm:4.7.0 [0e353] (via ]= 0.25.0 [ 1)

✘ Package @patternfly/react-code-editor@npm:5.4.18 [9caf3] does not provide monaco-editor.

At @hawtio/react level, I can't satisfy the transitive peer dependency on monaco-editor by adding it to my dependencies.
I also can't hoist the peer requirement to my package by adding monaco-editor to my peerDependencies.

How do you reproduce the problem?
See the description

Expected behavior
No warnings during yarn install.

Also @patternfly/react-code-editor should do one of these:

  • add monaco-editor to its dependencies

  • add monaco-editor to its peerDependencies

adding it to devDependencies breaks the peer contract.

I verified the suggestions with my .yarnrc.yml:

packageExtensions:
  "@patternfly/react-code-editor@*":
    dependencies:
      "monaco-editor": "^0.52.0"

when using:

peerDependencies:
      "monaco-editor": "^0.52.0"

I got expected error at my @hawtio/react level:

$ yarn explain peer-requirements p3f5f3
Package @hawtio/react@workspace:packages/hawtio is requested to provide monaco-editor by its descendants

@hawtio/react@workspace:packages/hawtio
└─ @patternfly/react-code-editor@npm:5.4.18 [9caf3] (via ^0.52.0)
   └─ @monaco-editor/react@npm:4.7.0 [0e353] (via ]= 0.25.0 < 1)

✘ Package @hawtio/react@workspace:packages/hawtio does not provide monaco-editor.

But this one can be fixed when @hawtio/react adds a dependency or dev dependency on monaco-editor.

And to make things more confusing - @patternfly/react-code-editor is actually satisfying peer dependency on monaco-editor from @monaco/react by adding monaco-editor to its devDependencies.

But when I (@hawtio/react) use @patternfly/react-code-editor, this peer satisfaction breaks.

I believe you have to add monaco-editor as peer dependency to @patternfly/react-code-editor.

Is this issue blocking you?
No

What is your environment?

  • OS: Linux

  • Browser (build time issue)

  • Version: 5.4.18

What is your product and what release date are you targeting?
It's Hawtio, no strict release date.


Jira Issue: PF-2361

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in the @patternfly/react-code-editor package manifest and inspect how monaco-editor is declared relative to @monaco-editor/react's peer dependency. Update the dependency declaration as appropriate, then run yarn install and verify that the peer-dependency warning is gone.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.