Merge pull request #2751 from rachel-fenichel/eslint_rules

Add more eslint rules
This commit is contained in:
Rachel Fenichel
2019-07-31 11:01:15 -07:00
committed by GitHub
23 changed files with 38 additions and 29 deletions

View File

@@ -54,8 +54,10 @@
"_comment": "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",
"_comment": "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",
"func-call-spacing": ["error", "never"],
"space-infix-ops": ["error"],
"_comment": "Blockly uses 'use strict' in files",
"strict": ["off"],
@@ -64,7 +66,14 @@
"_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 }],
"operator-linebreak": ["error", "after"],
"spaced-comment": ["warn", "always", {
"block": {
"balanced": true
}
}]
},
"env": {
"browser": true

View File

@@ -246,8 +246,8 @@ Blockly.FieldDropdown.prototype.positionMenu_ = function(menu) {
var menuSize = Blockly.utils.uiMenu.getSize(menu);
var menuMaxHeightPx = Blockly.FieldDropdown.MAX_MENU_HEIGHT_VH
* document.documentElement.clientHeight;
var menuMaxHeightPx = Blockly.FieldDropdown.MAX_MENU_HEIGHT_VH *
document.documentElement.clientHeight;
if (menuSize.height > menuMaxHeightPx) {
menuSize.height = menuMaxHeightPx;
}

View File

@@ -405,8 +405,8 @@ Blockly.Trashcan.prototype.animateLid_ = function() {
* @private
*/
Blockly.Trashcan.prototype.setLidAngle_ = function(lidAngle) {
var openAtRight = this.workspace_.toolboxPosition == Blockly.TOOLBOX_AT_RIGHT
|| (this.workspace_.horizontalLayout && this.workspace_.RTL);
var openAtRight = this.workspace_.toolboxPosition == Blockly.TOOLBOX_AT_RIGHT ||
(this.workspace_.horizontalLayout && this.workspace_.RTL);
this.svgLid_.setAttribute('transform', 'rotate(' +
(openAtRight ? -lidAngle : lidAngle) + ',' +
(openAtRight ? 4 : this.WIDTH_ - 4) + ',' +

View File

@@ -7,8 +7,8 @@ suite('Connections', function() {
var connections = block.getConnections_(true);
for (var i = 0; i < connections.length; i++) {
var connection = connections[i];
if (connection.type == Blockly.PREVIOUS_STATEMENT
|| connection.type == Blockly.OUTPUT_VALUE) {
if (connection.type == Blockly.PREVIOUS_STATEMENT ||
connection.type == Blockly.OUTPUT_VALUE) {
// Only superior connections on inputs get hidden
continue;
}

View File

@@ -18,7 +18,7 @@
* limitations under the License.
*/
suite ('Angle Fields', function() {
suite('Angle Fields', function() {
function assertValue(angleField, expectedValue, opt_expectedText) {
var actualValue = angleField.getValue();
var actualText = angleField.getText();

View File

@@ -18,7 +18,7 @@
* limitations under the License.
*/
suite ('Colour Fields', function() {
suite('Colour Fields', function() {
function assertValue(colourField, expectedValue, expectedText) {
var actualValue = colourField.getValue();
var actualText = colourField.getText();

View File

@@ -18,7 +18,7 @@
* limitations under the License.
*/
suite ('Date Fields', function() {
suite('Date Fields', function() {
function assertValue(dateField, expectedValue) {
var actualValue = dateField.getValue();
var actualText = dateField.getText();

View File

@@ -18,7 +18,7 @@
* limitations under the License.
*/
suite ('Dropdown Fields', function() {
suite('Dropdown Fields', function() {
function assertValue(dropdownField, expectedValue, expectedText) {
var actualValue = dropdownField.getValue();
var actualText = dropdownField.getText();

View File

@@ -18,7 +18,7 @@
* limitations under the License.
*/
suite ('Image Fields', function() {
suite('Image Fields', function() {
function assertValue(imageField, expectedValue, expectedText) {
var actualValue = imageField.getValue();
var actualText = imageField.getText();

View File

@@ -18,7 +18,7 @@
* limitations under the License.
*/
suite ('Label Serializable Fields', function() {
suite('Label Serializable Fields', function() {
function assertValue(labelField, expectedValue) {
var actualValue = labelField.getValue();
var actualText = labelField.getText();

View File

@@ -18,7 +18,7 @@
* limitations under the License.
*/
suite ('Label Fields', function() {
suite('Label Fields', function() {
function assertValue(labelField, expectedValue) {
var actualValue = labelField.getValue();
var actualText = labelField.getText();

View File

@@ -18,7 +18,7 @@
* limitations under the License.
*/
suite ('Number Fields', function() {
suite('Number Fields', function() {
function assertValue(numberField, expectedValue, opt_expectedText) {
var actualValue = numberField.getValue();
var actualText = numberField.getText();

View File

@@ -18,7 +18,7 @@
* limitations under the License.
*/
suite ('Text Input Fields', function() {
suite('Text Input Fields', function() {
function assertValue(textInputField, expectedValue, opt_expectedText) {
var actualValue = textInputField.getValue();
var actualText = textInputField.getText();