From 544c3f4caa39aa9cf964a0c869876a21871c2cac Mon Sep 17 00:00:00 2001 From: Peter Dave Hello Date: Wed, 21 Feb 2018 01:26:02 +0800 Subject: [PATCH 1/3] [New] Add EditorConfig to help maintain part of coding style --- .editorconfig | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 .editorconfig 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 From 0731003cfe84cf03cbdebcc12e942ac3c8fd4602 Mon Sep 17 00:00:00 2001 From: Peter Dave Hello Date: Mon, 26 Feb 2018 02:29:38 +0800 Subject: [PATCH 2/3] [New] Integrate eclint to test partial coding style --- .travis.yml | 4 +++- package.json | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index f55badc..48d4224 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,11 +19,12 @@ before_install: - 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 @@ env: - 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..6c56796 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 ." }, "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", From 0da699605e691f1f7e9ba80cd0bcd321bc3d98e0 Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Sat, 14 Apr 2018 22:12:22 -0700 Subject: [PATCH 3/3] [eclint] only check non-ignored files --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 6c56796..cc6f24f 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,7 @@ "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", - "eclint": "eclint check ." + "eclint": "eclint check $(git ls-tree --name-only HEAD | xargs)" }, "repository": { "type": "git",