Lint in block definitions

This commit is contained in:
Rachel Fenichel 2018-05-02 15:58:36 -07:00
parent d656eafad0
commit ab5d4e7b9d
13 changed files with 442 additions and 462 deletions

View file

@ -66,7 +66,8 @@ Blockly.Blocks['dropdown_whenbroadcast'] = {
*/
init: function() {
this.appendDummyInput()
.appendField(new Blockly.FieldIconMenu([
.appendField(new Blockly.FieldIconMenu(
[
{src: Blockly.mainWorkspace.options.pathToMedia + 'icons/event_when-broadcast-received_blue.svg',
value: 'blue', width: 48, height: 48, alt: 'Blue'},
{src: Blockly.mainWorkspace.options.pathToMedia + 'icons/event_when-broadcast-received_green.svg',
@ -127,7 +128,8 @@ Blockly.Blocks['dropdown_broadcast'] = {
*/
init: function() {
this.appendDummyInput()
.appendField(new Blockly.FieldIconMenu([
.appendField(new Blockly.FieldIconMenu(
[
{src: Blockly.mainWorkspace.options.pathToMedia + 'icons/event_broadcast_blue.svg',
value: 'blue', width: 48, height: 48, alt: 'Blue'},
{src: Blockly.mainWorkspace.options.pathToMedia + 'icons/event_broadcast_green.svg',

View file

@ -37,7 +37,8 @@ Blockly.Blocks['dropdown_wedo_setcolor'] = {
*/
init: function() {
this.appendDummyInput()
.appendField(new Blockly.FieldIconMenu([
.appendField(new Blockly.FieldIconMenu(
[
{src: Blockly.mainWorkspace.options.pathToMedia + 'icons/set-led_mystery.svg',
value: 'mystery', width: 48, height: 48, alt: 'Mystery'},
{src: Blockly.mainWorkspace.options.pathToMedia + 'icons/set-led_yellow.svg',
@ -173,7 +174,8 @@ Blockly.Blocks['dropdown_wedo_motorspeed'] = {
*/
init: function() {
this.appendDummyInput()
.appendField(new Blockly.FieldIconMenu([
.appendField(new Blockly.FieldIconMenu(
[
{src: Blockly.mainWorkspace.options.pathToMedia + 'icons/wedo_motor-speed_slow.svg',
value: 'slow', width: 48, height: 48, alt: 'Slow'},
{src: Blockly.mainWorkspace.options.pathToMedia + 'icons/wedo_motor-speed_med.svg',
@ -229,7 +231,8 @@ Blockly.Blocks['dropdown_wedo_whentilt'] = {
*/
init: function() {
this.appendDummyInput()
.appendField(new Blockly.FieldIconMenu([
.appendField(new Blockly.FieldIconMenu(
[
{type: 'placeholder', width: 48, height: 48},
{src: Blockly.mainWorkspace.options.pathToMedia + 'icons/wedo_when-tilt-forward.svg',
value: 'forward', width: 48, height: 48, alt: 'Tilt forward'},

View file

@ -402,8 +402,7 @@ Blockly.Blocks['control_create_clone_of_menu'] = {
* @this Blockly.Block
*/
init: function() {
this.jsonInit(
{
this.jsonInit({
"message0": "%1",
"args0": [
{

View file

@ -160,8 +160,7 @@ Blockly.Blocks['event_broadcast_menu'] = {
* @this Blockly.Block
*/
init: function() {
this.jsonInit(
{
this.jsonInit({
"message0": "%1",
"args0": [
{

View file

@ -190,8 +190,7 @@ Blockly.Blocks['extension_wedo_tilt_menu'] = {
* @this Blockly.Block
*/
init: function() {
this.jsonInit(
{
this.jsonInit({
"message0": "%1",
"args0": [
{

View file

@ -122,8 +122,7 @@ Blockly.Blocks['looks_show'] = {
* @this Blockly.Block
*/
init: function() {
this.jsonInit(
{
this.jsonInit({
"message0": Blockly.Msg.LOOKS_SHOW,
"category": Blockly.Categories.looks,
"extensions": ["colours_looks", "shape_statement"]
@ -137,8 +136,7 @@ Blockly.Blocks['looks_hide'] = {
* @this Blockly.Block
*/
init: function() {
this.jsonInit(
{
this.jsonInit({
"message0": Blockly.Msg.LOOKS_HIDE,
"category": Blockly.Categories.looks,
"extensions": ["colours_looks", "shape_statement"]
@ -154,8 +152,7 @@ Blockly.Blocks['looks_hideallsprites'] = {
* @this Blockly.Block
*/
init: function() {
this.jsonInit(
{
this.jsonInit({
"message0": Blockly.Msg.LOOKS_HIDEALLSPRITES,
"category": Blockly.Categories.looks,
"extensions": ["colours_looks", "shape_statement"]
@ -355,8 +352,7 @@ Blockly.Blocks['looks_costume'] = {
* @this Blockly.Block
*/
init: function() {
this.jsonInit(
{
this.jsonInit({
"message0": "%1",
"args0": [
{
@ -402,8 +398,7 @@ Blockly.Blocks['looks_nextcostume'] = {
* @this Blockly.Block
*/
init: function() {
this.jsonInit(
{
this.jsonInit({
"message0": Blockly.Msg.LOOKS_NEXTCOSTUME,
"category": Blockly.Categories.looks,
"extensions": ["colours_looks", "shape_statement"]
@ -463,8 +458,7 @@ Blockly.Blocks['looks_gotofrontback'] = {
* @this Blockly.Block
*/
init: function() {
this.jsonInit(
{
this.jsonInit({
"message0": Blockly.Msg.LOOKS_GOTOFRONTBACK,
"args0": [
{
@ -586,8 +580,7 @@ Blockly.Blocks['looks_nextbackdrop'] = {
* @this Blockly.Block
*/
init: function() {
this.jsonInit(
{
this.jsonInit({
"message0": Blockly.Msg.LOOKS_NEXTBACKDROP,
"category": Blockly.Categories.looks,
"extensions": ["colours_looks", "shape_statement"]

View file

@ -126,8 +126,7 @@ Blockly.Blocks['motion_pointtowards_menu'] = {
* @this Blockly.Block
*/
init: function() {
this.jsonInit(
{
this.jsonInit({
"message0": "%1",
"args0": [
{
@ -172,8 +171,7 @@ Blockly.Blocks['motion_goto_menu'] = {
* @this Blockly.Block
*/
init: function() {
this.jsonInit(
{
this.jsonInit({
"message0": "%1",
"args0": [
{

View file

@ -34,8 +34,7 @@ Blockly.Blocks['operator_add'] = {
* @this Blockly.Block
*/
init: function() {
this.jsonInit(
{
this.jsonInit({
"message0": Blockly.Msg.OPERATORS_ADD,
"args0": [
{
@ -59,8 +58,7 @@ Blockly.Blocks['operator_subtract'] = {
* @this Blockly.Block
*/
init: function() {
this.jsonInit(
{
this.jsonInit({
"message0": Blockly.Msg.OPERATORS_SUBTRACT,
"args0": [
{
@ -84,8 +82,7 @@ Blockly.Blocks['operator_multiply'] = {
* @this Blockly.Block
*/
init: function() {
this.jsonInit(
{
this.jsonInit({
"message0": Blockly.Msg.OPERATORS_MULTIPLY,
"args0": [
{
@ -109,8 +106,7 @@ Blockly.Blocks['operator_divide'] = {
* @this Blockly.Block
*/
init: function() {
this.jsonInit(
{
this.jsonInit({
"message0": Blockly.Msg.OPERATORS_DIVIDE,
"args0": [
{
@ -134,8 +130,7 @@ Blockly.Blocks['operator_random'] = {
* @this Blockly.Block
*/
init: function() {
this.jsonInit(
{
this.jsonInit({
"message0": Blockly.Msg.OPERATORS_RANDOM,
"args0": [
{
@ -372,8 +367,7 @@ Blockly.Blocks['operator_contains'] = {
* @this Blockly.Block
*/
init: function() {
this.jsonInit(
{
this.jsonInit({
"message0": Blockly.Msg.OPERATORS_CONTAINS,
"args0": [
{
@ -397,8 +391,7 @@ Blockly.Blocks['operator_mod'] = {
* @this Blockly.Block
*/
init: function() {
this.jsonInit(
{
this.jsonInit({
"message0": Blockly.Msg.OPERATORS_MOD,
"args0": [
{
@ -422,8 +415,7 @@ Blockly.Blocks['operator_round'] = {
* @this Blockly.Block
*/
init: function() {
this.jsonInit(
{
this.jsonInit({
"message0": Blockly.Msg.OPERATORS_ROUND,
"args0": [
{
@ -443,8 +435,7 @@ Blockly.Blocks['operator_mathop'] = {
* @this Blockly.Block
*/
init: function() {
this.jsonInit(
{
this.jsonInit({
"message0": Blockly.Msg.OPERATORS_MATHOP,
"args0": [
{

View file

@ -200,7 +200,7 @@ Blockly.ScratchBlocks.ProcedureUtils.removeAllInputs_ = function() {
*/
Blockly.ScratchBlocks.ProcedureUtils.createAllInputs_ = function(connectionMap) {
// Split the proc into components, by %n, %b, and %s (ignoring escaped).
var procComponents = this.procCode_.split(/(?=[^\\]\%[nbs])/);
var procComponents = this.procCode_.split(/(?=[^\\]%[nbs])/);
procComponents = procComponents.map(function(c) {
return c.trim(); // Strip whitespace.
});

View file

@ -54,8 +54,7 @@ Blockly.Blocks['sensing_touchingobjectmenu'] = {
* @this Blockly.Block
*/
init: function() {
this.jsonInit(
{
this.jsonInit({
"message0": "%1",
"args0": [
{
@ -142,8 +141,7 @@ Blockly.Blocks['sensing_distancetomenu'] = {
* @this Blockly.Block
*/
init: function() {
this.jsonInit(
{
this.jsonInit({
"message0": "%1",
"args0": [
{
@ -409,8 +407,7 @@ Blockly.Blocks['sensing_of_object_menu'] = {
* @this Blockly.Block
*/
init: function() {
this.jsonInit(
{
this.jsonInit({
"message0": "%1",
"args0": [
{

View file

@ -33,8 +33,7 @@ Blockly.Blocks['sound_sounds_menu'] = {
* @this Blockly.Block
*/
init: function() {
this.jsonInit(
{
this.jsonInit({
"message0": "%1",
"args0": [
{

View file

@ -226,7 +226,7 @@ Blockly.ScratchBlocks.VerticalExtensions.registerAll = function() {
'sensing', 'pen', 'operators', 'more'];
// Register functions for all category colours.
for (var i = 0; i < categoryNames.length; i++) {
name = categoryNames[i];
var name = categoryNames[i];
Blockly.Extensions.register('colours_' + name,
Blockly.ScratchBlocks.VerticalExtensions.colourHelper(name));
}