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' +}; 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 bb55445e7b..5054e86086 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": "^1.0.0", "style-loader": "^0.23.0", @@ -69,6 +73,17 @@ }, "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/**", + "packages/**" + ] } 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' ) )