mapbox / osm-compare

Functions that identify what changed during a feature edit on OpenStreetMap.
ISC License
38 stars 15 forks source link

Format hook #152

Closed kepta closed 7 years ago

kepta commented 7 years ago

This PR adds the following dev dependency

The way it works is.

  1. The user does some changes.
  2. when he/she does git commit -m "my fix".
  3. A precommit hook (prettier-eslint --write) runs.
  4. It formats the code according the .eslintrc file.
  5. Everything happens automagically.

cc @bkowshik @amishas157 @geohacker . Once the PR is merged I can format the entire code base to conform to the .eslintrc file.

(fixes #152 )

bkowshik commented 7 years ago

Good idea @kepta Curious to see what this does, I tried the following.

# 1. Pull in new changes for the branch.
git pull
git checkout format-hook

# 2. Change indentation for one compare function from 2 spaces to 4 spaces.
...

# 3. Add the file and commit it.
git commit -m 'Formatting by 4 spaces'
[format-hook c9b87db] Formatting by 4 spaces
 1 file changed, 25 insertions(+), 25 deletions(-)
 rewrite comparators/disputed_border_tag_changed.js (79%)

I was expecting the file to indent back to 2 spaces automatically.

kepta commented 7 years ago

@bkowshik you are saying it did not indent it back to 2 spaces?

bkowshik commented 7 years ago

Yes @kepta. Can you share an example of the hook in action?