add eslint task to gulp to let us know how we need to write better code
This commit is contained in:
		
							
								
								
									
										13
									
								
								gulpfile.js
									
									
									
									
									
								
							
							
						
						
									
										13
									
								
								gulpfile.js
									
									
									
									
									
								
							@@ -5,7 +5,8 @@ var gulp = require('gulp'),
 | 
				
			|||||||
    sync = require('browser-sync'),
 | 
					    sync = require('browser-sync'),
 | 
				
			||||||
    reload = sync.reload,
 | 
					    reload = sync.reload,
 | 
				
			||||||
    inject = require('gulp-inject'),
 | 
					    inject = require('gulp-inject'),
 | 
				
			||||||
    reloadDelay = 1000;
 | 
					    reloadDelay = 1000,
 | 
				
			||||||
 | 
					    eslint = require('gulp-eslint');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
var paths = {
 | 
					var paths = {
 | 
				
			||||||
    server: './app.js',
 | 
					    server: './app.js',
 | 
				
			||||||
@@ -54,11 +55,17 @@ gulp.task('sync', ['serve'], function() {
 | 
				
			|||||||
    sync.init(null, {
 | 
					    sync.init(null, {
 | 
				
			||||||
      proxy: 'http://localhost:3000',
 | 
					      proxy: 'http://localhost:3000',
 | 
				
			||||||
      logLeval: 'debug',
 | 
					      logLeval: 'debug',
 | 
				
			||||||
      files: ['public/**/*'],
 | 
					      files: ['public/js/lib/*/*.{js, jsx}'],
 | 
				
			||||||
      port: 3001,
 | 
					      port: 3001,
 | 
				
			||||||
      open: true,
 | 
					      open: true,
 | 
				
			||||||
      reloadDelay: reloadDelay
 | 
					      reloadDelay: reloadDelay
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
gulp.task('default', ['serve', 'sync']);
 | 
					gulp.task('lint', function() {
 | 
				
			||||||
 | 
					  return gulp.src(['public/js/lib/**/*'])
 | 
				
			||||||
 | 
					  .pipe(eslint())
 | 
				
			||||||
 | 
					  .pipe(eslint.format());
 | 
				
			||||||
 | 
					});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					gulp.task('default', ['lint', 'serve', 'sync']);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -74,6 +74,7 @@
 | 
				
			|||||||
    "browser-sync": "^1.8.1",
 | 
					    "browser-sync": "^1.8.1",
 | 
				
			||||||
    "chai": "^1.10.0",
 | 
					    "chai": "^1.10.0",
 | 
				
			||||||
    "gulp": "^3.8.8",
 | 
					    "gulp": "^3.8.8",
 | 
				
			||||||
 | 
					    "gulp-eslint": "^0.9.0",
 | 
				
			||||||
    "gulp-inject": "^1.0.2",
 | 
					    "gulp-inject": "^1.0.2",
 | 
				
			||||||
    "gulp-nodemon": "^1.0.4",
 | 
					    "gulp-nodemon": "^1.0.4",
 | 
				
			||||||
    "mocha": "^2.0.1",
 | 
					    "mocha": "^2.0.1",
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user