Skip to content

Commit 7f683cf

Browse files
committed
fix for eslint.
1 parent ddda6e1 commit 7f683cf

File tree

8 files changed

+37
-51
lines changed

8 files changed

+37
-51
lines changed

src/lib/ruby-generator/ev3.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,4 +82,4 @@ export default function (Generator) {
8282
};
8383

8484
return Generator;
85-
}
85+
}

src/lib/ruby-generator/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import TranslateBlocks from './translate.js';
2424
import MakeyMakeyBlocks from './makeymakey.js';
2525
import MicrobitBlocks from './microbit.js';
2626
import BoostBlocks from './boost.js';
27-
import EV3Blocks from './ev3.js'
27+
import EV3Blocks from './ev3.js';
2828
import WeDo2Blocks from './wedo2.js';
2929

3030
const SCALAR_TYPE = '';

src/lib/ruby-generator/wedo2.js

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -5,40 +5,40 @@
55
*/
66
export default function (Generator) {
77
Generator.wedo2_menu_MOTOR_ID = function (block) {
8-
const motor_id = Generator.quote_(Generator.getFieldValue(block, 'MOTOR_ID') || 'motor');
9-
return [motor_id, Generator.ORDER_ATOMIC]
8+
const motorId = Generator.quote_(Generator.getFieldValue(block, 'MOTOR_ID') || 'motor');
9+
return [motorId, Generator.ORDER_ATOMIC];
1010
};
1111
Generator.wedo2_motorOnFor = function (block) {
12-
const motor_id = Generator.valueToCode(block, 'MOTOR_ID', Generator.ORDER_NONE) || null;
12+
const motorId = Generator.valueToCode(block, 'MOTOR_ID', Generator.ORDER_NONE) || null;
1313
const duration = Generator.valueToCode(block, 'DURATION', Generator.ORDER_NONE) || null;
14-
return `wedo2_turn_motor_on_for(${motor_id}, ${duration})\n`;
14+
return `wedo2_turn_motor_on_for(${motorId}, ${duration})\n`;
1515
};
1616

1717
Generator.wedo2_motorOn = function (block) {
18-
const motor_id = Generator.valueToCode(block, 'MOTOR_ID', Generator.ORDER_NONE) || null;
19-
return `wedo2_trun_motor_on(${motor_id})\n`;
18+
const motorId = Generator.valueToCode(block, 'MOTOR_ID', Generator.ORDER_NONE) || null;
19+
return `wedo2_trun_motor_on(${motorId})\n`;
2020
};
2121

2222
Generator.wedo2_motorOff = function (block) {
23-
const motor_id = Generator.valueToCode(block, 'MOTOR_ID', Generator.ORDER_NONE) || null;
24-
return `wedo2_trun_motor_off(${motor_id})\n`;
23+
const motorId = Generator.valueToCode(block, 'MOTOR_ID', Generator.ORDER_NONE) || null;
24+
return `wedo2_trun_motor_off(${motorId})\n`;
2525
};
2626

2727
Generator.wedo2_startMotorPower = function (block) {
28-
const motor_id = Generator.valueToCode(block, 'MOTOR_ID', Generator.ORDER_NONE) || null;
29-
const power =Generator.valueToCode(block, 'POWER', Generator.ORDER_NONE) || null;
30-
return `wedo2_set_motor_power(${motor_id}, ${power})\n`;
28+
const motorId = Generator.valueToCode(block, 'MOTOR_ID', Generator.ORDER_NONE) || null;
29+
const power = Generator.valueToCode(block, 'POWER', Generator.ORDER_NONE) || null;
30+
return `wedo2_set_motor_power(${motorId}, ${power})\n`;
3131
};
3232

3333
Generator.wedo2_menu_MOTOR_DIRECTION = function (block) {
34-
const motor_direction = Generator.quote_(Generator.getFieldValue(block, 'MOTOR_DIRECTION') || 'this way');
35-
return [motor_direction, Generator.ORDER_ATOMIC];
34+
const motorDirection = Generator.quote_(Generator.getFieldValue(block, 'MOTOR_DIRECTION') || 'this way');
35+
return [motorDirection, Generator.ORDER_ATOMIC];
3636
};
3737

3838
Generator.wedo2_setMotorDirection = function (block) {
39-
const motor_id = Generator.valueToCode(block, 'MOTOR_ID', Generator.ORDER_NONE) || null;
40-
const motor_direction = Generator.valueToCode(block, 'MOTOR_DIRECTION', Generator.ORDER_NONE) || null;
41-
return `wedo2_set_motor_direction(${motor_id}, ${motor_direction})\n`;
39+
const motorId = Generator.valueToCode(block, 'MOTOR_ID', Generator.ORDER_NONE) || null;
40+
const motorDirection = Generator.valueToCode(block, 'MOTOR_DIRECTION', Generator.ORDER_NONE) || null;
41+
return `wedo2_set_motor_direction(${motorId}, ${motorDirection})\n`;
4242
};
4343

4444
Generator.wedo2_setLightHue = function (block) {
@@ -59,34 +59,34 @@ export default function (Generator) {
5959
};
6060

6161
Generator.wedo2_menu_TILT_DIRECTION_ANY = function (block) {
62-
const tilt_direction_any = Generator.quote_(Generator.getFieldValue(block, 'TILT_DIRECTION_ANY') || 'any');
63-
return [tilt_direction_any, Generator.ORDER_ATOMIC];
62+
const tiltDirectionAny = Generator.quote_(Generator.getFieldValue(block, 'TILT_DIRECTION_ANY') || 'any');
63+
return [tiltDirectionAny, Generator.ORDER_ATOMIC];
6464
};
6565

6666
Generator.wedo2_whenTilted = function (block) {
6767
block.isStatement = true;
68-
const tilt_direction_any = Generator.valueToCode(block, 'TILT_DIRECTION_ANY', Generator.ORDER_NONE) || null;
69-
return `wedo2_when_tilted(${tilt_direction_any}) do\n`;
68+
const tiltDirectionAny = Generator.valueToCode(block, 'TILT_DIRECTION_ANY', Generator.ORDER_NONE) || null;
69+
return `wedo2_when_tilted(${tiltDirectionAny}) do\n`;
7070
};
7171

72-
Generator.wedo2_getDistance = function (block) {
72+
Generator.wedo2_getDistance = function () {
7373
return [`wedo2_distance`, Generator.ORDER_ATOMIC];
7474
};
7575

7676
Generator.wedo2_isTilted = function (block) {
77-
const tilt_direction_any = Generator.valueToCode(block, 'TILT_DIRECTION_ANY', Generator.ORDER_NONE) || null;
78-
return `wedo2_tilted(${tilt_direction_any})\n`;
77+
const tiltDirectionAny = Generator.valueToCode(block, 'TILT_DIRECTION_ANY', Generator.ORDER_NONE) || null;
78+
return `wedo2_tilted(${tiltDirectionAny})\n`;
7979
};
8080

8181
Generator.wedo2_menu_TILT_DIRECTION = function (block) {
82-
const tilt_direction = Generator.quote_(Generator.getFieldValue(block, 'TILT_DIRECTION') || 'up');
83-
return [tilt_direction, Generator.ORDER_ATOMIC];
82+
const tiltDirection = Generator.quote_(Generator.getFieldValue(block, 'TILT_DIRECTION') || 'up');
83+
return [tiltDirection, Generator.ORDER_ATOMIC];
8484
};
8585

8686
Generator.wedo2_getTiltAngle = function (block) {
87-
const tilt_direction = Generator.valueToCode(block, 'TILT_DIRECTION', Generator.ORDER_NONE) || null;
88-
return [`wedo2_tilt_angle(${tilt_direction})`, Generator.ORDER_ATOMIC];
89-
};
87+
const tiltDirection = Generator.valueToCode(block, 'TILT_DIRECTION', Generator.ORDER_NONE) || null;
88+
return [`wedo2_tilt_angle(${tiltDirection})`, Generator.ORDER_ATOMIC];
89+
};
9090

9191
return Generator;
9292
}

src/lib/ruby-to-blocks-converter/ev3.js

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,6 @@
11
/* global Opal */
22
import _ from 'lodash';
33

4-
const RotationStyle = [
5-
'left-right',
6-
'don\'t rotate',
7-
'all around'
8-
];
9-
10-
const Ev3MotorMenu = ['A', 'B', 'C', 'D'];
11-
124
/**
135
* EV3 converter
146
*/

src/lib/ruby-to-blocks-converter/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,7 @@ class RubyToBlocksConverter {
470470

471471
_addNoteInput (block, name, inputValue, shadowValue) {
472472
let shadowBlock;
473-
let opcode = 'note';
473+
const opcode = 'note';
474474
if (!this._isNumber(inputValue)) {
475475
shadowBlock = this._createNoteBlock(opcode, shadowValue);
476476
}

src/lib/ruby-to-blocks-converter/microbit.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import _ from 'lodash';
33

44
const MicroBit = 'microbit';
5+
56
/**
67
* MicroBit converter
78
*/
@@ -79,19 +80,19 @@ const MicroBitConverter = {
7980
}
8081
break;
8182
case 'display':
82-
if (args.length === 5 && args.every((i) => { return this._isString(i); })) {
83+
if (args.length === 5 && args.every(i => this._isString(i))) {
8384
block = this._changeBlock(receiver, 'microbit_displaySymbol', 'statement');
8485
delete this._context.blocks[receiver.inputs.EXPRESSION.block];
8586
delete receiver.inputs.EXPRESSION;
8687

87-
var matrix = '';
88+
let matrix = '';
8889
for (const arg of args) {
89-
matrix += arg;
90-
}
90+
matrix += arg;
91+
}
9192
matrix = matrix.replace(/[1-9]/g, '1').replace(/[^1-9]/g, '0');
9293
this._addFieldInput(
9394
block, 'MATRIX', 'matrix', 'MATRIX',
94-
matrix, null
95+
matrix, null
9596
);
9697
}
9798
break;

src/lib/ruby-to-blocks-converter/music.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ const MusicConverter = {
7171
onOpAsgn: function (lh, operator, rh) {
7272
let block;
7373
if (this._isBlock(lh) && operator === '+' && this._isNumberOrBlock(rh)) {
74-
let xy;
7574
switch (lh.opcode) {
7675
case 'music_getTempo':
7776
block = this._changeBlock(lh, 'music_changeTempo', 'statement');

src/lib/ruby-to-blocks-converter/wedo2.js

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
11
/* global Opal */
22
import _ from 'lodash';
33

4-
const RotationStyle = [
5-
'left-right',
6-
'don\'t rotate',
7-
'all around'
8-
];
9-
104
/**
115
* Wedo2 converter
126
*/

0 commit comments

Comments
 (0)