eve-val / eve-roster

Roster management tool for intergalactic spreadsheets
8 stars 3 forks source link

Adopt consistent code formatting rules, ideally with automated enforcement #105

Closed lhkbob closed 3 years ago

lhkbob commented 7 years ago

As the project grows, it's important that the various components maintain a consistent, readable style that everyone agrees on. Things are already pretty close to standard, but due to different editor behaviors, etc. it's not perfect. Below are policies that have implicitly come about and policies that we ought to decide on and/or enforce better:

  1. 2 spaces for indentation, across javascript, css, html, pug, json, vue, etc.
  2. Lines should wrap at some right ruler. blood uses 80, ziggs likes to use 100 as a compromise with 120 but can use 80 too.
  3. Promise chains don't have a hanging indent
  4. Import 3rd party dependencies first, then separated by a newline the local dependencies. These should ideally be ordered alphabetically.
  5. Below imports are constants.
  6. Name the root element's class in vue as the component with an underscore prefix.

Further discussions:

  1. We do need to normalize on the use of ECM6 features like => instead of anonymous functions. Functionally I guess they aren't exactly the same. There is also the import X from blah versus const X = require(blah) to choose from.
  2. Do we use something like http://standardjs.com that avoids semicolons, etc. or do we go the other route and mandate semicolons?
  3. Dangling commas for the end of object and array initializers?
  4. What is our HTML attribute wrapping/chopping policy?
lhkbob commented 7 years ago

One option, giving webstorm's capabilities is that I periodically run it's formatter. This would be reasonably consistent without requiring webstorm adoption. But it would only be necessary if jsbeautifier or prettier don't pan out.

lizthegrey commented 3 years ago

fixed in #471