Skip to content

Commit

Permalink
Lint the Gulpfile. Add single lint task.
Browse files Browse the repository at this point in the history
Also ensure that the Gulpfile passes linting.

Resolves #256 and #253
  • Loading branch information
jamesplease committed Dec 30, 2015
1 parent 9c16f7f commit 614941b
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 9 deletions.
3 changes: 2 additions & 1 deletion .jscsrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"preset": "google",
"maximumLineLength": null,
"esnext": true
"esnext": true,
"disallowSpacesInsideObjectBrackets": null
}
2 changes: 1 addition & 1 deletion app/templates/_package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"main": "dist/<%= repo %>.js",
"scripts": {
"test": "gulp",
"lint": "gulp lint-src && gulp lint-test",
"lint": "gulp lint",
"test-browser": "gulp test-browser",
"watch": "gulp watch",
"build": "gulp build",
Expand Down
24 changes: 17 additions & 7 deletions app/templates/gulpfile.babel.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ function _clean(dir, done) {
}

function cleanDist(done) {
_clean(destinationFolder, done)
_clean(destinationFolder, done);
}

function cleanTmp() {
_clean('tmp', done)
_clean('tmp', done);
}

// Send a notification when JSCS fails,
Expand Down Expand Up @@ -61,6 +61,10 @@ function lintTest() {
return lint('test/**/*.js');
}

function lintGulpfile() {
return lint('gulpfile.babel.js');
}

function build(done) {
esperanto.bundle({
base: 'src',
Expand Down Expand Up @@ -176,7 +180,7 @@ function watch() {
function testBrowser() {
_browserifyBundle().on('end', () => {
$.livereload.listen({port: 35729, host: 'localhost', start: true});
gulp.watch(otherWatchFiles, ['lint-src', 'lint-test']);
gulp.watch(otherWatchFiles, ['lint']);
$.util.log($.util.colors.green.bold('Ready to go! Open "test/runner.html" in your browser to view the tests. Changes will automatically refresh the browser.'));
});
}
Expand All @@ -193,17 +197,23 @@ gulp.task('lint-src', lintSrc);
// Lint our test code
gulp.task('lint-test', lintTest);

// Lint this file
gulp.task('lint-gulpfile', lintGulpfile);

// Lint everything
gulp.task('lint', ['lint-src', 'lint-test', 'lint-gulpfile']);

// Build two versions of the library
gulp.task('build', ['lint-src', 'clean'], build);
gulp.task('build', ['lint', 'clean'], build);

// Lint and run our tests
gulp.task('test', ['lint-src', 'lint-test'], test);
gulp.task('test', ['lint'], test);

// Set up coverage and run tests
gulp.task('coverage', ['lint-src', 'lint-test'], coverage);
gulp.task('coverage', ['lint'], coverage);

// Set up a livereload environment for our spec runner `test/runner.html`
gulp.task('test-browser', ['lint-src', 'lint-test'], testBrowser);
gulp.task('test-browser', ['lint'], testBrowser);

// Run the headless unit tests as you make changes.
gulp.task('watch', watch);
Expand Down

0 comments on commit 614941b

Please sign in to comment.