Formatter

This commit is contained in:
Neil Fraser
2024-03-26 09:19:07 +01:00
parent 1d4eafcd3b
commit b000e06932
3 changed files with 12 additions and 6 deletions
+5 -2
View File
@@ -43,7 +43,7 @@ export const TEST_ONLY = {typeMap};
* This enables an error to be thrown if a name of conflicting case is used.
*/
const noCaseNameMap: {
[key: string]: {[key: string]: string}
[key: string]: {[key: string]: string};
} = Object.create(null);
/**
@@ -168,7 +168,10 @@ export function register<T>(
* @param registryItem A class or object that we are checking for the required
* properties.
*/
function validateItem(type: string, registryItem: Function | AnyDuringMigration) {
function validateItem(
type: string,
registryItem: Function | AnyDuringMigration,
) {
switch (type) {
case String(Type.FIELD):
if (typeof registryItem.fromJson !== 'function') {
+4 -1
View File
@@ -76,7 +76,10 @@ export class CollapsibleToolboxCategory
// Separators can exist as either a flyout item or a toolbox item so
// decide where it goes based on the type of the previous item.
if (
!registry.hasItem(registry.Type.TOOLBOX_ITEM, itemDef['kind'].toLowerCase()) ||
!registry.hasItem(
registry.Type.TOOLBOX_ITEM,
itemDef['kind'].toLowerCase(),
) ||
(itemDef['kind'].toLowerCase() ===
ToolboxSeparator.registrationName &&
prevIsFlyoutItem)
+3 -3
View File
@@ -93,7 +93,7 @@ suite('Registry', function () {
suite('Name normalization', function () {
test('Padded', function () {
chai.assert.isTrue(
Blockly.registry.hasItem(' test ', ' test_name ')
Blockly.registry.hasItem(' test ', ' test_name '),
);
});
@@ -143,7 +143,7 @@ suite('Registry', function () {
suite('Name normalization', function () {
test('Padded', function () {
chai.assert.isNotNull(
Blockly.registry.getClass(' test ', ' test_name' )
Blockly.registry.getClass(' test ', ' test_name'),
);
});
@@ -193,7 +193,7 @@ suite('Registry', function () {
suite('Name normalization', function () {
test('Padded', function () {
chai.assert.isNotNull(
Blockly.registry.getObject(' test ', ' test_name ')
Blockly.registry.getObject(' test ', ' test_name '),
);
});