News for hackers. Stuff that matters.
Re:The JavaScript Oxidation Compiler by Grom_PE on Monday February 23, 2026 @04:46AM (#47120110)
I thought oxfmt would just be a faster drop-in replacement for "biome format"... It wasn't.

Let this be a warning: running oxfmt without any arguments recursively scans directory tree from the current directory for all *.js and *.ts files and silently reformats them.

Thanks to that, I got a few of my Allman-formatted JavaScript files I care about messed up with no option to format them back from K&R style.

Re:The JavaScript Oxidation Compiler by tomashubelbauer on Monday February 23, 2026 @05:28AM (#47120427)
> running oxfmt without any arguments recursively scans directory tree from the current directory for all .js and .ts files and silently reformats them

I've got to say this is what I would have expected and wanted to happen. I'd say it is wise to not run tools designed to edit files on files you don't have a backup for (like Git) without doing a dry-run or a small scope experiment first.

Re:The JavaScript Oxidation Compiler by vladvasiliu on Monday February 23, 2026 @05:45AM (#47120573)
While I can get behind things such as "use version control," "use backups", etc. this is definitely not what I'd expect from a program run without arguments, especially when it will go and change stuff.
Re:The JavaScript Oxidation Compiler by Tadpole9181 on Monday February 23, 2026 @08:45AM (#47122258)
What? The very first page of documentation tells you this. The help screen clearly shows a `--check` argument. This is a formatter and uses the same arguments as many others - in particular Prettier, the most popular formatter in the ecosystem.

How were you not expecting this? Did you not bother to read anything before installing and running this command on a sensitive codebase?

Re:The JavaScript Oxidation Compiler by vladvasiliu on Monday February 23, 2026 @10:30AM (#47123582)
I do usually run new tools from somewhere harmless, like ~/tmp, just in case they do something unexpected.

But most formatters I'm used to absolutely don't do this. For example, `rustfmt` will read input from stdin if no argument is given. It can traverse modules in a project, but it won't start modifying everything under your CWD.

Most unix tools will either wait for some stdin or dump some kind of help when no argument is given. Hell, according to this tool's docs, even `prettier` seems to expect an argument:

    > Running oxfmt without arguments formats the current directory (*equivalent to prettier --write .*)
I'm not familiar with prettier, so I may be wrong, but from the above, I understand that prettier doesn't start rewriting files if no argument is given?

Looking up prettier's docs, they have this to say:

    > --write
    This rewrites all processed files in place. *This is comparable to the eslint --fix* workflow.
So eslint also doesn't automatically overwrite everything?

So yeah, I can't say this is expected behaviour, even if it's documented.

Re:The JavaScript Oxidation Compiler by johnny22 on Monday February 23, 2026 @04:30PM (#47129147)
a more related tool would be prettier, which also has a --write option
Re:The JavaScript Oxidation Compiler by nindalf on Monday February 23, 2026 @06:04AM (#47120702)
> with no option to format them back

Try git reset --hard, that should work.

Re:The JavaScript Oxidation Compiler by jagged-chisel on Monday February 23, 2026 @05:11AM (#47120303)
These files are under version control, right? Or backed up. Right?
Re:The JavaScript Oxidation Compiler by watt on Wednesday February 25, 2026 @01:58AM (#47148250)
until the day you accidentally run it in your home directory without any arguments.
Re:The JavaScript Oxidation Compiler by Sammi on Monday February 23, 2026 @05:40AM (#47120529)
This is user error. oxfmt did what you asked it to do.
Re:The JavaScript Oxidation Compiler by rk06 on Monday February 23, 2026 @06:10AM (#47120746)
I don't think so. If someone runs a tool without args, the tool should do equivalent of "tool --help"

It is bad ux.

Re:The JavaScript Oxidation Compiler by Sammi on Monday February 23, 2026 @06:26AM (#47120879)
I expect a file formatter to format the files when I call it. Anything else would be surprising to me.
Re:The JavaScript Oxidation Compiler by rk06 on Monday February 23, 2026 @06:39AM (#47120991)
a new user should not expected to know whether to use "--info", "--help", or "-info" or "/info"

A power user can just pass the right params. Besides, it is not that hard to support "--yolo" parameter for that use case

Re:The JavaScript Oxidation Compiler by xigoi on Monday February 23, 2026 @06:59AM (#47121185)
Would you enjoy writing `rm --yolo file` instead of `rm file` every time?
Re:The JavaScript Oxidation Compiler by user3939382 on Monday February 23, 2026 @07:19AM (#47121351)
Not taking a position but the design of rm strengthens the position that recursive by default without flags isn’t ok. rm makes you confirm when you want changes to recurse dirs.
Re:The JavaScript Oxidation Compiler by phcreery on Monday February 23, 2026 @08:51AM (#47122314)
In this case, "file" is the arg, not --yolo. `rm` without any args returns `` rm: missing operand Try 'rm --help' for more information. ```

`oxfmt` should have done the same and `oxfmt .`, with the desired dir ".", should have been the required usage.

Re:The JavaScript Oxidation Compiler by xigoi on Monday February 23, 2026 @03:48PM (#47128572)
I expect invoking a command-line tool without any arguments to perform the most common action. Displaying the help should only be a fallback if there is no most common action. For example, `git init` modifies the current directory instead of asking you, because that’s what you want to do most of the time.
Re:The JavaScript Oxidation Compiler by vladvasiliu on Monday February 23, 2026 @10:35AM (#47123669)
No, but we're not talking about `oxfmt file` here, but `oxfmt` with no argument.

I don't expect `rm` with no argument to trash everything in my CWD. Which it doesn't, see sibling's comment.

Re:The JavaScript Oxidation Compiler by watt on Wednesday February 25, 2026 @01:56AM (#47148239)
would you enjoy it if running "rm" in any folder recursively deleted all files in it?
Re:The JavaScript Oxidation Compiler by aquariusDue on Monday February 23, 2026 @12:02PM (#47125069)
I know feels aren't the objective truth but I feel like most people would default to running "new-cli-tool --help" first thing as a learned (defensive) habit. After all quite a bit of stuff that runs in a terminal emulator does something when ran without arguments or flags.
Re:The JavaScript Oxidation Compiler by rk06 on Monday February 23, 2026 @11:35PM (#47132906)
I feel most people should refer to manual before running arbitary command. but that's because "crontab -r" has taught me this the hard way.

I do not feel that new devs should not learn these things the hard way

Re:The JavaScript Oxidation Compiler by monster_truck on Monday February 23, 2026 @07:22AM (#47121388)
You couldn't waterboard this outta me
Re:The JavaScript Oxidation Compiler by ramon156 on Monday February 23, 2026 @05:26AM (#47120410)
Do you not use a VCS?
Re:The JavaScript Oxidation Compiler by phplovesong on Monday February 23, 2026 @05:04AM (#47120256)
Git undo?
Re:The JavaScript Oxidation Compiler by ctmnt on Monday February 23, 2026 @10:12AM (#47123328)
If only. But `jj undo`?
Re:The JavaScript Oxidation Compiler by ctmnt on Monday February 23, 2026 @10:11AM (#47123312)
I assume you mean what’s more properly called Java style [1], where the first curly brace is on the same line as the function declaration (or class declaration, but if you’re using Allman style you’re probably not using classes; no shade, I’m a JS class hater myself) [2] or control statement [3], the elses (etc) are cuddled, and single statement blocks are enclosed in curly braces. Except I also assume that oxfmt’s default indentation is 2 spaces, following Prettier [4], whereas Java style specified 4.

So maybe we should call it JavaScript style? Modern JS style? Do we have a good name for it?

Also, does anyone know when and why “K&R style” [5] started being used to refer to Java style? Meaning K&R statement block style (“Egyptian braces” [6]) being used for all braces and single statement blocks getting treated the same as multi-statement blocks. Setting aside the eternal indentation question.

1: https://en.wikipedia.org/wiki/Indentation_style#Java

2: https://www.oracle.com/java/technologies/javase/codeconventi...

3: https://www.oracle.com/java/technologies/javase/codeconventi...

4: https://prettier.io/docs/options#tab-width

5: https://ia903407.us.archive.org/35/items/the-ansi-c-programm...

6: https://en.wikipedia.org/wiki/Indentation_style#Egyptian_bra...

Re:The JavaScript Oxidation Compiler by ljm on Monday February 23, 2026 @10:21AM (#47123445)
Well, one way to boost this command to fame is to open an issue on the repo and crash out.[0]

[0] https://github.com/microsoft/vscode/issues/32405