From f768d1e805f98534121ad39a8a5a48a2c7d63eda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotrek=20Koszuli=C5=84ski?= Date: Tue, 16 May 2017 22:13:07 +0200 Subject: [PATCH] Code style: Switched to ESLint. --- .eslintrc.js | 12 +++++++ .jscsrc | 92 ------------------------------------------------- .jshintrc | 12 ------- gulpfile.js | 11 +++--- package.json | 3 +- tests/.jshintrc | 23 ------------- 6 files changed, 20 insertions(+), 133 deletions(-) create mode 100644 .eslintrc.js delete mode 100644 .jscsrc delete mode 100644 .jshintrc delete mode 100644 tests/.jshintrc diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100644 index 0000000..b5a22b0 --- /dev/null +++ b/.eslintrc.js @@ -0,0 +1,12 @@ +/** + * @license Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved. + * For licensing, see LICENSE.md. + */ + +/* eslint-env node */ + +'use strict'; + +module.exports = { + extends: 'ckeditor5' +}; diff --git a/.jscsrc b/.jscsrc deleted file mode 100644 index acf56d5..0000000 --- a/.jscsrc +++ /dev/null @@ -1,92 +0,0 @@ -{ - "requireCurlyBraces": [ - "if", - "else", - "for", - "while", - "do", - "switch", - "try", - "catch" - ], - "requireSpaceBeforeKeywords": true, - "requireSpaceAfterKeywords": [ - "do", - "for", - "if", - "else", - "switch", - "case", - "try", - "catch", - "void", - "while", - "with", - "return", - "typeof" - ], - "requireSpaceBeforeBlockStatements": true, - "requireParenthesesAroundIIFE": true, - "requireSpacesInConditionalExpression": { - "afterTest": true, - "beforeConsequent": true, - "afterConsequent": true, - "beforeAlternate": true - }, - "requireSpacesInFunction": { - "beforeOpeningCurlyBrace": true - }, - "disallowSpacesInFunction": { - "beforeOpeningRoundBrace": true - }, - "disallowSpacesInCallExpression": true, - "disallowMultipleVarDecl": "exceptUndefined", - "requireBlocksOnNewline": true, - "disallowPaddingNewlinesInBlocks": true, - "requirePaddingNewlinesBeforeKeywords": [ - "do", - "for", - "if", - "switch", - "case", - "try", - "while", - "with", - "return" - ], - "requireSpacesInsideObjectBrackets": "all", - "requireSpacesInsideArrayBrackets": "all", - "requireSpacesInsideParentheses": "all", - "disallowSpaceAfterObjectKeys": true, - "requireSpaceBeforeObjectValues": true, - "requireCommaBeforeLineBreak": true, - "requireOperatorBeforeLineBreak": true, - "disallowSpaceAfterPrefixUnaryOperators": true, - "disallowSpaceBeforePostfixUnaryOperators": true, - "requireSpaceBeforeBinaryOperators": true, - "disallowImplicitTypeConversion": [ - "numeric", - "binary", - "string" - ], - "requireCamelCaseOrUpperCaseIdentifiers": true, - "requireSpaceAfterBinaryOperators": true, - "disallowKeywords": [ - "with" - ], - "disallowMultipleLineStrings": true, - "disallowMultipleLineBreaks": true, - "disallowMixedSpacesAndTabs": true, - "disallowTrailingWhitespace": true, - "maximumLineLength": 140, - "requireCapitalizedConstructors": true, - "requireDotNotation": true, - "disallowYodaConditions": true, - "disallowNewlineBeforeBlockStatements": true, - "validateLineBreaks": "LF", - "validateQuoteMarks": "'", - "validateIndentation": "\t", - "safeContextKeyword": [ - "that" - ] -} diff --git a/.jshintrc b/.jshintrc deleted file mode 100644 index 5186dbb..0000000 --- a/.jshintrc +++ /dev/null @@ -1,12 +0,0 @@ -{ - "browser": true, - "esnext": true, - "immed": true, - "loopfunc": true, - "noarg": true, - "nonbsp": true, - "undef": true, - "unused": true, - "strict": "implied", - "varstmt": true -} diff --git a/gulpfile.js b/gulpfile.js index cd312ba..40c0e59 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -3,19 +3,20 @@ * For licensing, see LICENSE.md. */ -/* jshint browser: false, node: true, strict: true */ +/* eslint-env node */ 'use strict'; const gulp = require( 'gulp' ); -const ckeditor5Lint = require( '@ckeditor/ckeditor5-dev-lint' )( { +const ckeditor5Lint = require( '@ckeditor/ckeditor5-dev-lint' ); +const options = { // Files ignored by `gulp lint` task. // Files from .gitignore will be added automatically during task execution. ignoredFiles: [ 'src/lib/**' ] -} ); +}; -gulp.task( 'lint', ckeditor5Lint.lint ); -gulp.task( 'lint-staged', ckeditor5Lint.lintStaged ); +gulp.task( 'lint', () => ckeditor5Lint.lint( options ) ); +gulp.task( 'lint-staged', () => ckeditor5Lint.lintStaged( options ) ); gulp.task( 'pre-commit', [ 'lint-staged' ] ); diff --git a/package.json b/package.json index 99dd00f..b3fc114 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ "@ckeditor/ckeditor5-ui": "^0.9.0" }, "devDependencies": { - "@ckeditor/ckeditor5-dev-lint": "^2.0.2", + "@ckeditor/ckeditor5-dev-lint": "^3.0.0", "@ckeditor/ckeditor5-editor-classic": "^0.7.3", "@ckeditor/ckeditor5-enter": "^0.9.1", "@ckeditor/ckeditor5-heading": "^0.9.1", @@ -18,6 +18,7 @@ "@ckeditor/ckeditor5-typing": "^0.9.1", "@ckeditor/ckeditor5-undo": "^0.8.1", "@ckeditor/ckeditor5-utils": "^0.9.1", + "eslint-config-ckeditor5": "^1.0.0", "gulp": "^3.9.0", "guppy-pre-commit": "^0.4.0" }, diff --git a/tests/.jshintrc b/tests/.jshintrc deleted file mode 100644 index 403682a..0000000 --- a/tests/.jshintrc +++ /dev/null @@ -1,23 +0,0 @@ -{ - "browser": true, - "esnext": true, - "expr": true, - "immed": true, - "loopfunc": true, - "noarg": true, - "nonbsp": true, - "strict": "implied", - "undef": true, - "unused": true, - "varstmt": true, - "globals": { - "after": false, - "afterEach": false, - "before": false, - "beforeEach": false, - "describe": false, - "expect": false, - "it": false, - "sinon": false - } -}