Fix linter errors and warnings

This commit is contained in:
squidfunk 2016-10-31 09:58:43 +01:00
parent bcf634faa8
commit cedc65d9fa
7 changed files with 29 additions and 13 deletions

View File

@ -1,4 +1,7 @@
/build
/material
/site
/lib
# Temporary
/tests/regression
/lib/tasks/tests/regression

View File

@ -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,

View File

@ -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

View File

@ -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"
])

View File

@ -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

View File

@ -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

View File

@ -40,7 +40,7 @@ export default (gulp, config, args) => {
stream({
entry: [
"whatwg-fetch",
"application.js",
"application.js"
],
output: {
filename: "application.js",