A free, self-hostable news aggregator…
[CI] Lint JS scripts with jshint (#2315)
Frans de Jongec2a339f2f8a5
diff --git a/.jshintignore b/.jshintignorenew file mode 100644index 000000000..80bbc5b89--- /dev/null+++ b/.jshintignore@@ -0,0 +1,4 @@+node_modules+p/scripts/bcrypt.min.js+p/scripts/flotr2.min.js+p/scripts/jquery.min.jsdiff --git a/.jshintrc b/.jshintrcnew file mode 100644index 000000000..07d282b1c--- /dev/null+++ b/.jshintrc@@ -0,0 +1,8 @@+{+ "esversion" : 6,+ "browser" : true,+ "globals": {+ "confirm": true,+ "console": true+ }+}diff --git a/.travis.yml b/.travis.ymlindex 44bc59e3f..1ec2aeb65 100644--- a/.travis.yml+++ b/.travis.yml@@ -34,6 +34,15 @@ matrix:dist: precise- php: "7.2"env: CHECK_TRANSLATION=yes VALIDATE_STANDARD=no+ - language: node_js+ node_js:+ - "node"+ php:+ # none+ install:+ - npm install jshint+ script:+ - node_modules/jshint/bin/jshint .allow_failures:- env: CHECK_TRANSLATION=yes VALIDATE_STANDARD=no- dist: precisediff --git a/p/scripts/install.js b/p/scripts/install.jsindex b7975fd6e..967d27627 100644--- a/p/scripts/install.js+++ b/p/scripts/install.js@@ -1,15 +1,15 @@"use strict";/* jshint globalstrict: true */-function show_password() {- var button = this;+function show_password(ev) {+ var button = ev.target;var passwordField = document.getElementById(button.getAttribute('data-toggle'));passwordField.setAttribute('type', 'text');button.className += ' active';return false;}-function hide_password() {- var button = this;+function hide_password(ev) {+ var button = ev.target;var passwordField = document.getElementById(button.getAttribute('data-toggle'));passwordField.setAttribute('type', 'password');button.className = button.className.replace(/(?:^|\s)active(?!\S)/g , '');@@ -61,10 +61,10 @@ if (bd_type) {bd_type.addEventListener('change', mySqlShowHide);}-function ask_confirmation(e) {- var str_confirmation = this.getAttribute('data-str-confirm');+function ask_confirmation(ev) {+ var str_confirmation = ev.target.getAttribute('data-str-confirm');if (!confirm(str_confirmation)) {- e.preventDefault();+ ev.preventDefault();}}var confirms = document.getElementsByClassName('confirm');