Merge pull request #1739 from PeterDaveHello/add-editorconfig

[New] Add EditorConfig to help maintain part of coding style
diff --git a/.editorconfig b/.editorconfig
new file mode 100644
index 0000000..32de192
--- /dev/null
+++ b/.editorconfig
@@ -0,0 +1,16 @@
+root = true
+
+[*]
+tab_width = 2
+indent_size = 2
+charset = utf-8
+end_of_line = lf
+indent_style = space
+insert_final_newline = true
+trim_trailing_whitespace = true
+
+[*.txt]
+indent_size = false
+
+[Makefile]
+indent_style = tab
diff --git a/.travis.yml b/.travis.yml
index f55badc..48d4224 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -19,11 +19,12 @@
   - curl --version
   - wget --version
 install:
-  - if [ -z "${SHELLCHECK-}" ]; then nvm install node && npm install && npm prune && npm ls urchin doctoc; fi
+  - if [ -z "${SHELLCHECK-}" ]; then nvm install node && npm install && npm prune && npm ls urchin doctoc eclint; fi
   - '[ -z "$WITHOUT_CURL" ] || sudo apt-get remove curl -y'
 script:
   - if [ -n "${MAKE_RELEASE-}" ]; then export GIT_EDITOR="sed -i '1 s/^/99.99.99 make release test/'" && git fetch --unshallow --tags && echo proceed | make TAG=99.99.99 release ; fi
   - if [ -n "${DOCTOCCHECK-}" ]; then cp README.md README.md.orig && npm run doctoc && diff -q README.md README.md.orig ; fi
+  - if [ -n "${ECLINT-}" ]; then npm run eclint ; fi
   - if [ -n "${SHELLCHECK-}" ]; then shellcheck -s bash nvm.sh && shellcheck -s sh nvm.sh && shellcheck -s dash nvm.sh && shellcheck -s ksh nvm.sh ; fi
   - if [ -n "${SHELLCHECK-}" ]; then shellcheck -s bash install.sh bash_completion nvm-exec ; fi
   - if [ -n "${SHELL-}" ] && [ -n "${TEST_SUITE}" ]; then if [ "${TEST_SUITE}" = 'installation_iojs' ]; then travis_retry make TEST_SUITE=$TEST_SUITE URCHIN="$(npm bin)/urchin" test-$SHELL ; else make TEST_SUITE=$TEST_SUITE URCHIN="$(npm bin)/urchin" test-$SHELL; fi; fi
@@ -39,6 +40,7 @@
     - MAKE_RELEASE=true
     - DOCTOCCHECK=true
     - SHELLCHECK=true
+    - ECLINT=true
     - SHELL=bash TEST_SUITE=install_script
     - SHELL=sh TEST_SUITE=fast
     - SHELL=dash TEST_SUITE=fast
diff --git a/package.json b/package.json
index e120235..cc6f24f 100644
--- a/package.json
+++ b/package.json
@@ -14,7 +14,8 @@
     "test/installation/node": "shell=$(basename -- $(ps -o comm= $(ps -o ppid= -p $PPID)) | sed 's/^-//'); make TEST_SUITE=installation_node test-$shell",
     "test/installation/iojs": "shell=$(basename -- $(ps -o comm= $(ps -o ppid= -p $PPID)) | sed 's/^-//'); make TEST_SUITE=installation_iojs test-$shell",
     "test/sourcing": "shell=$(basename -- $(ps -o comm= $(ps -o ppid= -p $PPID)) | sed 's/^-//'); make TEST_SUITE=sourcing test-$shell",
-    "doctoc": "doctoc --title='## Table of Contents' --github README.md"
+    "doctoc": "doctoc --title='## Table of Contents' --github README.md",
+    "eclint": "eclint check $(git ls-tree --name-only HEAD | xargs)"
   },
   "repository": {
     "type": "git",
@@ -34,6 +35,7 @@
   },
   "homepage": "https://github.com/creationix/nvm",
   "devDependencies": {
+    "eclint": "^2.6.0",
     "replace": "^0.3.0",
     "semver": "^5.0.1",
     "urchin": "^0.0.5",