Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
gulp.task('ts-lint', 'Lint TypeScript code', () =>{
return utils.plumbedSrc(// handle errors nicely (i.e., without breaking watch)
config.typescript.srcAppOnly // only the application's code needs to be checked
)
// Display the files in the stream
//.pipe(debug({title: 'Stream contents:', minimal: true}))
// Check the code quality
.pipe(tslint())
// Fail the build only if BrowserSync is not active
.pipe(iff(!browserSync.active, tslint.report('prose')))
.pipe(iff(browserSync.active, tslint.report('prose', {
emitError: false
})))
// Task result
.pipe(size({
title: 'ts-lint'
}));
});
return () => {
return gulp.src(files)
.pipe(reload({stream: true, once: true}))
// .pipe($.eslint(options))
.pipe($.eslint.format())
.pipe($.if(!browserSync.active, $.eslint.failAfterError()));
};
}
function rebundle() {
const stream = bundler.bundle();
gutil.log('Rebundle...');
return stream.on('error', handleErrors)
.pipe(source(file))
.pipe(gulpif(global.isProd, streamify(uglify())))
.pipe(streamify(rename({
basename: 'main'
})))
.pipe(gulpif(!global.isProd, sourcemaps.write('./')))
.pipe(gulp.dest(config.scripts.dest))
.pipe(gulpif(browserSync.active, browserSync.reload({ stream: true, once: true })));
}
gulp.task('lint:js', function () {
return gulp.src([
'gulpfile.js',
dirs.src + '/js/**/*.js',
]).pipe(plugins.jshint())
.pipe(plugins.jshint.reporter('jshint-stylish'))
.pipe(plugins.if(!browserSync.active, plugins.jshint.reporter('fail')));
});
gulp.task('jshint', function () {
return gulp.src(['src/**/*.js', 'test/spec/**/*.js'])
.pipe(reload({stream: true, once: true}))
.pipe($.jshint())
.pipe($.jshint.reporter('jshint-stylish'))
.pipe($.if(!browserSync.active, $.jshint.reporter('fail')));
});
gulp.task('lint', () =>
gulp.src([
'app/scripts/main.js',
//'app/scripts/index.js',
'!app/scripts/encoder.js',
'!app/scripts/modernizer.min.js',
'!app/scripts/FileSaver.min.js',
'!app/scripts/Blob.js',
'!app/scripts/canvas-toBlob.js'])
.pipe($.eslint())
.pipe($.eslint.format())
.pipe($.if(!browserSync.active, $.eslint.failOnError()))
);
function startBrowserSync() {
if (!env.sync || browserSync.active) {
return;
}
var filestowatch = [
'./demos/**/*.html',
'./src/**/*.js',
'./src/**/*.css',
'./src/**/*.html',
'./src/**/*.json',
'./src/content/images/**/*.*'
];
log('Starting BrowserSync on port ' + server_port);
browserSync({
proxy: 'localhost:' + server_port,
port: 3000,
function lint(files, options) {
return gulp.src(files)
.pipe(reload({stream: true, once: true}))
.pipe($.eslint(options))
.pipe($.eslint.format())
.pipe($.if(!browserSync.active, $.eslint.failAfterError()));
}
gulp.task('jscs', function() {
return gulp.src(['src/**/*.js' , 'gulpfile.js'])
.pipe(reload({stream: true, once: true}))
.pipe($.jscs())
.pipe($.if(!browserSync.active, $.jshint.reporter('fail')));
});
gulp.task('scripts:lint', (cb) => {
return gulp.src('src/scripts/**/*.js')
.pipe($.eslint())
.pipe($.eslint.format())
.pipe(browserSync.active ? $.util.noop() : $.eslint.failOnError());
});