Skip to content

Commit

Permalink
fix(app): Remove jshint
Browse files Browse the repository at this point in the history
  • Loading branch information
thaiat committed Mar 28, 2016
1 parent f92ec8a commit e4a9950
Show file tree
Hide file tree
Showing 7 changed files with 2 additions and 340 deletions.
25 changes: 0 additions & 25 deletions .jscsrc

This file was deleted.

80 changes: 0 additions & 80 deletions .jshintrc

This file was deleted.

12 changes: 0 additions & 12 deletions .tern-project

This file was deleted.

109 changes: 2 additions & 107 deletions gulp_tasks/tasks/lint.js
Original file line number Diff line number Diff line change
@@ -1,118 +1,13 @@
'use strict';

var gulp = require('gulp');
var map = require('map-stream');
var chalk = require('chalk');
var _ = require('lodash');
var jshint = require('gulp-jshint');
//var jscs = require('gulp-jscs');
var eslint = require('gulp-eslint');
var gutil = require('gulp-util');
var plumber = require('gulp-plumber');
var constants = require('../common/constants')();

gulp.task('jshint', false, function() {
var hasError = false;
var hasShown = false;
var successReporter = map(function(file, cb) {
if (!file.jshint.success) {
hasError = true;
}
cb(null, file);
});

gulp.src(constants.lint)
.pipe(jshint({
lookup: true
}))
.pipe(successReporter)
.pipe(jshint.reporter('jshint-stylish'))
.pipe(jshint.reporter('fail'))
.on('error', function() {
gutil.log(chalk.red('Jshint failed'));
throw new Error('jshint failed');
})
.pipe(map(function() {
if (!hasError && !hasShown) {
hasShown = true;
gutil.log(chalk.green('All Jshint files passed'));

}

}));
});

gulp.task('eslint', false, function() {
var hasError = false;
var hasShown = false;
gulp.src(constants.lint)
.pipe(eslint())
.pipe(eslint.format())
.on('data', function(file) {

if (file.eslint.messages && file.eslint.messages.length && _.any(file.eslint.messages, function(item) {
return item.severity === 2;
})) {
hasError = true;
}
})
.on('end', function() {
if (!hasError && !hasShown) {
hasShown = true;
gutil.log(chalk.green('All EsLint files passed'));

} else {
gutil.log(chalk.red('EsLint failed'));

throw new Error('eslint failed');
}

});

.pipe(eslint.failAfterError());
});

gulp.task('static', false, function() {

var status = {
hasShown: false,
hasError: false,
errs: []
};
return gulp.src(constants.lint)
.pipe(plumber({
errorHandler: function(err) {
if (err.plugin === 'gulp-jscs') {
gutil.log(err.toString());
}
status.hasError = true;
status.errs.push(err);
if (!status.hasShown) {
status.hasShown = true;

this.emit('end');
}
}
}))
.pipe(jshint({
lookup: true
}))
.pipe(jshint.reporter('jshint-stylish'))
//.pipe(jscs())
.pipe(eslint())
.pipe(eslint.format())
.pipe(jshint.reporter('fail'))
.pipe(eslint.failOnError())
.on('end', function() {
if (status.hasError) {
gutil.log(chalk.red('lint failed'));
throw new Error('lint_error');

} else {
gutil.log(chalk.green('All lint files passed'));

}
});

});
//gulp.task('lint', ['jshint', 'jscs', 'eslint']);
gulp.task('lint', 'Lint all javascript files.', ['static']);
gulp.task('lint', 'Lint all javascript files.', ['eslint']);
4 changes: 0 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,16 +80,12 @@
"gulp-help": "1.6.1",
"gulp-if": "2.0.0",
"gulp-istanbul": "0.10.3",
"gulp-jshint": "2.0.0",
"gulp-mocha": "2.2.0",
"gulp-order": "1.1.1",
"gulp-plumber": "1.1.0",
"gulp-tap": "0.1.3",
"gulp-util": "3.0.7",
"inquirer": "0.12.0",
"jshint": "^2.9.1",
"jshint-stylish": "2.1.0",
"map-stream": "0.0.6",
"mocha": "2.4.5",
"mocha-lcov-reporter": "1.2.0",
"mockery": "1.4.1",
Expand Down
33 changes: 0 additions & 33 deletions startup.sh

This file was deleted.

79 changes: 0 additions & 79 deletions test/.jshintrc

This file was deleted.

0 comments on commit e4a9950

Please sign in to comment.