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
Summary
Please consider using Formatly in
@react-router/devinstead of depending directly on Prettier.Motivation
packages/react-router-dev/cli/useJavascript.tscurrently importsprettierand callsprettier.format(...)on JavaScript generated by Babel. As a result,@react-router/devincludes Prettier as a runtime dependency even when the consuming project uses another formatter such as Biome, dprint, ordeno 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
transpilefunction 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
react-router/packages/react-router-dev/cli/useJavascript.ts
Line 29 in 8bc59bc