r/javascript • • Oct 16 '26

Running your code through prettier can change what it does.

https://trustsig.eu/blog/javascript-divergence/
3 Upvotes

6 comments sorted by

-24

u/dustofdeath Oct 17 '26

Prettier is obsolete, any decent IDE, with llm can handle formatting just fine.

14

u/BlazingFire007 Oct 17 '26

Why would you use an LLM to format code?? Or am I misunderstanding

2

u/trustsigRobert Oct 17 '26

He probably meant for reverse engineering, but even in that case LLMs opt to use a formatter to analyze large JavaScripts (when it doesn't fit into context for example). When LLMs write custom deobfuscators they will (basically) never write a custom AST->JS printer and opt to use any existing one (e.g AString) many of which the same techniques I've posted work for.

4

u/trustsigRobert Oct 17 '26

I can go test whatever IDE you have in mind and reply with the results, most IDE's use prettier or similar tool for formatting JavaScript.

When formatting with VSCode built in formatter: "This script was processed by an unknown tool."
With Zed: "You formatted this with Prettier"

Both of which are vulnerable to the divergence caused by the techniques.

4

u/_indi Oct 17 '26

Yes let’s just run a non deterministic LLM in CI to see if code formatting is right.

While we’re at it, we’ll run the tests with an LLM. Vibe test execution.

1

u/dustofdeath Oct 17 '26

The industry has already shifted to full auto code reviews, testing, assisted development - or full development. And successfully with verified results - not basement slop.

Multi agent flows, with skills are doing it better than anybjunior- mid level developers at this point already.