Updated eslint whitespace rules

This commit is contained in:
n1474335 2017-02-09 15:09:33 +00:00
parent ebf2258715
commit e803d208e8
51 changed files with 801 additions and 793 deletions

View File

@ -45,9 +45,7 @@
"comma-spacing": "error",
"comma-style": "error",
"computed-property-spacing": "error",
"no-trailing-spaces": ["warn", {
"skipBlankLines": true
}],
"no-trailing-spaces": "warn",
"eol-last": "error",
"func-call-spacing": "error",
"indent": ["error", 4, {
@ -70,7 +68,19 @@
"ClassDeclaration": true,
"ArrowFunctionExpression": true
}
}]
}],
"keyword-spacing": ["error", {
"before": true,
"after": true
}],
"no-multiple-empty-lines": ["warn", {
"max": 2,
"maxEOF": 1,
"maxBOF": 0
}],
"no-whitespace-before-property": "error",
"operator-linebreak": ["error", "after"],
"space-in-parens": "error"
},
"globals": {
/* core/* */

View File

@ -113,7 +113,7 @@ Chef.prototype.silentBake = function(recipeConfig) {
try {
recipe.execute(dish);
} catch(err) {
} catch (err) {
// Suppress all errors
}
return new Date().getTime() - startTime;

View File

@ -70,7 +70,7 @@ var FlowControl = {
var dish = new Dish(inputs[i], inputType);
try {
progress = recipe.execute(dish, 0);
} catch(err) {
} catch (err) {
if (!ignoreErrors) {
throw err;
}

View File

@ -922,8 +922,8 @@ var Utils = {
* @returns {Object}
*/
extend: function(a, b){
for(var key in b)
if(b.hasOwnProperty(key))
for (var key in b)
if (b.hasOwnProperty(key))
a[key] = b[key];
return a;
},
@ -1169,7 +1169,6 @@ String.prototype.count = function(chr) {
};
////////////////////////////////////////////////////////////////////////////////////////////////////
// Library overrides ///////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////

View File

@ -153,7 +153,7 @@ var Checksum = {
var csum = 0;
for (var i = 0; i < input.length; i++) {
if(i % 2 === 0) {
if (i % 2 === 0) {
csum += (input[i] << 8);
} else {
csum += input[i];

View File

@ -460,7 +460,7 @@ var Cipher = {
msgIndex = alphabet.indexOf(input[i]);
// Subtract indexes from each other, add 26 just in case the value is negative,
// modulo to remove if neccessary
output += alphabet[(msgIndex - keyIndex + alphabet.length ) % 26];
output += alphabet[(msgIndex - keyIndex + alphabet.length) % 26];
} else if (alphabet.indexOf(input[i].toLowerCase()) >= 0) {
chr = key[(i - fail) % key.length].toLowerCase();
keyIndex = alphabet.indexOf(chr);

View File

@ -244,7 +244,7 @@ var Code = {
var i = 0,
level = 0;
while (i < code.length) {
switch(code[i]) {
switch (code[i]) {
case "{":
level++;
break;

View File

@ -140,7 +140,7 @@ var DateTime = {
try {
date = moment.tz(input, inputFormat, inputTimezone);
if (!date || date.format() === "Invalid date") throw Error;
} catch(err) {
} catch (err) {
return "Invalid format.\n\n" + DateTime.FORMAT_EXAMPLES;
}
@ -164,7 +164,7 @@ var DateTime = {
try {
date = moment.tz(input, inputFormat, inputTimezone);
if (!date || date.format() === "Invalid date") throw Error;
} catch(err) {
} catch (err) {
return "Invalid format.\n\n" + DateTime.FORMAT_EXAMPLES;
}

View File

@ -243,7 +243,6 @@ var HTML = {
},
/**
* Converts an HSL color value to RGB. Conversion formula
* adapted from http://en.wikipedia.org/wiki/HSL_colorSpace.
@ -309,7 +308,7 @@ var HTML = {
} else {
var d = max - min;
s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
switch(max) {
switch (max) {
case r: h = (g - b) / d + (g < b ? 6 : 0); break;
case g: h = (b - r) / d + 2; break;
case b: h = (r - g) / d + 4; break;

View File

@ -122,7 +122,7 @@ var JS = {
AST = escodegen.attachComments(AST, AST.comments, AST.tokens);
result = escodegen.generate(AST, options);
} catch(e) {
} catch (e) {
// Leave original error so the user can see the detail
throw "Unable to parse JavaScript.<br>" + e.message;
}

View File

@ -89,7 +89,7 @@ var MorseCode = {
words = Array.prototype.map.call(words, function(word) {
var letters = Array.prototype.map.call(word, function(character) {
var letter = character.toUpperCase();
if(typeof MorseCode.MORSE_TABLE[letter] == "undefined") {
if (typeof MorseCode.MORSE_TABLE[letter] == "undefined") {
return "";
}
@ -106,7 +106,7 @@ var MorseCode = {
input = input.replace(
/<dash>|<dot>|<ld>|<wd>/g,
function(match) {
switch(match) {
switch (match) {
case "<dash>": return dash;
case "<dot>": return dot;
case "<ld>": return letterDelim;
@ -131,14 +131,14 @@ var MorseCode = {
var reverseTable = function() {
reversedTable = {};
for(var letter in MorseCode.MORSE_TABLE) {
for (var letter in MorseCode.MORSE_TABLE) {
var signal = MorseCode.MORSE_TABLE[letter];
reversedTable[signal] = letter;
}
};
return function(input, args) {
if(reversedTable === null) {
if (reversedTable === null) {
reverseTable();
}

View File

@ -86,7 +86,7 @@ var SeqUtils = {
var regex = new RegExp(search, "gi"),
matches = input.match(regex);
return matches.length;
} catch(err) {
} catch (err) {
return 0;
}
} else if (search) {

View File

@ -42,7 +42,7 @@ var URL_ = {
var data = input.replace(/\+/g, "%20");
try {
return decodeURIComponent(data);
} catch(err) {
} catch (err) {
return unescape(data);
}
},

View File

@ -192,7 +192,7 @@ ControlsWaiter.prototype.saveTextChange = function() {
try {
var recipeConfig = JSON.parse(document.getElementById("save-text").value);
this.initialiseSaveLink(recipeConfig);
} catch(err) {}
} catch (err) {}
};
@ -336,7 +336,7 @@ ControlsWaiter.prototype.loadButtonClick = function() {
this.app.setRecipeConfig(recipeConfig);
$("#rec-list [data-toggle=popover]").popover();
} catch(e) {
} catch (e) {
this.app.alert("Invalid recipe", "danger", 2000);
}
};

View File

@ -362,13 +362,13 @@ HTMLApp.prototype.loadURIParams = function() {
try {
var recipeConfig = JSON.parse(this.queryString.recipe);
this.setRecipeConfig(recipeConfig);
} catch(err) {}
} catch (err) {}
} else if (this.queryString.op) {
// If there's no recipe, look for single operations
this.manager.recipe.clearRecipe();
try {
this.manager.recipe.addOperation(this.queryString.op);
} catch(err) {
} catch (err) {
// If no exact match, search for nearest match and add that
var matchedOps = this.manager.ops.filterOperations(this.queryString.op, false);
if (matchedOps.length) {
@ -388,7 +388,7 @@ HTMLApp.prototype.loadURIParams = function() {
try {
var inputData = Utils.fromBase64(this.queryString.input);
this.setInput(inputData);
} catch(err) {}
} catch (err) {}
}
// Restore auto-bake state

View File

@ -227,7 +227,7 @@ SeasonalWaiter.treeWalk = (function() {
while (node && node !== parent) {
if (allNodes || node.nodeType === 1) {
if (fn(node) === false) {
return(false);
return false;
}
}
// If it's an element &&