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

For an open source project, I'd recommend using an autoformatter, documenting it in the contributing guide, and enforcing it in CI so that anyone submitting a PR can clearly see if they submit something that breaks the formatting rules. I am much happier contributing to projects like these rather than trying to figure out all of the nuances of the author's preferred formatting style. Working with autoformatters for the last year or two has made me care much less about things like tabs vs spaces, I just care that the tooling is set up so that I don't need to think about it.

As a concrete example (for JS projects), you could configure Prettier to use tabs for indentation:

https://prettier.io/docs/en/options.html#tabs

Then you could use eslint-plugin-prettier, which fails lint if the code isn't Prettier-formatted and makes ESLint autofix also run Prettier:

https://github.com/prettier/eslint-plugin-prettier

Then set up lint to run in CI alongside tests.



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

Search: