feat(create): add standalone Prettier toolchain #571
main fromrefs/pull/571/head·merged by tannerlinsley This adds the standalone Prettier choice requested in #510. Use --toolchain prettier during creation or tanstack add prettier in an existing generated project. It formats files and checks formatting without installing a linter.
AI review notes: React and Solid use the existing toolchain metadata and Prettier
^3.8.1range already used by the ESLint toolchain. The new choice includes formatter/check scripts, editable configuration, generated-output/lockfile ignores and instructions using the selected package manager. Defaults remain unchanged.Six blocking generated-app cases cover React and Solid, standard Vite projects with pnpm, blank Rsbuild projects with npm, and adding Prettier to existing blank Vite projects. Each builds and type-checks, confirms no ESLint/Biome dependency or lint script is introduced, formats successfully, rejects deliberately unformatted source, then formats and checks successfully again.
This is the standalone formatter part of #510. Ultracite presets, Oxfmt and the separate Oxlint proposal remain open. No provider services or external infrastructure are involved.
Validation: normal hooks passed all 10 workspace builds, lint, 569 unit tests and all 20 blocking browser cases. The CLI dist JavaScript is unchanged; create dist JavaScript is +14,215 raw bytes and +3,764 gzip bytes, within applicable budgets. These are CLI/core artifact figures, not application client bundle measurements. Published Prettier 3.8.1 metadata declares Node >=14 and no runtime dependencies or install scripts.
Summary by CodeRabbit#
- New Features
- Added a standalone Prettier toolchain for React and Solid apps, available during project creation or through
tanstack add prettier. - Generated projects include
formatandcheckcommands, a consistent Prettier configuration, and sensible default exclusions. This toolchain does not add a linter.
- Added a standalone Prettier toolchain for React and Solid apps, available during project creation or through
- Documentation
- Documented the formatting commands and configuration for both frameworks.
- 1
No actionable comments were generated in the recent review.
Walkthrough
-
React and Solid project templates now provide a standalone Prettier toolchain with formatting and check scripts, Prettier configuration, ignore patterns, and setup metadata. The toolchain can be selected during project creation or added to an existing project. End-to-end tests cover both frameworks and three app modes.
Changes: Standalone Prettier toolchain
Layer / File(s) Summary React and Solid toolchain definitions
packages/create/src/frameworks/{react,solid}/toolchains/prettier/...,.changeset/standalone-prettier-toolchain.mdBoth templates define Prettier formatandcheckscripts, a Prettier configuration and ignore file, and metadata that excludes the linter category. The READMEs document the commands and state that the toolchain does not add a linter. The changeset describes the available invocation options.Generated-app formatting validation
packages/cli/tests-e2e/prettier-smoke.spec.tsThe end-to-end test checks React and Solid apps in standard, blank, and existing-app modes. It verifies the Prettier dependency and scripts, then checks formatting behavior before and after adding blank lines to a route file. Estimated code review effort: 3 (Moderate) | ~20 minutes
Change: Feature
Sequence Diagram(s)#
sequenceDiagram participant SmokeTest participant AppFixture participant PackageScripts participant Prettier SmokeTest->>AppFixture: Create React or Solid app fixture AppFixture-->>SmokeTest: Return project path SmokeTest->>PackageScripts: Run format and check PackageScripts->>Prettier: Execute Prettier commands Prettier-->>SmokeTest: Formatting check succeeds SmokeTest->>SmokeTest: Add blank lines to a route file SmokeTest->>PackageScripts: Run check PackageScripts->>Prettier: Execute prettier --check . Prettier-->>SmokeTest: Check exits with code 1 SmokeTest->>PackageScripts: Run format, then check PackageScripts->>Prettier: Format files and check formatting Prettier-->>SmokeTest: Formatting check succeedsPossibly related issues
- TanStack/cli issue 510 requests standalone Prettier as a formatter option. This change adds the standalone option for project creation and existing projects.
Merge Risk:
Minimal · up to006b8-
This adds an opt-in standalone Prettier toolchain without changing defaults. No concrete merge-blocking risk was found.
Pre-merge checks:
5-
Check name Status Explanation Description Check Check skipped - CodeRabbit’s high-level summary is enabled. Title check The title clearly describes the main change: a standalone Prettier toolchain for create. Docstring Coverage No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat… Linked Issues check Check skipped because no linked issues were found for this pull request. Out of Scope Changes check Check skipped because no linked issues were found for this pull request. Full details: Docstring Coverage
-
Explanation
No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 0 functions across 3 files. (9 skipped: 9 unsupported.)
-
Finishing Touches
-
Generate docstrings
-
- Commit to this branch
- Create a new PR
Generate unit tests (beta)
-
- Commit to this branch
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Warning
Some tools did not complete. Review the errors below.
ESLint-
If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.
packages/cli/tests-e2e/prettier-smoke.spec.ts
-
Parsing error: "parserOptions.project" has been provided for
@typescript-eslint/parser. The file was not found in any of the provided project(s): packages/cli/tests-e2e/prettier-smoke.spec.ts
-
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Recent review info-
Run configuration-
- Source mode: Auto
- Repository: Unavailable
- Branch: Unavailable
- File: No configuration file from this repository applied
- Commit: Unavailable
- Layers: defaults
- Review profile: CHILL
- Plan: Advanced
- Run ID:
60ea6a3a-6e7e-4cd3-acf5-2d46c21fe5f8
Commits-
Reviewing files that changed from the base of the PR and between 82f31a6529a2d24344860bc2ec7a5d00ebed589b and 006b8aaf700ad0886db3c72be9e38bbb12734bb3.
Files selected for processing: 12-
.changeset/standalone-prettier-toolchain.mdpackages/cli/tests-e2e/prettier-smoke.spec.tspackages/create/src/frameworks/react/toolchains/prettier/README.md.ejspackages/create/src/frameworks/react/toolchains/prettier/assets/_dot_prettierignorepackages/create/src/frameworks/react/toolchains/prettier/assets/prettier.config.jspackages/create/src/frameworks/react/toolchains/prettier/info.jsonpackages/create/src/frameworks/react/toolchains/prettier/package.jsonpackages/create/src/frameworks/solid/toolchains/prettier/README.md.ejspackages/create/src/frameworks/solid/toolchains/prettier/assets/_dot_prettierignorepackages/create/src/frameworks/solid/toolchains/prettier/assets/prettier.config.jspackages/create/src/frameworks/solid/toolchains/prettier/info.jsonpackages/create/src/frameworks/solid/toolchains/prettier/package.json
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 2 remain after this review.
-
-
tannerlinsley merged thisd767e4c
tannerlinsley closed this
Sign in to join this conversation.
🦋 Changeset detected#
Latest commit: 006b8aaf700ad0886db3c72be9e38bbb12734bb3
The changes in this PR will be included in the next version bump.
This PR includes changesets to release 7 packages
Not sure what this means? Click here to learn what changesets are.
Click here if you're a maintainer who wants to add another changeset to this PR