Update eslintrc for eslint v7, and resolve new lint errors

This commit is contained in:
Rachel Fenichel
2020-08-10 15:10:48 -07:00
parent 21a7fd960f
commit 0951b5e613
4 changed files with 15 additions and 15 deletions

View File

@@ -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"],

View File

@@ -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;

View File

@@ -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.

View File

@@ -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'));
});
});
});