Przeglądaj źródła

The jscs and jshint will now append .gitignore entries to the configuration instead of replacing it.

fredck 11 lat temu
rodzic
commit
fdba8376ad

+ 1 - 9
packages/ckeditor5-ui/dev/tasks/jscs.js

@@ -8,6 +8,7 @@ module.exports = function( grunt ) {
 	tools.setupMultitaskConfig( grunt, {
 		task: 'jscs',
 		defaultOptions: grunt.file.readJSON( 'dev/tasks/jscs-config.json' ),
+		addGitIgnore: 'excludeFiles',
 		targets: {
 			all: function() {
 				return [ '**/*.js' ];
@@ -20,14 +21,5 @@ module.exports = function( grunt ) {
 		}
 	} );
 
-	// Take ignore list from .gitIgnore.
-	grunt.config.merge( {
-		jscs: {
-			options: {
-				excludeFiles: tools.getGitIgnore( grunt )
-			}
-		}
-	} );
-
 	grunt.loadNpmTasks( 'grunt-jscs' );
 };

+ 1 - 9
packages/ckeditor5-ui/dev/tasks/jshint.js

@@ -8,6 +8,7 @@ module.exports = function( grunt ) {
 	tools.setupMultitaskConfig( grunt, {
 		task: 'jshint',
 		defaultOptions: grunt.file.readJSON( 'dev/tasks/jshint-config.json' ),
+		addGitIgnore: 'ignores',
 		targets: {
 			all: function() {
 				return [ '**/*.js' ];
@@ -20,14 +21,5 @@ module.exports = function( grunt ) {
 		}
 	} );
 
-	// Take ignore list from .gitIgnore.
-	grunt.config.merge( {
-		jshint: {
-			options: {
-				ignores: tools.getGitIgnore( grunt )
-			}
-		}
-	} );
-
 	grunt.loadNpmTasks( 'grunt-contrib-jshint' );
 };

+ 8 - 0
packages/ckeditor5-ui/dev/tasks/res/tools.js

@@ -53,6 +53,14 @@ module.exports = {
 			config.all = all();
 		}
 
+		// Append .gitignore entries to the ignore list.
+		if ( options.addGitIgnore ) {
+			var ignoreProp = task + '.options.' + options.addGitIgnore,
+				ignores = grunt.config.get( ignoreProp ) || [];
+			ignores = ignores.concat( this.getGitIgnore( grunt ) );
+			grunt.config.set( ignoreProp, ignores );
+		}
+
 		// Merge over configurations set in gruntfile.js.
 		grunt.config.merge( taskConfig );
 	},

+ 6 - 0
packages/ckeditor5-ui/gruntfile.js

@@ -12,11 +12,17 @@ module.exports = function( grunt ) {
 
 		jshint: {
 			options: {
+				ignores: [
+					// Automatically loaded from .gitignore. Add more if necessary.
+				]
 			}
 		},
 
 		jscs: {
 			options: {
+				excludeFiles: [
+					// Automatically loaded from .gitignore. Add more if necessary.
+				]
 			}
 		}
 	} );