Skip to content

Commit 6f90536

Browse files
committed
Added lint task
1 parent 75d09e8 commit 6f90536

File tree

8 files changed

+44
-9
lines changed

8 files changed

+44
-9
lines changed

.eslintrc

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"parser": "babel-eslint"
3+
, "extends": "eslint:recommended"
4+
, "env": {
5+
"browser": true
6+
, "node": true
7+
}
8+
, "rules": {
9+
"strict": 0
10+
}
11+
, "plugins": [
12+
"react"
13+
]
14+
, "ecmaFeatures": {
15+
"jsx": true
16+
}
17+
, "rules": {
18+
"comma-style": [ 2, "first" ]
19+
, "no-unused-vars": [ 2, { "args": "after-used", "varsIgnorePattern": "React" }]
20+
}
21+
}

lib/bump.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
var bump = require('gulp-bump');
22

3-
module.exports = function(gulp, options) {
3+
module.exports = function(gulp) {
44
var bumpVersion = function(type) {
55
return gulp.src('./package.json')
66
.pipe(bump({ type: type }))

lib/lint.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
var eslint = require('gulp-eslint');
2+
3+
module.exports = function(gulp) {
4+
gulp.task('lint', function() {
5+
return gulp.src([ 'lib/**/*.js', 'test/**/*.js' ])
6+
.pipe(eslint())
7+
.pipe(eslint.format())
8+
.pipe(eslint.failAfterError());
9+
});
10+
};

lib/publish.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
module.exports = function(gulp, options) {
1+
module.exports = function(gulp) {
22
gulp.task('publish', function(done) {
33
require('child_process')
44
.spawn('npm', [ 'publish' ], { stdio: 'inherit' })

lib/release.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ var release = function(type) {
44
return sequence('test:release', 'tag:' + type, 'publish');
55
};
66

7-
module.exports = function(gulp, options) {
7+
module.exports = function(gulp) {
88
gulp.task('release', [ 'release:patch' ]);
99

1010
gulp.task('release:patch', release.bind(null, 'patch'));

lib/tag.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
var path = require('path')
22
, git = require('gulp-git');
33

4-
module.exports = function(gulp, options) {
4+
module.exports = function(gulp) {
55
var getVersion = function() {
66
var pkg = require(path.join(process.cwd(), 'package.json'));
77
return pkg.version;
@@ -17,7 +17,7 @@ module.exports = function(gulp, options) {
1717
.on('end', done);
1818
};
1919

20-
var tag = function(type) {
20+
var tag = function() {
2121
var version = 'v' + getVersion()
2222
, message = 'Release ' + version;
2323

lib/test.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ var noOp = function() {
1717
};
1818

1919
var log = function(err) {
20+
/* eslint no-console: 0 */
2021
console.log(err);
2122
};
2223

@@ -47,19 +48,19 @@ module.exports = function(gulp, options) {
4748
.pipe(istanbul.hookRequire());
4849
});
4950

50-
gulp.task('test:unit', function() {
51+
gulp.task('test:unit', [ 'lint' ], function() {
5152
return test('./test/unit/**/*.js');
5253
});
5354

54-
gulp.task('test:integration', function() {
55+
gulp.task('test:integration', [ 'lint' ], function() {
5556
return test('./test/integration/**/*.js');
5657
});
5758

58-
gulp.task('test', [ 'test:coverage' ], function() {
59+
gulp.task('test', [ 'lint', 'test:coverage' ], function() {
5960
return test('./test/**/*.js');
6061
});
6162

62-
gulp.task('test:release', [ 'test:coverage' ], function() {
63+
gulp.task('test:release', [ 'lint', 'test:coverage' ], function() {
6364
return test('./test/**/*.js', { continue: true });
6465
});
6566

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,12 @@
1414
"url": "[email protected]:projectftbl/gulp.git"
1515
},
1616
"dependencies": {
17+
"babel-eslint": "^4.1.6",
18+
"eslint-plugin-react": "^3.14.0",
1719
"gulp": "^3.9.0",
1820
"gulp-bump": "^1.0.0",
1921
"gulp-env": "^0.2.0",
22+
"gulp-eslint": "^1.1.1",
2023
"gulp-git": "^1.2.4",
2124
"gulp-istanbul": "^0.10.3",
2225
"gulp-mocha": "^2.1.3",

0 commit comments

Comments
 (0)