Add no-multi-spaces rule

This commit is contained in:
Rachel Fenichel
2019-07-31 09:33:54 -07:00
parent 9466c6b7df
commit b4109d7c43
12 changed files with 14 additions and 13 deletions

View File

@@ -64,7 +64,8 @@
"_comment": "Closure style allows redeclarations",
"no-redeclare": ["off"],
"valid-jsdoc": ["error", {"requireReturn": false}],
"no-console": ["off"]
"no-console": ["off"],
"no-multi-spaces": ["error", { "ignoreEOLComments": true }]
},
"env": {
"browser": true

View File

@@ -372,7 +372,7 @@ Blockly.BlockSvg.prototype.renderFields_ = function(fieldList,
}
}
if (this.RTL &&
field instanceof Blockly.FieldImage &&
field instanceof Blockly.FieldImage &&
field.getFlipRtl()) {
scale = 'scale(-1 1)';
translateX += field.renderWidth;

View File

@@ -523,7 +523,7 @@ Blockly.Bubble.prototype.getOptimalRelativeLeft_ = function(metrics) {
if (this.workspace_.RTL) {
// Bubble coordinates are flipped in RTL.
var bubbleRight = this.anchorXY_.x - relativeLeft;
var bubbleRight = this.anchorXY_.x - relativeLeft;
var bubbleLeft = bubbleRight - this.width_;
var workspaceRight = metrics.viewLeft + metrics.viewWidth;

View File

@@ -143,7 +143,7 @@ Blockly.BubbleDragger.prototype.dragBubble = function(e, currentDragDeltaXY) {
this.draggingBubble_.moveDuringDrag(this.dragSurface_, newLoc);
if (this.draggingBubble_.isDeletable()) {
this.deleteArea_ = this.workspace_.isDeleteArea(e);
this.deleteArea_ = this.workspace_.isDeleteArea(e);
this.updateCursorDuringBubbleDrag_();
}
};

View File

@@ -337,7 +337,7 @@ Blockly.FieldVariable.prototype.setTypes_ = function(opt_variableTypes,
'a FieldVariable');
}
// Only update the field once all checks pass.
this.defaultType_ = defaultType;
this.defaultType_ = defaultType;
this.variableTypes = variableTypes;
};

View File

@@ -253,7 +253,7 @@ Blockly.Flyout.prototype.init = function(targetWorkspace) {
this.targetWorkspace_.getGesture.bind(this.targetWorkspace_);
// Get variables from the main workspace rather than the target workspace.
this.workspace_.variableMap_ = this.targetWorkspace_.getVariableMap();
this.workspace_.variableMap_ = this.targetWorkspace_.getVariableMap();
this.workspace_.createPotentialVariableMap();
};

View File

@@ -343,7 +343,7 @@ Blockly.InsertionMarkerManager.prototype.shouldUpdatePreviews_ = function(
var yDiff = this.localConnection_.y_ + dxy.y - this.closestConnection_.y_;
var curDistance = Math.sqrt(xDiff * xDiff + yDiff * yDiff);
// Slightly prefer the existing preview over a new preview.
return !(candidateClosest && radius > curDistance -
return !(candidateClosest && radius > curDistance -
Blockly.CURRENT_CONNECTION_PREFERENCE);
} else if (!this.localConnection_ && !this.closestConnection_) {
// We weren't showing a preview before, but we should now.

View File

@@ -258,8 +258,8 @@ Blockly.CursorSvg.prototype.showWithStack_ = function() {
var height = heightWidth.height + Blockly.CursorSvg.STACK_PADDING;
// Shift the rectangle slightly to upper left so padding is equal on all sides.
var x = -1 * Blockly.CursorSvg.STACK_PADDING / 2;
var y = -1 * Blockly.CursorSvg.STACK_PADDING / 2;
var x = -1 * Blockly.CursorSvg.STACK_PADDING / 2;
var y = -1 * Blockly.CursorSvg.STACK_PADDING / 2;
// If the block has an output connection it needs more padding.
if (block.outputConnection) {

View File

@@ -165,7 +165,7 @@ Blockly.Mutator.prototype.createEditor_ = function() {
// a top level svg. Instead of handling scale themselves, mutators
// inherit scale from the parent workspace.
// To fix this, scale needs to be applied at a different level in the dom.
var flyoutSvg = this.workspace_.addFlyout_('g');
var flyoutSvg = this.workspace_.addFlyout_('g');
var background = this.workspace_.createDom('blocklyMutatorBackground');
// Insert the flyout after the <rect> but before the block canvas so that

View File

@@ -339,7 +339,7 @@ Blockly.utils.tokenizeInterpolation_ = function(message,
state = 0; // and parse as string literal.
} else if (c != '}') {
buffer.push(c);
} else {
} else {
var rawKey = buffer.join('');
if (/[A-Z]\w*/i.test(rawKey)) { // Strict matching
// Found a valid string key. Attempt case insensitive match.

View File

@@ -479,7 +479,7 @@ Blockly.Xml.appendDomToWorkspace = function(xml, workspace) {
if (blockXY.y < newY) {
newY = blockXY.y;
}
if (blockXY.x < newX) { // if we align also on x
if (blockXY.x < newX) { // if we align also on x
newX = blockXY.x;
}
}

View File

@@ -48,7 +48,7 @@ suite ('Number Fields', function() {
{ 'value': value, min: value, max: value, precision: value });
}
function assertNumberFieldSameValues(numberField, value) {
assertNumberField(numberField, value, value, value, value);
assertNumberField(numberField, value, value, value, value);
}
suite('Constructor', function() {
test('Empty', function() {