How can I read and edit unformatted code as if it’s formatted?

0
4
Asked By CuriousCoder42 On

I'm working at a place where we have a TypeScript single-page application, but the code is a mess – no formatting or linters! It's tough to work with. I've suggested installing a formatter like Prettier, but management isn't interested in that 'quick win' for productivity. I want to be able to read the code in a formatted way without needing to format it each time I open a file. Ideally, I'd like to edit the code as if it's nicely formatted but save it back in its original unformatted state. I've tried a few ideas like having a separate git branch for the formatted code, but it's a hassle. Does anyone have suggestions or 'magic' solutions for this?

2 Answers

Answered By CodeWizard99 On

Why not just format the parts you need to work on without asking for permission? You could open merge requests with the formatted code. If anyone complains, it might be time to consider a job change!

Answered By DevGuru88 On

Typically, you might work with formatted code and use a tool to minify it before publishing, which removes formatting. You could try collaborating with the publication team to implement a minifier in the build process. This way, you can reformat the areas you're working on consistently.

QuestionAsker -

But wouldn’t that just make the code harder to read overall?

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.