diff --git a/.eslintrc.json b/.eslintrc.json new file mode 100644 index 0000000..1fbf858 --- /dev/null +++ b/.eslintrc.json @@ -0,0 +1,12 @@ +{ + "env": { + "browser": true, + "es6": true + }, + "extends": "eslint:recommended", + "parserOptions": { + "sourceType": "module" + }, + "rules": { + } +} diff --git a/.travis.yml b/.travis.yml index 58cb42e..6fad41d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,7 +2,10 @@ language: java # This is npm project but selecting java for selenium testing jdk: oraclejdk8 env: NODE_VERSION=6.10.0 before_install: nvm install $NODE_VERSION -install: npm install +install: + - npm install + - npm run lint + - npm run build before_script: - export DISPLAY=:99.0 - sh -e /etc/init.d/xvfb start diff --git a/dist/customrangeinput.js b/dist/customrangeinput.js index 8be0cd0..c283d28 100644 --- a/dist/customrangeinput.js +++ b/dist/customrangeinput.js @@ -116,6 +116,8 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function" * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +/* global require, ShadyCSS, VERSION */ + function defineCustomRangeInput() { /** * Actually CustomRangeInput extends HTMLInputElement ( element) but @@ -280,6 +282,7 @@ function defineCustomRangeInput() { return CustomRangeInput; }(HTMLElement); + CustomRangeInput.version = "0.1.0" || "development"; customElements.define("custom-range-input", CustomRangeInput); window.CustomRangeInput = CustomRangeInput; } diff --git a/package.json b/package.json index 457e929..41402de 100644 --- a/package.json +++ b/package.json @@ -24,6 +24,7 @@ "clean": "rm -r ./dist || exit 0", "test": "wct --plugin local", "build": "webpack", + "lint": "eslint src/js/", "watch": "webpack --watch", "serve": "serve ./" }, @@ -32,12 +33,13 @@ "babel-loader": "^6.4.0", "babel-preset-es2015": "^6.22.0", "css-loader": "^0.26.2", + "eslint": "^3.17.1", "node-sass": "^4.5.0", "sass-loader": "^6.0.3", + "selenium-standalone": "3.0.1", "serve": "^5.0.2", "web-component-tester": "^5.0.0", - "webpack": "^2.2.1", - "selenium-standalone": "3.0.1" + "webpack": "^2.2.1" }, "bugs": { "url": "https://github.com/misttechnologies/custom-range-input/issues" diff --git a/src/js/customrangeinput.js b/src/js/customrangeinput.js index 2d2fcf4..c10a86a 100644 --- a/src/js/customrangeinput.js +++ b/src/js/customrangeinput.js @@ -27,6 +27,8 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +/* global require, ShadyCSS, VERSION */ + export default function defineCustomRangeInput() { /** * Actually CustomRangeInput extends HTMLInputElement ( element) but @@ -155,6 +157,7 @@ export default function defineCustomRangeInput() { this.min), this.max); } } + CustomRangeInput.version = VERSION || "development"; customElements.define("custom-range-input", CustomRangeInput); window.CustomRangeInput = CustomRangeInput; } diff --git a/webpack.config.js b/webpack.config.js index e6771fe..f997e42 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -1,3 +1,5 @@ +const webpack = require("webpack"); + module.exports = { entry: "./index.js", output: { @@ -25,5 +27,10 @@ module.exports = { loader: 'html-loader' } ] - } + }, + plugins: [ + new webpack.DefinePlugin({ + VERSION: JSON.stringify(require("./package.json").version) + }) + ] };