From 9072563a00f68bad3b00d12bd4f1cd5e8cd54ff3 Mon Sep 17 00:00:00 2001 From: Rachel Fenichel Date: Tue, 16 Jan 2018 16:43:22 -0800 Subject: [PATCH 1/3] Update eslintrc to more explicitly describe indentation rules. --- .eslintrc | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/.eslintrc b/.eslintrc index 320df11ae..ff27be4e0 100644 --- a/.eslintrc +++ b/.eslintrc @@ -2,7 +2,28 @@ "rules": { "curly": ["error", "multi-line"], "eol-last": ["error"], - "indent": ["warn", 2, {"SwitchCase": 1}], # Blockly/Google use 2-space indents + "indent": [ + "error", 2, # Blockly/Google use 2-space indents + # Blockly/Google uses +4 space indents for line continuations. + { + "SwitchCase": 1, + "MemberExpression": 2, + "ObjectExpression": 1, + "FunctionDeclaration": { + "body": 1, + "parameters": 2 + }, + "FunctionExpression": { + "body": 1, + "parameters": 2 + }, + "CallExpression": { + "arguments": 2 + }, + # Ignore default rules for ternary expressions. + "ignoredNodes": ["ConditionalExpression"] + } + ], "linebreak-style": ["error", "unix"], "max-len": ["error", 120, 4], "no-trailing-spaces": ["error", { "skipBlankLines": true }], From cb75946a3cdfe1ed72ffa0b4b9edfd1dc1235c31 Mon Sep 17 00:00:00 2001 From: Rachel Fenichel Date: Thu, 25 Jan 2018 10:39:53 -0800 Subject: [PATCH 2/3] Set indent problems to warnings, and fix all errors. --- .eslintrc | 2 +- core/block.js | 6 +++--- core/workspace_svg.js | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.eslintrc b/.eslintrc index ff27be4e0..50a1eff62 100644 --- a/.eslintrc +++ b/.eslintrc @@ -3,7 +3,7 @@ "curly": ["error", "multi-line"], "eol-last": ["error"], "indent": [ - "error", 2, # Blockly/Google use 2-space indents + "warn", 2, # Blockly/Google use 2-space indents # Blockly/Google uses +4 space indents for line continuations. { "SwitchCase": 1, diff --git a/core/block.js b/core/block.js index 4783c0dea..f6727ab97 100644 --- a/core/block.js +++ b/core/block.js @@ -1162,11 +1162,11 @@ Blockly.Block.prototype.interpolate_ = function(message, args, lastDummyAlign) { var token = tokens[i]; if (typeof token == 'number') { if (token <= 0 || token > args.length) { - throw new Error('Block \"' + this.type + '\": ' + + throw new Error('Block "' + this.type + '": ' + 'Message index %' + token + ' out of range.'); } if (indexDup[token]) { - throw new Error('Block \"' + this.type + '\": ' + + throw new Error('Block "' + this.type + '": ' + 'Message index %' + token + ' duplicated.'); } indexDup[token] = true; @@ -1180,7 +1180,7 @@ Blockly.Block.prototype.interpolate_ = function(message, args, lastDummyAlign) { } } if(indexCount != args.length) { - throw new Error('Block \"' + this.type + '\": ' + + throw new Error('Block "' + this.type + '": ' + 'Message does not reference all ' + args.length + ' arg(s).'); } // Add last dummy input if needed. diff --git a/core/workspace_svg.js b/core/workspace_svg.js index 38990ac14..64e22d4ea 100644 --- a/core/workspace_svg.js +++ b/core/workspace_svg.js @@ -388,7 +388,7 @@ Blockly.WorkspaceSvg.prototype.createDom = function(opt_backgroundClass) { bottom = this.addTrashcan_(bottom); } if (this.options.zoomOptions && this.options.zoomOptions.controls) { - bottom = this.addZoomControls_(bottom); + this.addZoomControls_(bottom); } if (!this.isFlyout) { From ee248d9596566ab4c7bd24ebc39c3bff6be0cdd2 Mon Sep 17 00:00:00 2001 From: Rachel Fenichel Date: Thu, 25 Jan 2018 10:41:31 -0800 Subject: [PATCH 3/3] Update eslint version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 03074fe61..f7c1192d6 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,7 @@ "private": true, "devDependencies": { "jshint": "latest", - "eslint": "2.9.0" + "eslint": "^4.16" }, "jshintConfig": { "globalstrict": true,