futurepress / epub.js

Enhanced eBooks in the browser.
http://futurepress.org
Other
6.48k stars 1.11k forks source link

Formalize coding conventions #379

Open jacksonrayhamilton opened 8 years ago

jacksonrayhamilton commented 8 years ago

In both v0.2 and v0.3 I've noticed that the codebase is pretty lax in terms of formatting and conventions. (Tabs and spaces are interchanged for indentation, this is sometimes assigned to a variable and sometimes not, var statements are sometimes on top and sometimes close to place of first use...) It'd be easier for contributors to structure their code if there were some more consistent models to reference. It'd also make editing and reviewing easier by reducing the likelihood of whitespace-oriented commits.

It might be worth considering adding an Editorconfig and a JSCS configuration, and formatting all the code to align with them. That should be easy to do with JSCS's "autofix" feature. The best time to do that would be when all pending PRs are resolved, to avoid merge conflicts. It will only have to happen once, since JSCS should guarantee consistency afterwards (especially if you configure it as a pre-merge hook using something like Travis).

evanmuller commented 6 years ago

I would highly recommend using prettier (https://github.com/prettier/prettier) and not deviating from its defaults. Using prettier means not having to think about code formatting and not needing to have these discussions.