Skip to content

Commit a27a499

Browse files
committed
Merge pull request #169 from jakemmarsh/eslint-gulp-tasks
Add gulp tasks to eslint
2 parents 7269978 + 0ead43d commit a27a499

File tree

6 files changed

+14
-20
lines changed

6 files changed

+14
-20
lines changed

gulp/config.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ export default {
1818
scripts: {
1919
src: 'app/js/**/*.js',
2020
dest: 'build/js',
21-
test: 'test/**/*.js'
21+
test: 'test/**/*.js',
22+
gulp: 'gulp/**/*.js'
2223
},
2324

2425
images: {

gulp/tasks/browserify.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ function createSourcemap() {
2323

2424
// Based on: http://blog.avisi.nl/2014/04/25/how-to-keep-a-fast-build-with-browserify-and-reactjs/
2525
function buildScript(file) {
26-
26+
2727
let bundler = browserify({
2828
entries: [config.sourceDir + 'js/' + file],
2929
debug: createSourcemap(),
@@ -62,7 +62,7 @@ function buildScript(file) {
6262
.pipe(gulpif(createSourcemap(), buffer()))
6363
.pipe(gulpif(createSourcemap(), sourcemaps.init({ loadMaps: true })))
6464
.pipe(gulpif(global.isProd, streamify(uglify({
65-
compress: { drop_console: true }
65+
compress: { drop_console: true } // eslint-disable-line camelcase
6666
}))))
6767
.pipe(gulpif(createSourcemap(), sourcemaps.write(sourceMapLocation)))
6868
.pipe(gulp.dest(config.scripts.dest))

gulp/tasks/eslint.js

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,8 @@ import gulp from 'gulp';
55
import eslint from 'gulp-eslint';
66

77
gulp.task('eslint', () => {
8-
// Be sure to return the stream from the task;
9-
// Otherwise, the task may end before the stream has finished.
10-
return gulp.src([config.scripts.src, '!app/js/templates.js', config.scripts.test])
11-
// eslint() attaches the lint output to the "eslint" property
12-
// of the file object so it can be used by other modules.
8+
return gulp.src([config.scripts.src, '!app/js/templates.js', config.scripts.test, config.scripts.gulp])
139
.pipe(eslint())
14-
// eslint.format() outputs the lint results to the console.
15-
// Alternatively use eslint.formatEach() (see Docs).
1610
.pipe(eslint.format())
17-
// To have the process exit with an error code (1) on
18-
// lint error, return the stream and pipe to failAfterError last.
1911
.pipe(eslint.failAfterError());
2012
});

gulp/tasks/protractor.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
'use strict';
22

3-
import config from '../config';
4-
import testServer from '../util/testServer';
5-
import express from 'express';
6-
import gulp from 'gulp';
3+
import config from '../config';
4+
import testServer from '../util/testServer';
5+
import gulp from 'gulp';
76
import {
87
protractor,
98
webdriver

gulp/util/bundleLogger.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@ export default {
1414

1515
start() {
1616
startTime = process.hrtime();
17-
gutil.log('Running', gutil.colors.green(`'bundle'`) + '...');
17+
gutil.log('Running', gutil.colors.green('\'bundle\'') + '...');
1818
},
1919

2020
end() {
2121
var taskTime = process.hrtime(startTime);
2222
var prettyTime = prettyHrtime(taskTime);
23-
gutil.log('Finished', gutil.colors.green(`'bundle'`), 'in', gutil.colors.magenta(prettyTime));
23+
gutil.log('Finished', gutil.colors.green('\'bundle\''), 'in', gutil.colors.magenta(prettyTime));
2424
}
2525

2626
};

gulp/util/testServer.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,10 @@ export default function testServer({port, dir}) {
88

99
app.use(express.static(dir));
1010

11-
return new Promise((res, rej) => {
12-
const server = app.listen(port, () => res(server));
11+
return new Promise((resolve) => {
12+
const server = app.listen(port, () => {
13+
resolve(server);
14+
});
1315
});
1416

1517
}

0 commit comments

Comments
 (0)