Skip to content

Commit

Permalink
chore: fix more lint (#5700)
Browse files Browse the repository at this point in the history
* chore: fix 918 violations of comma-dangle rule

* chore: fix 2 violations of comma-spacing

* chore: fix 13 violations of padded-blocks

* chore: fix 50 violations of block-spacing

* chore: fix one violation of semi-spacing

* chore: fix 4 violations of space-before-blocks

* chore: fix 38 violations of object-curly-spacing

* chore: fix 30 violations of key-spacing

* chore: fix 3 violations of quote-props

* chore: fix 5 violations of arrow-parens

* chore: fix 8 violations of no-tabs

* chore: allow uncommented helper functions in mocha tests

* chore: fix several more lint errors

* chore: tweak eslint configuration in core and tests

* chore: rebuild for tests
  • Loading branch information
rachel-fenichel committed Nov 10, 2021
1 parent 82fde60 commit d11cc04
Show file tree
Hide file tree
Showing 54 changed files with 1,027 additions and 1,009 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
*_compressed*.js
blockly_uncompressed.js
gulpfile.js
/msg/*
/build/*
Expand Down
14 changes: 13 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,19 @@
"balanced": true
},
"exceptions": ["*"]
}]
}],
// Blockly uses prefixes for optional arguments and test-only functions.
"camelcase": ["error", {
"properties": "never",
"allow": ["^opt_", "^_opt_", "^testOnly_"]
}],
// Use clang-format for indentation by running `npm run format`.
"indent": ["off"],
// Blockly uses capital letters for some non-constructor namespaces.
// Keep them for legacy reasons.
"new-cap": ["off"],
// Mostly use default rules for brace style, but allow single-line blocks.
"brace-style": ["error", "1tbs", { "allowSingleLine": true }]
},
"env": {
"es6": true,
Expand Down
2 changes: 1 addition & 1 deletion scripts/migration/renamings.js
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ const renamings = {
'Blockly.Blocks.texts': {module: 'Blockly.blocks.texts'},
'Blockly.Blocks.variables': {module: 'Blockly.blocks.variables'},
// Blockly.Blocks.variablesDynamic not previously provided.
}
},
};

exports.renamings = renamings;
6 changes: 5 additions & 1 deletion tests/mocha/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@
"es5/no-template-literals": ["off"],
"es5/no-typeof-symbol": ["off"],
"es5/no-unicode-code-point-escape": ["off"],
"es5/no-unicode-regex": ["off"]
"es5/no-unicode-regex": ["off"],
// Allow uncommented helper functions in tests.
"require-jsdoc": ["off"],
// In mocha tests in suites, `this` is meaningful and useful.
"no-invalid-this": ["off"]
},
"extends": "../../.eslintrc.json"
}
77 changes: 38 additions & 39 deletions tests/mocha/astnode_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,40 +20,40 @@ suite('ASTNode', function() {
{
"type": "field_input",
"name": "NAME",
"text": "default"
"text": "default",
},
{
"type": "field_input",
"name": "NAME",
"text": "default"
"text": "default",
},
{
"type": "input_value",
"name": "NAME"
"name": "NAME",
},
{
"type": "input_statement",
"name": "NAME"
}
"name": "NAME",
},
],
"previousStatement": null,
"nextStatement": null,
"colour": 230,
"tooltip": "",
"helpUrl": ""
"helpUrl": "",
},
{
"type": "value_input",
"message0": "%1",
"args0": [
{
"type": "input_value",
"name": "NAME"
}
"name": "NAME",
},
],
"colour": 230,
"tooltip": "",
"helpUrl": ""
"helpUrl": "",
},
{
"type": "field_input",
Expand All @@ -62,14 +62,14 @@ suite('ASTNode', function() {
{
"type": "field_input",
"name": "NAME",
"text": "default"
}
"text": "default",
},
],
"output": null,
"colour": 230,
"tooltip": "",
"helpUrl": ""
}
"helpUrl": "",
},
]);
this.workspace = new Blockly.Workspace();
this.cursor = this.workspace.cursor;
Expand All @@ -92,7 +92,7 @@ suite('ASTNode', function() {
statementInput3: statementInput3,
statementInput4: statementInput4,
fieldWithOutput: fieldWithOutput,
valueInput: valueInput
valueInput: valueInput,
};
});
teardown(function() {
Expand Down Expand Up @@ -166,7 +166,6 @@ suite('ASTNode', function() {
const newASTNode = node.findFirstFieldOrInput_(this.blocks.statementInput4);
chai.assert.equal(newASTNode.getLocation(), field);
});

});

suite('NavigationFunctions', function() {
Expand All @@ -177,15 +176,15 @@ suite('ASTNode', function() {
"previousStatement": null,
"colour": 230,
"tooltip": "",
"helpUrl": ""
"helpUrl": "",
},
{
"type": "start_block",
"message0": "",
"nextStatement": null,
"colour": 230,
"tooltip": "",
"helpUrl": ""
"helpUrl": "",
},
{
"type": "fields_and_input",
Expand All @@ -194,26 +193,26 @@ suite('ASTNode', function() {
{
"type": "field_input",
"name": "NAME",
"text": "default"
"text": "default",
},
{
"type": "input_dummy"
"type": "input_dummy",
},
{
"type": "field_input",
"name": "NAME",
"text": "default"
"text": "default",
},
{
"type": "input_value",
"name": "NAME"
}
"name": "NAME",
},
],
"previousStatement": null,
"nextStatement": null,
"colour": 230,
"tooltip": "",
"helpUrl": ""
"helpUrl": "",
},
{
"type": "two_fields",
Expand All @@ -222,61 +221,61 @@ suite('ASTNode', function() {
{
"type": "field_input",
"name": "NAME",
"text": "default"
}
"text": "default",
},
],
"colour": 230,
"tooltip": "",
"helpUrl": ""
"helpUrl": "",
},
{
"type": "fields_and_input2",
"message0": "%1 %2 %3 hi %4 bye",
"args0": [
{
"type": "input_value",
"name": "NAME"
"name": "NAME",
},
{
"type": "field_input",
"name": "NAME",
"text": "default"
"text": "default",
},
{
"type": "input_value",
"name": "NAME"
"name": "NAME",
},
{
"type": "input_statement",
"name": "NAME"
}
"name": "NAME",
},
],
"colour": 230,
"tooltip": "",
"helpUrl": ""
"helpUrl": "",
},
{
"type": "dummy_input",
"message0": "Hello",
"colour": 230,
"tooltip": "",
"helpUrl": ""
"helpUrl": "",
},
{
"type": "dummy_inputValue",
"message0": "Hello %1 %2",
"args0": [
{
"type": "input_dummy"
"type": "input_dummy",
},
{
"type": "input_value",
"name": "NAME"
}
"name": "NAME",
},
],
"colour": 230,
"tooltip": "",
"helpUrl": ""
"helpUrl": "",
},
{
"type": "output_next",
Expand All @@ -285,7 +284,7 @@ suite('ASTNode', function() {
"colour": 230,
"tooltip": "",
"helpUrl": "",
"nextStatement": null
"nextStatement": null,
}]);
const noNextConnection = this.workspace.newBlock('top_connection');
const fieldAndInputs = this.workspace.newBlock('fields_and_input');
Expand Down Expand Up @@ -658,7 +657,7 @@ suite('ASTNode', function() {
});
test('fromStackToWorkspace', function() {
const stub = sinon.stub(this.blocks.statementInput4,
"getRelativeToSurfaceXY").returns({x: 10, y:10});
"getRelativeToSurfaceXY").returns({x: 10, y: 10});
const node = ASTNode.createStackNode(this.blocks.statementInput4);
const outNode = node.out();
chai.assert.equal(outNode.getType(), ASTNode.types.WORKSPACE);
Expand Down
14 changes: 7 additions & 7 deletions tests/mocha/block_create_event_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,17 @@ suite('Block Create Event', function() {
"type": "text",
"id": "shadowId",
"fields": {
"TEXT": "abc"
}
"TEXT": "abc",
},
},
"block": {
"type": "text",
"fields": {
"TEXT": ""
}
}
}
}
"TEXT": "",
},
},
},
},
},
this.workspace);
Blockly.Events.enable();
Expand Down
Loading

0 comments on commit d11cc04

Please sign in to comment.