Browse Source

Fix some eslint errors and warnings

vsn4ik 10 years ago
parent
commit
b6107598df

+ 3 - 1
.eslintrc

@@ -6,7 +6,9 @@
     "eqeqeq": [2, "smart"],
     "indent": [
       1,
-      "tab"
+      "tab", {
+        "SwitchCase": 1
+      }
     ],
     "quotes": [
       1,

+ 1 - 1
Gruntfile.js

@@ -135,7 +135,7 @@ module.exports = function(grunt) {
 			}
 		},
 		eslint: {
-			target: grunt.file.expand("js/*.js")
+			target: "{extra/*,js}/*.js"
 		},
 		availabletasks: {
 			tasks: {

+ 1 - 1
extra/dependencyLibs/inputmask.dependencyLib.jqlite.js

@@ -214,7 +214,7 @@ Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.p
 				cancelable: false,
 				detail: undefined
 			};
-			var evt = document.createEvent('CustomEvent');
+			var evt = document.createEvent("CustomEvent");
 			evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail);
 			return evt;
 		}

+ 2 - 12
extra/dependencyLibs/inputmask.dependencyLib.js

@@ -70,16 +70,6 @@ Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.p
 				typeof length === "number" && length > 0 && (length - 1) in obj;
 		}
 
-		//micro event lib
-		var domEvents = function() {
-			var domEvents = [];
-			for (var i in document) {
-				if (i.substring(0, 2) === "on" && (document[i] === null || typeof document[i] === 'function'))
-					domEvents.push(i.substring(2));
-			}
-			return domEvents;
-		}();
-
 		function isValidElement(elem) {
 			return elem instanceof Element;
 		}
@@ -231,7 +221,7 @@ Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.p
 								try {
 									evnt = new CustomEvent(ev, params);
 								} catch (e) {
-									evnt = document.createEvent('CustomEvent');
+									evnt = document.createEvent("CustomEvent");
 									evnt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail);
 								}
 								if (events.type) DependencyLib.extend(evnt, events);
@@ -425,7 +415,7 @@ Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.p
 				cancelable: false,
 				detail: undefined
 			};
-			var evt = document.createEvent('CustomEvent');
+			var evt = document.createEvent("CustomEvent");
 			evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail);
 			return evt;
 		}

+ 3 - 8
js/inputmask.js

@@ -2382,11 +2382,12 @@
 			function inputFallBackEvent(e) { //fallback when keypress & compositionevents fail
 				var input = this,
 					inputValue = input.inputmask._valueGet();
-				if (getBuffer().join('') !== inputValue) {
+				if (getBuffer().join("") !== inputValue) {
 					inputValue = inputValue.split("");
 					for (var i = inputValue.length; i > 0; i--) {
-						if (inputValue[i] === getPlaceholder(i))
+						if (inputValue[i] === getPlaceholder(i)) {
 							delete inputValue[i];
+						}
 					}
 
 					checkVal(input, true, false, inputValue);
@@ -2638,12 +2639,6 @@
 				}
 			}
 
-			function resetEvent(e) {
-				setTimeout(function() {
-					$el.trigger("setvalue");
-				}, 0);
-			}
-
 			function mask(elem) {
 				el = elem;
 				$el = $(el);

+ 10 - 8
js/inputmask.regex.extensions.js

@@ -66,11 +66,11 @@ Allows for using regular expressions as a mask
 										break;
 									case ")": // Group closing
 										groupToken = opengroups.pop();
-										if (opengroups.length > 0)
+										if (opengroups.length > 0) {
 											opengroups[opengroups.length - 1].matches.push(groupToken);
-										else
+										} else {
 											currentToken.matches.push(groupToken);
-
+										}
 										break;
 									case "{":
 									case "+":
@@ -115,12 +115,14 @@ Allows for using regular expressions as a mask
 								}
 							}
 
-							if (currentToken.matches.length > 0)
+							if (currentToken.matches.length > 0) {
 								opts.regexTokens.push(currentToken);
+							}
 						}
 
 						function validateRegexToken(token, fromGroup) {
-							var isvalid = false;
+							var isvalid = false,
+								bufferStr;
 							if (fromGroup) {
 								regexPart += "(";
 								openGroupCount++;
@@ -190,12 +192,12 @@ Allows for using regular expressions as a mask
 							return isvalid;
 						}
 
-						if (opts.regexTokens === null)
+						if (opts.regexTokens === null) {
 							analyseRegex();
-
+						}
 
 						cbuffer.splice(pos, 0, chrs);
-						var bufferStr = cbuffer.join("");
+						bufferStr = cbuffer.join("");
 						for (var i = 0; i < opts.regexTokens.length; i++) {
 							var regexToken = opts.regexTokens[i];
 							isValid = validateRegexToken(regexToken, regexToken.isGroup);