Merge pull request #5723 from tkqubo/gulp-coffeelint

Add gulp-coffeelint
This commit is contained in:
Masahiro Wakame
2015-09-09 02:01:54 +09:00
2 changed files with 83 additions and 0 deletions
+57
View File
@@ -0,0 +1,57 @@
/// <reference path="gulp-coffeelint.d.ts" />
/// <reference path="../gulp/gulp.d.ts" />
import coffeelint = require('gulp-coffeelint');
import gulp = require('gulp');
gulp.task('lint', function () {
gulp.src('./src/*.coffee')
.pipe(coffeelint())
.pipe(coffeelint.reporter())
});
gulp.src('./src/*.coffee')
.pipe(coffeelint())
.pipe(coffeelint.reporter('csv'));
declare var stylish: Function;
gulp.src('./src/*.coffee')
.pipe(coffeelint())
.pipe(coffeelint.reporter(stylish));
gulp.src('./src/*.coffee')
.pipe(coffeelint())
.pipe(coffeelint.reporter('coffelint-stylish'));
gulp.src('./src/*.coffee')
.pipe(coffeelint())
.pipe(coffeelint.reporter('coffeelint-stylish'))
.pipe(coffeelint.reporter('fail'));
var myReporter = (function() {
function MyReporter(errorReport: any) {
this.errorReport = errorReport;
}
MyReporter.prototype.publish = function() {
var hasError = this.errorReport.hasError();
if (hasError) {
return console.log('Oh no!');
}
return console.log('Oh yeah!');
};
return MyReporter;
})();
gulp.task('lint', function() {
return gulp.src('./src/*.coffee')
.pipe(coffeelint())
.pipe(coffeelint.reporter(myReporter));
});
+26
View File
@@ -0,0 +1,26 @@
// Type definitions for gulp-coffeelint
// Project: https://github.com/janraasch/gulp-coffeelint
// Definitions by: Qubo <https://github.com/tkQubo>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../node/node.d.ts" />
declare module "gulp-coffeelint" {
namespace coffeelint {
interface Coffeelint {
/**
* @param optFile Absolute path of a json file containing options for coffeelint.
* @param opt Options you wish to send to coffeelint. If optFile is given, this will be ignored.
* @param literate Are we dealing with Literate CoffeeScript?
* @param rules Add custom rules to coffeelint.
*/
(optFile?: string, opt?: any, literate?: boolean, rules?: Function[]): NodeJS.ReadWriteStream;
reporter(reporter?: string|Function): NodeJS.ReadWriteStream;
}
}
var coffeelint: coffeelint.Coffeelint;
export = coffeelint;
}