Skip to content

Consider Formatly instead of a direct Prettier dependency in @react-router/dev #15347

Description

@aleclarson

Summary

Please consider using Formatly in @react-router/dev instead of depending directly on Prettier.

Motivation

packages/react-router-dev/cli/useJavascript.ts currently imports prettier and calls prettier.format(...) on JavaScript generated by Babel. As a result, @react-router/dev includes Prettier as a runtime dependency even when the consuming project uses another formatter such as Biome, dprint, or deno fmt.

Formatly is intended for developer tools that generate user-owned files. It detects and invokes the formatter already configured by the project, with support for Biome, deno fmt, dprint, and Prettier, with Oxfmt support pending in Formatly PR #544.

Possible approach

Consider replacing the direct Prettier integration with Formatly so generated JavaScript follows the consuming project's formatter configuration.

The current transpile function returns a formatted string, while Formatly operates on generated files or glob patterns. Integration may therefore involve formatting the generated JavaScript after it is written to disk, or adjusting the surrounding workflow as appropriate.

If no supported formatter is configured, React Router could retain the Babel output or otherwise preserve the current fallback behavior.

References

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions