8
0
Просмотр исходного кода

Moved pre-commit Git hook directly to gulpfile.

Szymon Kupś 10 лет назад
Родитель
Сommit
a1d5d39f57
3 измененных файлов с 5 добавлено и 4 удалено
  1. 2 2
      dev/tasks/lint/tasks.js
  2. 2 2
      dev/tests/lint.js
  3. 1 0
      gulpfile.js

+ 2 - 2
dev/tasks/lint/tasks.js

@@ -29,7 +29,7 @@ module.exports = ( config ) => {
 		 *
 		 * @returns { Stream }
 		 */
-		preCommit() {
+		lintStaged() {
 			return guppy.stream( 'pre-commit' )
 				.pipe( gulpFilter( src ) )
 				.pipe( lint() )
@@ -52,7 +52,7 @@ module.exports = ( config ) => {
 	};
 
 	gulp.task( 'lint', tasks.lint );
-	gulp.task( 'pre-commit', tasks.preCommit );
+	gulp.task( 'lint-staged', tasks.lintStaged );
 
 	return tasks;
 

+ 2 - 2
dev/tests/lint.js

@@ -100,7 +100,7 @@ describe( 'lint', () => {
 		} );
 	} );
 
-	describe( 'pre-commit', () => {
+	describe( 'lintStaged', () => {
 		it( 'should throw error when linting fails', ( done ) => {
 			const tasks = require( '../tasks/lint/tasks' )( config );
 			const PassThrough = stream.PassThrough;
@@ -124,7 +124,7 @@ describe( 'lint', () => {
 				}
 			} );
 			sandbox.stub( jshint, 'reporter', () => new PassThrough( { objectMode: true } ) );
-			tasks.preCommit();
+			tasks.lintStaged();
 		} );
 	} );
 } );

+ 1 - 0
gulpfile.js

@@ -18,3 +18,4 @@ require( './dev/tasks/dev/tasks' )( config );
 require( './dev/tasks/lint/tasks' )( config );
 
 gulp.task( 'default', [ 'build' ] );
+gulp.task( 'pre-commit', [ 'lint-staged' ] );