From 6838bfa93e4691a6b7c50cc3bb3fb4901a2df75f Mon Sep 17 00:00:00 2001 From: Kamil Piechaczek Date: Thu, 6 Dec 2018 11:26:32 +0100 Subject: [PATCH 1/4] Introduced a linter and Travis. --- .travis.yml | 31 +++++++++++++++++++++++++++++++ package.json | 16 +++++++++++++++- 2 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 00000000..953bba36 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,31 @@ +sudo: required +dist: trusty +addons: + firefox: latest + apt: + sources: + - google-chrome + packages: + - google-chrome-stable +language: node_js +node_js: +- '8' +cache: +- node_modules +branches: + except: + - stable +before_install: +- export DISPLAY=:99.0 +- sh -e /etc/init.d/xvfb start +- npm config set package-lock false +- npm i -g npm@^5.7.1 +install: +- npm install @ckeditor/ckeditor5-dev-tests +- ckeditor5-dev-tests-install-dependencies +script: +- ckeditor5-dev-tests-travis +env: + global: + - secure: xvTgYaJun8fZq6Oie+/+fc3NXRcQCsVsGBFAHaH7B6VtDjKQn8N02KOtj5QBpTa4VQLU65BnHkFLtZQYgLW5T5wmlcIwoSCU+CkmJhkiQJctEvxe/IkFHzMdBK/gcHrxTfo6Fxkcj7So0ySgXuNTOZDBxHY/ewNaWUD8khIoXTDeZ6BQZvKSTRpPis4b16NEaLgwcQ65ZCwI7fhgjwHj4nvuBY8zvAKtWVaMw4O47P+Xs2KlB89QMMWxRZtDZnavRXE5YT97HAWWA/XjYh2X9i+oBT9xssHiT7y5FPBa4RMWA4JfBhMFb8n0z0Rmhs4LhhDuWB+cfSMZlNyNKdJDr29LEGWzgcJKXiJjQrPRSWkqt6b9qF8dH3/IT6pt8YYv4vqjLdNdGbkOHfSJho4xuxx+j9Vu6UNRO/OR9aOtivoRX/yGrXhlXjdTx32yC3cCxUTdGqnyxLDSBGpRxQVUip/5W4gpCEiAl6J8lYk1hbGBWuyt99iFct0KB7YCsdXQ2apWfWYbfILBDWFyyCmP6u5SKt3jRkPJJpI+5wu1mrn65XtUSc4bpzeYhE3bQdeWdQHXvvmaLky5Bgr6Olduh62poTP2B3CzEo+my2Bs9r0jHdn02fgFNqLGvCBrf+h7D0Mj0KgRw6erR88YVj5w4DYtpDTYyRd0ZXP4aesum9I= + - secure: L9nm/YgvQ7e9LRBr2vvNBFJcLBPn0jcs6S+EqlIDVwrKYli7xD4lD9n4xtkyahKHnSdxG9zwwAmGj3o5efbF+khPx84byNiBO+TcpxPy6lWE0KH5GJrtKF+Xyvo3Iwlb417d1qka0yWqbM8yD8y1njADa9v22YnsKeMOLvrqKKO4VwNWI9YcaVRWJeJa6WvVzmskFwkwYZ7T36CtYCR5xFYYTiWtpd/DoDa14U1Xc3W0r66WI3Ck50RxY0CvTe4gw4YGT7RKiGMgBAiyLOPZePb2ttK1mF545Ko9v8rsFX5fJUfChfp8loMrM40JPyGfjWPhA5z5se8tuvD2L+WikBb3oxPVcnFqLfbYDh4DOoTHpX1TJu5xMR5M4tv9kdNO19lZmPOZL9V9CSPKx5riSSUGqTg6XuWR6JmXjUp9GBmpm0RVYLSAvvbOdumN9WEXvFrt5cB9y8WQCKtOu5EUVkYCfoIkYWLNBboOIlI2GHpvF8/XECMDTjRPm6TMTJpPxl3WaB1BvbU4IHEWIb+G2Oy7LDXW5j40BwOsMqNh0LRG1QuadtHnWqn2464RFOzTwZPN3VUUqybWL6X4+L4wML0htcuy8UuGEPeuD27/hMfkDZwDgCffwvGLtvuGFPAJ5iC/WSrVSvSmZ6HqO6nZ9EH3V648PgWWyfvh2sHQ+t0= diff --git a/package.json b/package.json index 9c95643e..129030fa 100644 --- a/package.json +++ b/package.json @@ -45,6 +45,10 @@ "@ckeditor/ckeditor5-table": "^11.0.1", "@ckeditor/ckeditor5-theme-lark": "^12.0.0", "@ckeditor/ckeditor5-upload": "^10.0.4", + "eslint": "^5.5.0", + "eslint-config-ckeditor5": "^1.0.7", + "husky": "^0.14.3", + "lint-staged": "^7.0.0", "postcss-loader": "^3.0.0", "raw-loader": "^0.5.1", "style-loader": "^0.23.0", @@ -66,6 +70,16 @@ }, "scripts": { "build": "webpack --mode production", + "lint": "eslint --quiet '**/*.js'", + "precommit": "lint-staged", "preversion": "npm run build; if [ -n \"$(git status src/ckeditor.js build/ --porcelain)\" ]; then git add -u src/ckeditor.js build/ && git commit -m 'Internal: Build.'; fi" - } + }, + "lint-staged": { + "**/*.js": [ + "eslint --quiet" + ] + }, + "eslintIgnore": [ + "build/**" + ] } From 58e0e18b37d9f2c3357b3226d4188e4e2b921a89 Mon Sep 17 00:00:00 2001 From: Kamil Piechaczek Date: Wed, 12 Dec 2018 09:12:12 +0100 Subject: [PATCH 2/4] Added a configuration for ESLint. --- .eslintrc.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 .eslintrc.js diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100644 index 00000000..88dfc81c --- /dev/null +++ b/.eslintrc.js @@ -0,0 +1,12 @@ +/** + * @license Copyright (c) 2003-2018, CKSource - Frederico Knabben. All rights reserved. + * For licensing, see LICENSE.md. + */ + +/* eslint-env node */ + +'use strict'; + +module.exports = { + extends: 'ckeditor5' +}; From 9c81cdd979eadca1e93f64b92d0264643a4f886d Mon Sep 17 00:00:00 2001 From: Kamil Piechaczek Date: Wed, 12 Dec 2018 09:21:50 +0100 Subject: [PATCH 3/4] Directory created by Mgit on CI must be ignored as well. --- package.json | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 129030fa..876c5cff 100644 --- a/package.json +++ b/package.json @@ -70,8 +70,8 @@ }, "scripts": { "build": "webpack --mode production", - "lint": "eslint --quiet '**/*.js'", - "precommit": "lint-staged", + "lint": "eslint --quiet '**/*.js'", + "precommit": "lint-staged", "preversion": "npm run build; if [ -n \"$(git status src/ckeditor.js build/ --porcelain)\" ]; then git add -u src/ckeditor.js build/ && git commit -m 'Internal: Build.'; fi" }, "lint-staged": { @@ -80,6 +80,7 @@ ] }, "eslintIgnore": [ - "build/**" + "build/**", + "packages/**" ] } From b90087d8f8a3f4c82590a6a0bc859c82b22a1184 Mon Sep 17 00:00:00 2001 From: Kamil Piechaczek Date: Wed, 12 Dec 2018 09:34:07 +0100 Subject: [PATCH 4/4] Code style in tests. --- tests/manual/ckeditor-cjs-version.js | 3 +++ tests/manual/ckeditor.js | 2 ++ 2 files changed, 5 insertions(+) diff --git a/tests/manual/ckeditor-cjs-version.js b/tests/manual/ckeditor-cjs-version.js index 60221c75..f3bdbe6a 100644 --- a/tests/manual/ckeditor-cjs-version.js +++ b/tests/manual/ckeditor-cjs-version.js @@ -3,6 +3,9 @@ * For licensing, see LICENSE.md. */ +/* eslint-env commonjs */ +/* globals window, document, console */ + const BalloonEditor = require( '../../build/ckeditor' ); BalloonEditor.create( document.querySelector( '#editor' ) ) diff --git a/tests/manual/ckeditor.js b/tests/manual/ckeditor.js index a0500155..c47e2755 100644 --- a/tests/manual/ckeditor.js +++ b/tests/manual/ckeditor.js @@ -3,6 +3,8 @@ * For licensing, see LICENSE.md. */ +/* globals window, document, console */ + import BalloonEditor from '../../build/ckeditor'; BalloonEditor.create( document.querySelector( '#editor' ) )