From 0951b5e6134622653beb96b4b68777692d10e736 Mon Sep 17 00:00:00 2001 From: Rachel Fenichel Date: Mon, 10 Aug 2020 15:10:48 -0700 Subject: [PATCH] Update eslintrc for eslint v7, and resolve new lint errors --- .eslintrc.json | 22 +++++++++++----------- core/renderers/measurables/types.js | 2 +- core/xml.js | 2 +- tests/mocha/extensions_test.js | 4 ++-- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index 63bfb43b7..2cfe544cd 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -2,9 +2,9 @@ "rules": { "curly": ["error"], "eol-last": ["error"], - "_comment": "Blockly/Google use 2-space indents", - "_comment": "Blockly/Google uses +4 space indents for line continuations.", - "_comment": "Ignore default rules for ternary expressions.", + // Blockly/Google use 2-space indents. + // Blockly/Google uses +4 space indents for line continuations. + // Ignore default rules for ternary expressions. "indent": [ "error", 2, { @@ -42,26 +42,26 @@ "error", { "args": "after-used", - "_comment": "Ignore vars starting with an underscore.", + // Ignore vars starting with an underscore. "varsIgnorePattern": "^_", - "_comment": "Ignore arguments starting with an underscore.", + // Ignore arguments starting with an underscore. "argsIgnorePattern": "^_" } ], "no-use-before-define": ["error"], - "_comment":"Blockly uses for exporting symbols. no-self-assign added in eslint 5.", + // Blockly uses for exporting symbols. no-self-assign added in eslint 5. "no-self-assign": ["off"], - "_comment": "Blockly uses single quotes except for JSON blobs, which must use double quotes.", + // Blockly uses single quotes except for JSON blobs, which must use double quotes. "quotes": ["off"], "semi": ["error", "always"], - "_comment": "Blockly doesn't have space before function paren when defining functions", + // Blockly doesn't have space before function paren when defining functions. "space-before-function-paren": ["error", "never"], - "_comment": "Blocklydoesn't have space before function paren when calling functions", + // Blockly doesn't have space before function paren when calling functions. "func-call-spacing": ["error", "never"], "space-infix-ops": ["error"], - "_comment": "Blockly uses 'use strict' in files", + // Blockly uses 'use strict' in files. "strict": ["off"], - "_comment": "Closure style allows redeclarations", + // Closure style allows redeclarations. "no-redeclare": ["off"], "valid-jsdoc": ["error", {"requireReturn": false}], "no-console": ["off"], diff --git a/core/renderers/measurables/types.js b/core/renderers/measurables/types.js index 02e5b9a9a..cbb7fa6ef 100644 --- a/core/renderers/measurables/types.js +++ b/core/renderers/measurables/types.js @@ -83,7 +83,7 @@ Blockly.blockRendering.Types.nextTypeValue_ = 1 << 24; * @package */ Blockly.blockRendering.Types.getType = function(type) { - if (!Blockly.blockRendering.Types.hasOwnProperty(type)) { + if (!Object.prototype.hasOwnProperty.call(Blockly.blockRendering.Types, type)) { Blockly.blockRendering.Types[type] = Blockly.blockRendering.Types.nextTypeValue_; Blockly.blockRendering.Types.nextTypeValue_ <<= 1; diff --git a/core/xml.js b/core/xml.js index 81f49fa1b..899b3c64a 100644 --- a/core/xml.js +++ b/core/xml.js @@ -487,7 +487,7 @@ Blockly.Xml.appendDomToWorkspace = function(xml, workspace) { var bbox; // Bounding box of the current blocks. // First check if we have a workspaceSvg, otherwise the blocks have no shape // and the position does not matter. - if (workspace.hasOwnProperty('scale')) { + if (Object.prototype.hasOwnProperty.call(workspace, 'scale')) { bbox = workspace.getBlocksBoundingBox(); } // Load the new blocks into the workspace and get the IDs of the new blocks. diff --git a/tests/mocha/extensions_test.js b/tests/mocha/extensions_test.js index 5dd51b12d..823e34d0e 100644 --- a/tests/mocha/extensions_test.js +++ b/tests/mocha/extensions_test.js @@ -241,8 +241,8 @@ suite('Extensions', function() { // Make sure all of the functions were installed correctly. chai.assert.equal(block.domToMutation(), 'domToMutationFn'); chai.assert.equal(block.mutationToDom(), 'mutationToDomFn'); - chai.assert.isFalse(block.hasOwnProperty('compose')); - chai.assert.isFalse(block.hasOwnProperty('decompose')); + chai.assert.isFalse(Object.prototype.hasOwnProperty.call(block, 'compose')); + chai.assert.isFalse(Object.prototype.hasOwnProperty.call(block, 'decompose')); }); }); });