diff --git a/.eslintrc b/.eslintrc new file mode 100644 index 000000000..c7efbc039 --- /dev/null +++ b/.eslintrc @@ -0,0 +1,42 @@ +{ + "extends": "airbnb-base/legacy", + "globals": { + "$": true + }, + "rules": { + "array-callback-return": "off", + "brace-style": "off", + "camelcase": "off", + "comma-dangle": "off", + "consistent-return": "off", + "dot-notation": "off", + "eqeqeq": "off", + "func-names": "off", + "guard-for-in": "off", + "indent": "off", + "keyword-spacing": "off", + "no-console": "off", + "no-inner-declarations": "off", + "no-loop-func": "off", + "no-mixed-operators": "off", + "no-multi-assign": "off", + "no-param-reassign": "off", + "no-redeclare": "off", + "no-restricted-syntax": "off", + "no-shadow": "off", + "no-undef": "off", + "no-underscore-dangle": "off", + "no-unused-vars": "off", + "no-use-before-define": "off", + "object-curly-spacing": "off", + "one-var": "off", + "padded-blocks": "off", + "quote-props": "off", + "quotes": "off", + "semi": "off", + "space-before-function-paren": "off", + "space-unary-ops": "off", + "spaced-comment": "off", + "vars-on-top": "off", + } +} diff --git a/.travis.yml b/.travis.yml index c89197169..f16923bc1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,11 +6,19 @@ env: - TOX_ENV=py27 - TOX_ENV=docs - TOX_ENV=lint + - TOX_ENV=eslint cache: directories: - ~/.cache/pip + - ~/.nvm/nvm.sh install: - pip install tox + - curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.2/install.sh | bash + - source ~/.nvm/nvm.sh + - nvm install --lts + - nvm use --lts + - npm install + - bower install script: - tox -e $TOX_ENV notifications: diff --git a/gulpfile.js b/gulpfile.js index 66a8740a3..3ff363fab 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -12,6 +12,7 @@ var gulp = require('gulp'), vinyl_buffer = require('vinyl-buffer'), es = require('event-stream'), path = require('path'), + eslint = require('gulp-eslint'), pkg_config = require('./package.json'); // Applications with primary static sources. We define these here to avoid @@ -254,4 +255,15 @@ gulp.task('dev', function (done) { })); }); +gulp.task('lint', function (done) { + var paths = Object.keys(sources).map(function(application) { + return path.join(pkg_config.name, application, 'static-src', '**', '*.js'); + }); + return gulp + .src(paths) + .pipe(eslint()) + .pipe(eslint.format()) + .pipe(eslint.failAfterError()); +}); + gulp.task('default', ['build']); diff --git a/package.json b/package.json index c954058b7..35463b1c4 100644 --- a/package.json +++ b/package.json @@ -11,8 +11,11 @@ "bower-resolve": "^2.2.1", "browserify": "*", "debowerify": "git+https://github.com/agjohnson/debowerify.git#8c6b9a7", + "eslint-config-airbnb-base": "^11.2.0", + "eslint-plugin-import": "^2.2.0", "event-stream": "^3.3.1", "gulp": "*", + "gulp-eslint": "^3.0.1", "gulp-less": "^3.0.3", "gulp-rename": "^1.2.2", "gulp-run": "^1.6.6", diff --git a/tox.ini b/tox.ini index 25598e89e..5edaca367 100644 --- a/tox.ini +++ b/tox.ini @@ -30,6 +30,9 @@ commands = --profile=prospector \ --die-on-tool-error +[testenv:eslint] +commands = + gulp lint [testenv:coverage] deps =