Skip to content

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

@grgrzybek

Description

@grgrzybek

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    Status

    Needs triage

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions