Repository navigation
Conversation
Co-authored-by: mathiasrw <1063454+mathiasrw@users.noreply.github.com>
|
@copilot Are we able to detect this before we start listening to the pipe so we send the warning but simley ignore the content and dont load it into mem? |
| config.pipedData !== '\n' && | ||
| config.pipedData !== '\r\n' |
There was a problem hiding this comment.
Why this? what is the reasoning?
Yes. In The trade-off is that without reading from the pipe, we cannot inspect the content, so we cannot distinguish between actual data and an empty pipe or single newline ( |
|
Regarding lines 165-166 ( This follows the behavior on the reference Commands like If you would prefer to warn on single line breaks as well, let me know and I can remove those conditions. |
|
Closing, as this is covered elsewhere now.
The idea from the thread about warning before the pipe is read is dropped, to keep the implementation simple. |
When data is piped in alongside target files and no flag (such as
--replacement-pipeor--replacement-js) indicates how to use it, the piped data is silently ignored. This change introduces warnings as a third message kind alongside info and errors, alerting users to unused piped input.Summary of Changes
Warning Output (
src/output.ts):warn(msg, data)writing tostderrwith a🟡prefix.--quietor--quiet-totalis set.--haltor--bailis enabled.Unused Pipe Detection (
src/engine.ts):🟡 Data is piped in, but no flag tells what to do with it. It is not used.inhandlePipedData()when files are specified and piped data exists.--replacement-pipe, referenced via--replacement-js, dismissed via--void-pipe, or consists only of empty content/single line breaks (\n,\r\n).Documentation (
README.md):Error != warningfrom the future ideas list.Test Suite:
test/js/fix/719.test.jscovering emission, non-halting behavior, pipe consumption flags, and quiet flag suppression.test/cli/run.sh.Example