Mine is that the useState hook is an actual plague on the entire React ecosystem. Regardless of your opinions of React, if you wanna use something then use it right.
Mine is that the useState hook is an actual plague on the entire React ecosystem. Regardless of your opinions of React, if you wanna use something then use it right.
I’ll go a step further: formatting for human-readability is the job of the reader, not the writer. Hardcoded line breaks, spacing, etc. are never going to be a good solution because the idea is wrong from the start. This is a display issue, not a logic issue. It needs to be solved at the display end.
Use a syntax-aware editor that formats code the way you like it. Save it any goddamn way that is syntactically valid. Anyone else who opens it will see it any way the like in their own syntax-aware editor.
“But my editor doesn’t do logical formatting!” Yes, because the entire world has been insane for several decades, and shitty editors are normalized. If the world had realized this 30 years ago, there wouldn’t be a code editor in existence today that didn’t do this properly. Demand better and better will be normalized.
So every MR restyles the code to fit your style? How are you going to review the code?
Every problem in computer science can be solved by adding another layer of indirection.
Whatever is displaying the MR formats it. The server saves a normalized copy.
Like crlf/lf. But for all formatting.
Sure. Toooootally the same thing. Now the server will have to save a copy of your formatting preferences, checkout the project at point t-1, checkout the project at t, format it, create a diff, and present that to you. Now when you leave a comment on line x, it might be line y for another person.
Or make it worse, someone introduces malicious code with UTF-8, or switches around parameters, or adds pragma comments that fundamentally change your code, but your formatter happily fixes that for you in the preview so you are oblivious.
Or you’re hosting this server and someone makes a change that completely reformats the entire codebase, but you see absolutely nothing of it because the preview diff only shows “relevant” changes.
All fine by you👌
Right. You can still put that through a linter; the linter just wouldn’t be concerned with human-readability.
In any case, my editor would not hardcode my display preferences, so if I open and save a document, nothing changes except what I actually changed.