From 4e2b2b97c320307333bb5adcec5f93b348c08453 Mon Sep 17 00:00:00 2001 From: Rachel Fenichel Date: Mon, 25 Jun 2018 12:09:55 -0700 Subject: [PATCH 1/2] Add curly and space-infix-ops rules --- .eslintrc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.eslintrc b/.eslintrc index 8385c0b7b..b20da09f8 100644 --- a/.eslintrc +++ b/.eslintrc @@ -1,6 +1,6 @@ { "rules": { - "curly": ["error", "multi-line"], + "curly": ["error"], "eol-last": ["error"], "indent": [ "error", 2, # Blockly/Google use 2-space indents @@ -50,6 +50,7 @@ "quotes": ["off"], # Blockly uses single quotes except for JSON blobs, which must use double quotes. "semi": ["error", "always"], "space-before-function-paren": ["error", "never"], # Blockly doesn't have space before function paren + "space-infix-ops": ["error"], "strict": ["off"], # Blockly uses 'use strict' in files "no-cond-assign": ["off"], # Blockly often uses cond-assignment in loops "no-redeclare": ["off"], # Closure style allows redeclarations From 5b1e249adced2ac6e1cc08a3a0255bb6a0cceb07 Mon Sep 17 00:00:00 2001 From: Rachel Fenichel Date: Mon, 25 Jun 2018 12:12:24 -0700 Subject: [PATCH 2/2] Fix lint --- blocks/text.js | 2 +- core/block_drag_surface.js | 2 +- core/blockly.js | 2 +- core/ui_events.js | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/blocks/text.js b/blocks/text.js index d1e825b75..ea79d43cd 100644 --- a/blocks/text.js +++ b/blocks/text.js @@ -626,7 +626,7 @@ Blockly.Constants.Text.QUOTE_IMAGE_MIXIN = { * @this Blockly.Block */ newQuote_: function(open) { - var isLeft = this.RTL? !open : open; + var isLeft = this.RTL ? !open : open; var dataUri = isLeft ? this.QUOTE_IMAGE_LEFT_DATAURI : this.QUOTE_IMAGE_RIGHT_DATAURI; diff --git a/core/block_drag_surface.js b/core/block_drag_surface.js index 57e441448..1a15b7544 100644 --- a/core/block_drag_surface.js +++ b/core/block_drag_surface.js @@ -135,7 +135,7 @@ Blockly.BlockDragSurfaceSvg.prototype.translateAndScaleGroup = function(x, y, sc var fixedX = x.toFixed(0); var fixedY = y.toFixed(0); this.dragGroup_.setAttribute('transform', - 'translate('+ fixedX + ','+ fixedY + ') scale(' + scale + ')'); + 'translate(' + fixedX + ',' + fixedY + ') scale(' + scale + ')'); }; /** diff --git a/core/blockly.js b/core/blockly.js index a627a97f6..b673c9ebb 100644 --- a/core/blockly.js +++ b/core/blockly.js @@ -632,7 +632,7 @@ Blockly.checkBlockColourConstant_ = function( msgName, blocklyNamePath, expectedValue) { var namePath = 'Blockly'; var value = Blockly; - for (var i =0; i < blocklyNamePath.length; ++i) { + for (var i = 0; i < blocklyNamePath.length; ++i) { namePath += '.' + blocklyNamePath[i]; if (value) { value = value[blocklyNamePath[i]]; diff --git a/core/ui_events.js b/core/ui_events.js index bd09f7575..2430ac928 100644 --- a/core/ui_events.js +++ b/core/ui_events.js @@ -48,7 +48,7 @@ goog.require('goog.math.Coordinate'); Blockly.Events.Ui = function(block, element, oldValue, newValue) { Blockly.Events.Ui.superClass_.constructor.call(this); this.blockId = block ? block.id : null; - this.workspaceId = block? block.workspace.id : null; + this.workspaceId = block ? block.workspace.id : null; this.element = element; this.oldValue = oldValue; this.newValue = newValue;