8
0
Pārlūkot izejas kodu

Switched to using ckeditor5-dev-lint. See https://github.com/ckeditor/ckeditor5/issues/268.

Piotrek Koszuliński 9 gadi atpakaļ
vecāks
revīzija
2c5faf9067

+ 0 - 1
packages/ckeditor5-editor-classic/.jscsrc

@@ -1,5 +1,4 @@
 {
-  "esnext": true,
   "requireCurlyBraces": [
     "if",
     "else",

+ 0 - 12
packages/ckeditor5-editor-classic/dev/.jshintrc

@@ -1,12 +0,0 @@
-{
-  "node": true,
-  "esnext": true,
-  "immed": true,
-  "loopfunc": true,
-  "noarg": true,
-  "nonbsp": true,
-  "undef": true,
-  "unused": true,
-  "strict": true,
-  "varstmt": true
-}

+ 0 - 92
packages/ckeditor5-editor-classic/dev/tasks/lint/tasks.js

@@ -1,92 +0,0 @@
-/* jshint node: true, esnext: true */
-
-'use strict';
-
-const gulp = require( 'gulp' );
-const jshint = require( 'gulp-jshint' );
-const jscs = require( 'gulp-jscs' );
-const fs = require( 'fs' );
-const guppy = require( 'git-guppy' )( gulp );
-const gulpFilter = require( 'gulp-filter' );
-const gutil = require( 'gulp-util' );
-
-module.exports = ( config ) => {
-	const src = [ '**/*.js' ].concat( config.IGNORED_FILES.map( i => '!' + i ), getGitIgnore() );
-
-	const tasks = {
-		/**
-		 * Returns stream containing jshint and jscs reporters.
-		 *
-		 * @returns {Stream}
-		 */
-		lint() {
-			return gulp.src( src )
-				.pipe( lint() );
-		},
-
-		/**
-		 * This method is executed on pre-commit hook, linting only files staged for current commit.
-		 *
-		 * @returns {Stream}
-		 */
-		lintStaged() {
-			return guppy.stream( 'pre-commit', { base: './' } )
-				.pipe( gulpFilter( src ) )
-				.pipe( lint() )
-
-				// Error reporting for gulp.
-				.pipe( jscs.reporter( 'fail' ) )
-				.on( 'error', errorHandler )
-				.pipe( jshint.reporter( 'fail' ) )
-				.on( 'error', errorHandler );
-
-			/**
-			 * Handles error from jscs and jshint fail reporters. Stops node process with error code
-			 * and prints error message to the console.
-			 */
-			function errorHandler() {
-				gutil.log( gutil.colors.red( 'Linting failed, commit aborted' ) );
-				process.exit( 1 );
-			}
-		}
-	};
-
-	gulp.task( 'lint', tasks.lint );
-	gulp.task( 'lint-staged', tasks.lintStaged );
-
-	return tasks;
-
-	/**
-	 * Gets the list of ignores from `.gitignore`.
-	 *
-	 * @returns {String[]} The list of ignores.
-	 */
-	function getGitIgnore( ) {
-		let gitIgnoredFiles = fs.readFileSync( '.gitignore', 'utf8' );
-
-		return gitIgnoredFiles
-			// Remove comment lines.
-			.replace( /^#.*$/gm, '' )
-			// Transform into array.
-			.split( /\n+/ )
-			// Remove empty entries.
-			.filter( ( path ) => !!path )
-			// Add `!` for ignore glob.
-			.map( i => '!' + i );
-	}
-
-	/**
-	 * Returns stream with all linting plugins combined.
-	 *
-	 * @returns {Stream}
-	 */
-	function lint() {
-		const stream = jshint();
-		stream
-			.pipe( jscs() )
-			.pipe( jscs.reporter() )
-			.pipe( jshint.reporter( 'jshint-reporter-jscs' ) );
-
-		return stream;
-	}
-};

+ 8 - 1
packages/ckeditor5-editor-classic/gulpfile.js

@@ -1,3 +1,8 @@
+/**
+ * @license Copyright (c) 2003-2016, CKSource - Frederico Knabben. All rights reserved.
+ * For licensing, see LICENSE.md.
+ */
+
 /* jshint browser: false, node: true, strict: true */
 
 'use strict';
@@ -14,6 +19,8 @@ const config = {
 	]
 };
 
-require( './dev/tasks/lint/tasks' )( config );
+const ckeditor5Lint = require( 'ckeditor5-dev-lint' )( config );
 
+gulp.task( 'lint', ckeditor5Lint.lint );
+gulp.task( 'lint-staged', ckeditor5Lint.lintStaged );
 gulp.task( 'pre-commit', [ 'lint-staged' ] );

+ 2 - 8
packages/ckeditor5-editor-classic/package.json

@@ -5,15 +5,9 @@
   "keywords": [],
   "dependencies": {},
   "devDependencies": {
-    "git-guppy": "^1.1.0",
+    "ckeditor5-dev-lint": "github:ckeditor/ckeditor5-dev-lint",
     "gulp": "^3.9.0",
-    "gulp-filter": "^3.0.1",
-    "gulp-jscs": "^3.0.2",
-    "gulp-jshint": "^2.0.0",
-    "gulp-util": "^3.0.7",
-    "guppy-pre-commit": "^0.3.0",
-    "jshint": "^2.9.1",
-    "jshint-reporter-jscs": "^0.1.0"
+    "guppy-pre-commit": "^0.3.0"
   },
   "engines": {
     "node": ">=5.0.0",