Skip to content

Commit

Permalink
💥 Split lint (and options) up
Browse files Browse the repository at this point in the history
Node, Browser, AVA
  • Loading branch information
Sam Richard committed May 16, 2016
1 parent e2645ba commit 87cf99a
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 4 deletions.
9 changes: 9 additions & 0 deletions lib/defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,16 +69,25 @@ module.exports = {
'application.library',
'application.index',
],
options: {
extends: 'punchcard',
},
},
'lint:browser': {
paths: [
'assets.js',
],
options: {
extends: 'punchcard/configurations/browser',
},
},
'lint:test': {
paths: [
'tests.application',
],
options: {
extends: 'punchcard/configurations/ava',
},
},
'build': {
paths: [
Expand Down
33 changes: 29 additions & 4 deletions tasks/js.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,45 @@ const path = require('path');
// Gulp task to run ESLint
//////////////////////////////
module.exports = (gulp, options) => {
const lintPaths = paths(options.tasks.js.lint.paths, options, 'source');
const lintPaths = {
node: paths(options.tasks.js['lint:node'].paths, options, 'source'),
browser: paths(options.tasks.js['lint:browser'].paths, options, 'source'),
test: paths(options.tasks.js['lint:test'].paths, options, 'source'),
};
const lintOptions = {
node: options.tasks.js['lint:node'].options,
browser: options.tasks.js['lint:browser'].options,
test: options.tasks.js['lint:test'].options,
};
const jsPaths = paths(options.tasks.js.build.paths, options, 'source');
const output = path.join(options.assets._folders.public, options.assets.js.dest);

/**
* Gulp task to watch all JavaScript files and lint them
**/
gulp.task('js:lint', () => {
return gulp.src(lintPaths)
.pipe(eslint())
gulp.task('js:lint:node', () => {
return gulp.src(lintPaths.node)
.pipe(eslint(lintOptions.node))
.pipe(eslint.format())
.pipe(gif(options.options.fail, eslint.failOnError()));
});

gulp.task('js:lint:browser', () => {
return gulp.src(lintPaths.browser)
.pipe(eslint(lintOptions.browser))
.pipe(eslint.format())
.pipe(gif(options.options.fail, eslint.failOnError()));
});

gulp.task('js:lint:test', () => {
return gulp.src(lintPaths.test)
.pipe(eslint(lintOptions.test))
.pipe(eslint.format())
.pipe(gif(options.options.fail, eslint.failOnError()));
});

gulp.task('js:lint', ['js:lint:node', 'js:lint:browser', 'js:lint:test']);

/**
* Gulp task to copy all JavaScript files and to public
**/
Expand Down

0 comments on commit 87cf99a

Please sign in to comment.