feat(fmt): support --stdin-filepath - #167
Merged
Merged
Conversation
Deploying rstack-cli with
|
| Latest commit: |
d7e8c28
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://b6e53233.rstack-cli.pages.dev |
| Branch Preview URL: | https://feat-fmt-stdin-filepath.rstack-cli.pages.dev |
fi3ework
force-pushed
the
feat/fmt-stdin-filepath
branch
from
August 3, 2026 16:51
841fdd7 to
d7e8c28
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
rs fmt --stdin-filepath <path>, the stdin formatting mode that editor integrations (conform.nvim, none-ls, etc.) rely on — the equivalent of Prettier's--stdin-filepath. Content is read from stdin, formatted as if it were saved at<path>, and written to stdout.The semantics were decided after surveying how Prettier, Biome, and oxfmt implement their equivalent flags:
--write/--check/--list-differentor file arguments is an error (exit 2), matching oxfmt's parser-level exclusivity rather than Prettier/Biome's silent-ignore behavior.overridesmatching, andsortPackageJson.ignorePatternsor default lock files) skips formatting and writes the input unchanged with exit 0 — all three surveyed tools agree on this, and it keeps editor buffers safe..gitignoreis not consulted, consistent with how explicitly passed file arguments already behave.| head) is not an error.Implementation
src/fmt/format.ts: formatting core extracted fromworker.ts(plugins → parser inference → Prettierformat), with a lazy source reader so unsupported files are still skipped before reading.worker.tskeeps only file I/O and changed/unchanged semantics.src/fmt/stdin.ts: the stdin runner — single file, main thread, no worker pool. Plugins load on demand through the sharedfmtPluginschunk, keeping the lazy-loading behavior introduced in perf(fmt): load plugin resolver on demand #164.src/fmt/cli.ts: flag parsing (kebab + camel, following the existing convention), conflict validation, and a one-line stdin branch.Tests
sortPackageJson, unsupported-before-read, parse errors)..ts/.json,overridesapplication, ignored-path passthrough, unknown-extension and parse-error exit codes, flag conflicts, empty input.Full suite: 176 tests green; lint, type-check, and format check clean.