Skip to content

Prettier has been updated to 3.7.0, this plugin gives error with this version of Prettier #504

@ExoticGamerrrYT

Description

@ExoticGamerrrYT

Describe the bug
After updating Prettier to version 3.7.0, formatting .svelte files using prettier-plugin-svelte fails with a runtime error.

To Reproduce
Steps to reproduce the behavior:

  1. Install Prettier 3.7.0 and prettier-plugin-svelte@3.4.0.
  2. Run prettier --write . on a project with .svelte files.

Expected behavior
Svelte files should be formatted correctly without throwing errors.

Actual behavior
Prettier throws the following error:


TypeError: getVisitorKeys is not a function or its return value is not iterable
at recurse (index.mjs:17713:24)
at printEmbeddedLanguages (index.mjs:17683:3)
at printAstToDoc (index.mjs:17792:9)
at async coreFormat (index.mjs:18171:14)
at async formatWithCursor (index.mjs:18384:14)
at async formatFiles (internal/legacy-cli.mjs:5831:18)
at async main (internal/legacy-cli.mjs:6220:5)
at async Module.run (internal/legacy-cli.mjs:6163:5)

Additional context

  • prettier-plugin-svelte version: 3.4.0
  • Prettier version: 3.7.0
  • Svelte version: 5.x

This issue does not occur with Prettier 3.6.2. It appears to be a compatibility problem with the newly released Prettier 3.7.0.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions