Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Prettier 3.0.3 can't use plugin-xml in the context of pre-commit #15696

@kamitchell

Description

@kamitchell

See #15517 for previous discussion. Since this problem only happens with plugin-xml, they suggested I report it here.

Environments:

  • Prettier Version: 3.0.3
  • Running Prettier via: pre-commit
  • Runtime: Node.js v20
  • Operating System: macOS
  • Prettier plugins (if any): @prettier/plugin-xml

Steps to reproduce:

Add the following to .pre-commit-config.yaml:

  - repo: https://github.com/pre-commit/mirrors-prettier
    rev: v3.0.3 # Use the sha / tag you want to point at
    hooks:
      - id: prettier
        additional_dependencies:
          - [email protected]
          - "@prettier/[email protected]"

Add a misformatted XML file, and run pre-commit run --all

Expected behavior:

Formats the XML file

Actual behavior:

[error] Cannot find package '@prettier/plugin-xml' imported from /Users/kevin/src/.../noop.js

I tried a whole bunch of options including adding the plugin option to .prettierrc.yaml or adding a --plugin @prettier/plugin-xml to the args in .pre-commit-config.yaml.

Going back to a pre-v3 version works, which is what I'm going to go back to for now.

I've created an example repo: https://github.com/kamitchell/pre-commit-xml-plugin-example which has an example and more discussion of things I tried.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions