Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I think the solution to this would be using an auto-formatter that supports “leave this formatting alone” directives and adding them to your code where needed:

    // convert from screen coords to clip space
    // formatting-preserve-start
    clipX = mouseX / screenWidth  *  2 - 1
    clipY = mouseY / screenHeight * -2 + 1  
    // formatting-preserve-end
That way you get the benefit of easy, convenient consistent formatting in the rest of your file at the expense of a few extra comments here and there.

Sadly, ignore comments of the Prettier formatter (https://prettier.io/docs/en/ignore.html) are not this powerful – they only support ignoring the next line of code.



Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: