diff --git a/.eslintignore b/.eslintignore index d80776538..e41f53192 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,4 +1,7 @@ /build /material /site -/lib + +# Temporary +/tests/regression +/lib/tasks/tests/regression diff --git a/.eslintrc b/.eslintrc index f7cfbd0b0..6f081f879 100644 --- a/.eslintrc +++ b/.eslintrc @@ -42,7 +42,7 @@ "rules": { "array-callback-return": 2, "array-bracket-spacing": 2, - "arrow-body-style": 2, + "arrow-body-style": [2, "always"], "arrow-parens": [2, "as-needed"], "arrow-spacing": 2, "block-scoped-var": 2, diff --git a/.travis.yml b/.travis.yml index 62110e081..cacb79b7c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -39,7 +39,6 @@ addons: # Install dependencies before_script: - sudo pip install -r requirements.txt - - npm install # Perform build and tests script: npm run build diff --git a/Gulpfile.babel.js b/Gulpfile.babel.js index cd533025c..fb5224e30 100755 --- a/Gulpfile.babel.js +++ b/Gulpfile.babel.js @@ -60,8 +60,8 @@ const args = yargs * Override gulp.src() for nicer error handling. */ const src = gulp.src -gulp.src = (...glob) => - src.apply(gulp, glob) +gulp.src = (...glob) => { + return src.apply(gulp, glob) .pipe( plumber(function(error) { util.log(util.colors.red( @@ -86,12 +86,14 @@ gulp.src = (...glob) => if (args._[0] !== "watch") throw error })) +} /* * Helper function to load a task */ -const load = task => +const load = task => { require(`./${config.lib}/tasks/${task}`)(gulp, config, args) +} /* ---------------------------------------------------------------------------- * Images @@ -114,12 +116,12 @@ gulp.task("assets:images:build:svg", */ gulp.task("assets:images:build", args.clean ? [ "assets:images:clean" -] : [], () => - gulp.start([ +] : [], () => { + return gulp.start([ "assets:images:build:ico", "assets:images:build:svg" ]) -) +}) /* * Clean images generated by build @@ -152,7 +154,7 @@ gulp.task("assets:javascripts:build", (args.clean ? [ ] : []).concat(args.lint ? [ "assets:javascripts:lint" ] : []), () => { - gulp.start([ + return gulp.start([ "assets:javascripts:build:application", "assets:javascripts:build:modernizr" ]) diff --git a/bin/lint b/bin/lint index 44371fa95..41cf7902d 100755 --- a/bin/lint +++ b/bin/lint @@ -27,5 +27,18 @@ if [ ! -d ../node_modules ]; then exit 1 fi -# Run command +# Run ESLint +$(pwd)/node_modules/.bin/eslint . +ESLINT=$? + +# Run Sass-Lint $(pwd)/node_modules/.bin/sass-lint -c .sass-lint.yml -vq +SASSLINT=$? + +# If one command failed, exit with error +if [ $ESLINT == 1 ] || [ $SASSLINT == 1 ]; then + exit 1 +fi; + +# Otherwise return with success +exit 0 diff --git a/bin/start b/bin/start index 539e42e8c..43ac70f6b 100755 --- a/bin/start +++ b/bin/start @@ -22,7 +22,6 @@ # Check if "npm install" was executed if [ ! -d $(pwd)/node_modules ]; then - ls $(pwd) echo "\"node_modules\" not found:" echo "npm install" exit 1 diff --git a/lib/tasks/assets/javascripts/build/application.js b/lib/tasks/assets/javascripts/build/application.js index 58dfb6e5a..f29e29a88 100644 --- a/lib/tasks/assets/javascripts/build/application.js +++ b/lib/tasks/assets/javascripts/build/application.js @@ -40,7 +40,7 @@ export default (gulp, config, args) => { stream({ entry: [ "whatwg-fetch", - "application.js", + "application.js" ], output: { filename: "application.js",