diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..cdb36c1 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,11 @@ +# http://editorconfig.org +root = true + +[*] +charset = utf-8 +insert_final_newline = true +trim_trailing_whitespace = true + +[{*.js,*.json,*.yml}] +indent_size = 2 +indent_style = space diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 0000000..62562b7 --- /dev/null +++ b/.eslintignore @@ -0,0 +1,2 @@ +coverage +node_modules diff --git a/.eslintrc.yml b/.eslintrc.yml new file mode 100644 index 0000000..c11e9a3 --- /dev/null +++ b/.eslintrc.yml @@ -0,0 +1,6 @@ +root: true + +rules: + eol-last: error + indent: [error, 2, { SwitchCase: 1 }] + no-trailing-spaces: error diff --git a/.travis.yml b/.travis.yml index 4825202..28ec3c1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -21,6 +21,7 @@ before_install: # Setup Node.js version-specific dependencies - "test $TRAVIS_NODE_VERSION != '0.8' || npm rm --save-dev istanbul" + - "test $(echo $TRAVIS_NODE_VERSION | cut -d. -f1) -ge 4 || npm rm --save-dev $(grep -E '\"eslint\\S*\"' package.json | cut -d'\"' -f2)" # Update Node.js modules - "test ! -d node_modules || npm prune" @@ -29,5 +30,6 @@ script: # Run test script, depending on istanbul install - "test ! -z $(npm -ps ls istanbul) || npm test" - "test -z $(npm -ps ls istanbul) || npm run-script test-ci" + - "test -z $(npm -ps ls eslint) || npm run-script lint" after_script: - "test -e ./coverage/lcov.info && npm install coveralls@2 && cat ./coverage/lcov.info | coveralls" diff --git a/appveyor.yml b/appveyor.yml index dd14cd9..caad7b2 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -17,6 +17,7 @@ install: - ps: Install-Product node $env:nodejs_version - npm config set shrinkwrap false - if "%nodejs_version%" equ "0.8" npm rm --save-dev istanbul + - for /f tokens^=2^ delims^=^" %%m in ('findstr /r /c:"eslint[^ ]" package.json') do call npm rm --save-dev %%m - if exist node_modules npm prune - if exist node_modules npm rebuild - npm install diff --git a/package.json b/package.json index ba69e7c..4253894 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,8 @@ }, "devDependencies": { "after": "0.8.2", + "eslint": "3.19.0", + "eslint-plugin-markdown": "1.0.0-beta.6", "istanbul": "0.4.5", "mocha": "2.5.3", "supertest": "1.1.0" @@ -30,6 +32,7 @@ "node": ">= 0.8.0" }, "scripts": { + "lint": "eslint --plugin markdown --ext js,md .", "test": "mocha --reporter spec --bail --check-leaks test/", "test-ci": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks test/", "test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks test/"