Skip to content

bug: rtk prettier --check incorrectly reports "All files formatted correctly" when files need formatting #221

@cxhamilton

Description

@cxhamilton

When running rtk prettier --check, RTK always reports success even when Prettier exits with code 1 (files need formatting).

Possible Root Cause

filter_prettier_output explicitly excludes lines containing [warn] or [error]. However, prettier --check reports unformatted files using exactly this format: [warn] src/messy.ts. Those lines are filtered out, files_to_format stays empty, and the "all good" branch triggers regardless of the actual exit code.

Steps to Reproduce

  1. Create a file with formatting issues (e.g. tabs instead of spaces)
  2. Run node_modules/.bin/prettier --check src/messy.ts → correctly shows [warn] src/messy.ts and exits 1
  3. Run rtk prettier --check src/messy.ts → incorrectly shows ✓ Prettier: All files formatted correctly

Impact

Silent false negative. Developers using RTK in CI or locally will miss formatting errors. The exit code is preserved correctly (RTK does exit 1), but the output message contradicts it, making the failure invisible when only reading stdout.

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