From 3f77ceb823d54fabb1a5165ca896af95ec302af5 Mon Sep 17 00:00:00 2001 From: Rachel Fenichel Date: Mon, 19 Mar 2018 13:08:47 -0700 Subject: [PATCH 1/2] Tighten line length rule from 120 to 100 --- .eslintrc | 10 +++++++++- core/touch_gesture.js | 3 ++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/.eslintrc b/.eslintrc index 9530b7666..eb00225c8 100644 --- a/.eslintrc +++ b/.eslintrc @@ -25,7 +25,15 @@ } ], "linebreak-style": ["error", "unix"], - "max-len": ["error", 120, 4], + "max-len": [ + "error", + { + "code": 100, + "tabWidth": 4, + "ignoreStrings": true, + "ignoreRegExpLiterals": true + } + ], "no-trailing-spaces": ["error", { "skipBlankLines": true }], "no-unused-vars": ["error", {"args": "after-used", "varsIgnorePattern": "^_"}], "no-use-before-define": ["error"], diff --git a/core/touch_gesture.js b/core/touch_gesture.js index 67ee03238..3303e3a8e 100644 --- a/core/touch_gesture.js +++ b/core/touch_gesture.js @@ -269,7 +269,8 @@ Blockly.TouchGesture.prototype.handleTouchMove = function(e) { gestureScale * Blockly.TouchGesture.ZOOM_IN_MULTIPLIER : gestureScale * Blockly.TouchGesture.ZOOM_OUT_MULTIPLIER; var workspace = this.startWorkspace_; - var position = Blockly.utils.mouseToSvg(e, workspace.getParentSvg(), workspace.getInverseScreenCTM()); + var position = Blockly.utils.mouseToSvg( + e, workspace.getParentSvg(), workspace.getInverseScreenCTM()); workspace.zoom(position.x, position.y, delta); } this.previousScale_ = scale; From 6d83b9bc28c7a6c84cd38b152bd0812a2bb84596 Mon Sep 17 00:00:00 2001 From: Rachel Fenichel Date: Mon, 19 Mar 2018 13:10:25 -0700 Subject: [PATCH 2/2] Add keyword-spacing rule to eslint --- .eslintrc | 1 + blocks/variables.js | 2 +- core/block.js | 2 +- core/flyout_base.js | 2 +- core/xml.js | 2 +- 5 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.eslintrc b/.eslintrc index eb00225c8..825af5b7f 100644 --- a/.eslintrc +++ b/.eslintrc @@ -24,6 +24,7 @@ "ignoredNodes": ["ConditionalExpression"] } ], + "keyword-spacing": ["error"], "linebreak-style": ["error", "unix"], "max-len": [ "error", diff --git a/blocks/variables.js b/blocks/variables.js index 5cfa0d0b5..38038f164 100644 --- a/blocks/variables.js +++ b/blocks/variables.js @@ -103,7 +103,7 @@ Blockly.Constants.Variables.CUSTOM_CONTEXT_MENU_VARIABLE_GETTER_SETTER_MIXIN = { * @this Blockly.Block */ customContextMenu: function(options) { - if(this.isInFlyout){ + if (this.isInFlyout){ return; } // Getter blocks have the option to create a setter block, and vice versa. diff --git a/core/block.js b/core/block.js index 7dc0485dd..76b45ca03 100644 --- a/core/block.js +++ b/core/block.js @@ -1197,7 +1197,7 @@ Blockly.Block.prototype.interpolate_ = function(message, args, lastDummyAlign) { } } } - if(indexCount != args.length) { + if (indexCount != args.length) { throw new Error('Block "' + this.type + '": ' + 'Message does not reference all ' + args.length + ' arg(s).'); } diff --git a/core/flyout_base.js b/core/flyout_base.js index 9c5485bbb..0924412b7 100644 --- a/core/flyout_base.js +++ b/core/flyout_base.js @@ -611,7 +611,7 @@ Blockly.Flyout.prototype.createBlock = function(originalBlock) { Blockly.Events.setGroup(true); Blockly.Events.fire(new Blockly.Events.Create(newBlock)); // Fire a VarCreate event for each (if any) new variable created. - for(var i = 0; i < newVariables.length; i++) { + for (var i = 0; i < newVariables.length; i++) { var thisVariable = newVariables[i]; Blockly.Events.fire(new Blockly.Events.VarCreate(thisVariable)); } diff --git a/core/xml.js b/core/xml.js index e899060ce..5ac15c38f 100644 --- a/core/xml.js +++ b/core/xml.js @@ -549,7 +549,7 @@ Blockly.Xml.domToBlock = function(xmlBlock, workspace) { var newVariables = Blockly.Variables.getAddedVariables(workspace, variablesBeforeCreation); // Fire a VarCreate event for each (if any) new variable created. - for(var i = 0; i < newVariables.length; i++) { + for (var i = 0; i < newVariables.length; i++) { var thisVariable = newVariables[i]; Blockly.Events.fire(new Blockly.Events.VarCreate(thisVariable)); }