From c20b2dad4b538298e0b20a5de2052ebfb7b83289 Mon Sep 17 00:00:00 2001 From: Kamil Piechaczek Date: Thu, 6 Dec 2018 11:26:35 +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 0000000000..ba81c7680c --- /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: MFozIsgJTNfpsN7jBEbCoaKtd76zLVlYvFTHViRmAqfOeu/IQgybq7T/fVK1Oufz6IKlXC8QaDldJsWyPRKOQ2MSOElZgxXcAmkWPXmmsdit7xyrwXDwefILP+Ucc7KnwzP2JCAswMTAoYU3SnLbhP45WfhvoIWVCuyMHswFwK69HmyONYEC0jOAjYdp/5vpjaU6qjtrZYpIqgVxNfovCHcrMGCC2vLIW4M+pg3vXbYpBVCr4pFkfRFQ+H+PxhbH6dq7whd5mTDSmsDa5psPUOhxgcwKZ9Xt0t303vR15C0aPCp5vebXSKuyxG1ZhY04ogB2BXcqu6F35zbLWcmprLOXXVsUvFXCeCY89FruGfAD/XsXGQGWtAauCAtYOE2qaJXsIsWBJpjsK28jxySCOPjAnVHwoUoDAm5nSip8+e+goMT/16QB6cpVMdZFltGmIsyMDY7G4Nvri91wAgR12U0sHlVPK3vU8+CIFqhRZI40VnXYkuZSUWfBMZEhtmZQhh58sD9M1JuAmEuAEOq6XiOY+jK9Q+1VMT+z3tlUkK21o+fpBFnO/O6bs5gcgJkCuxf8HezEDIjBdG45+tS9qjmmRvy+jr2DKPMT7zIHNYWUUy3tiXbb2A2yCMvuzjhiNFGCc6YBHkjVroel76t8H/ooDY+vzTc8cPXqGs4DDXY= + - secure: R6kG7o15OS3BSqMxt2VniiDa687XKzteP481OJxa/vZJRyCuRSRqUSQUN0rZw2rBRrcGvn3C6BBYahE4+8Gi6eyjSn7eUWuU8NY27wfCzIQ32BBk4zZKha4ah8rfYv5q3vgmUz5I9/B/G1xkcWixu1Qh6gK/e/JXWCjx+VYc5IkD9fTtoQ9QmhQtCycz/7AF8A3Fx7vLpYBkn9EfKSO0TRlPa3co8ZC3u33R7dnWtH6aXDlS5K0OePaUn0jw4/m5Eo9ogbNTZRsWDE9QVTwC2lkBASuzO28ukipn03/hopEpNeE4CX7h7nuJ36YcNBQPcNex9KKJ9CaHcda8QhMP8gnyUt3bdaADjzuXiSq1yAzd2IfFsqAqNwadHG2lBX8CZRdQ4AtGR71dPaaPJVdCDbjX94iyBjYpBAJ6jfMAC31XXUaHYrfjyvL9WjWHYVCTtofvWgILfgZPZJ1KHSpKRS00sK5TOChnxGd6CzCX2cbcMSigNu+Y3igrKnCFIlDPc4cGcYspIUhLPqT7HmMU/6CpD3DNYjkXN3wctBf+UkA6Nf2kX23xWPLUjvWrYkuABf9h2V3fjEQQcWrM1DzsKnUknLvkIcy4gIYT6pfVjPAGm5QEdRZJ/PrFZUuIhwqoHaviIxfYuOnWinusA1DXPUirbBAHef5zlyo/VzfNcSM= diff --git a/package.json b/package.json index 59a1e1774d..463927028f 100644 --- a/package.json +++ b/package.json @@ -48,6 +48,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", @@ -69,6 +73,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 f49f74ffba4318c2d0950711842be545786c76a2 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 0000000000..88dfc81cb1 --- /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 4c50ec1a11e0074cedf086b30d89d455cb53c242 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 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 463927028f..0e41605ffb 100644 --- a/package.json +++ b/package.json @@ -83,6 +83,7 @@ ] }, "eslintIgnore": [ - "build/**" + "build/**", + "packages/**" ] } From f8bccd1eb7d95fb75936e487d500107beaaed91e 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 8ac5632e74..f807d6b6c0 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 DecoupledEditor = require( '../../build/ckeditor' ); DecoupledEditor.create( document.querySelector( '#editor' ) ) diff --git a/tests/manual/ckeditor.js b/tests/manual/ckeditor.js index be84bec695..7d2a7c4fdf 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 DecoupledEditor from '../../build/ckeditor'; DecoupledEditor.create( document.querySelector( '#editor' ) )