Skip to content

Commit

Permalink
Add some additional formatting rules
Browse files Browse the repository at this point in the history
  • Loading branch information
TomMettam committed Sep 23, 2021
1 parent 50dea8f commit c24dc40
Show file tree
Hide file tree
Showing 100 changed files with 195 additions and 174 deletions.
23 changes: 22 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,28 @@
"error",
"allman"
],
"@typescript-eslint/object-curly-spacing": [
"error",
"always"
],
"@typescript-eslint/space-before-function-paren": [
"error",
"never"
],
"@typescript-eslint/naming-convention": [
"error",
{
"selector": "enumMember",
"format": null
}
],
"@typescript-eslint/keyword-spacing": [
"error",
{
"before": true,
"after": true
}
],
"@angular-eslint/component-class-suffix": "error",
"@angular-eslint/component-selector": [
"error",
Expand Down Expand Up @@ -63,7 +85,6 @@
}
],
"@typescript-eslint/member-ordering": "off",
"@typescript-eslint/naming-convention": "off",
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/no-empty-interface": "error",
"@typescript-eslint/no-inferrable-types": [
Expand Down
2 changes: 1 addition & 1 deletion lib/Bot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ export class Bot

this.lastSuccessfulPing = new Date().getTime();

this.ping = setInterval(async () =>
this.ping = setInterval(async() =>
{
this.pingNumber++;
if (this.pingNumber % 12 === 0 && this.stay)
Expand Down
4 changes: 2 additions & 2 deletions lib/classes/Agent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@ export class Agent
regionAccess: string;
agentAccess: string;
currentRegion: Region;
chatSessions: {[key: string]: {
chatSessions: { [key: string]: {
[key: string]: {
hasVoice: boolean,
isModerator: boolean
}
}} = {};
} } = {};
controlFlags: ControlFlags = 0;
openID: {
'token'?: string,
Expand Down
2 changes: 1 addition & 1 deletion lib/classes/AssetMap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,5 +92,5 @@ export class AssetMap
byUUID: {
[key: string]: InventoryItem
} = {};
pending: {[key: string]: boolean} = {};
pending: { [key: string]: boolean } = {};
}
32 changes: 16 additions & 16 deletions lib/classes/Caps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import * as url from 'url';

export class Caps
{
static CAP_INVOCATION_DELAY_MS: {[key: string]: number} = {
static CAP_INVOCATION_DELAY_MS: { [key: string]: number } = {
'NewFileAgentInventory': 2000,
'FetchInventory2': 200
};
Expand All @@ -24,7 +24,7 @@ export class Caps
private clientEvents: ClientEvents;
private agent: Agent;
private active = false;
private timeLastCapExecuted: {[key: string]: number} = {};
private timeLastCapExecuted: { [key: string]: number } = {};
eventQueueClient: EventQueueClient | null = null;

constructor(agent: Agent, seedURL: string, clientEvents: ClientEvents)
Expand Down Expand Up @@ -209,7 +209,7 @@ export class Caps
}
else
{
resolve({status: res.statusCode, body: body});
resolve({ status: res.statusCode, body: body });
}
});
});
Expand All @@ -236,7 +236,7 @@ export class Caps
}
else
{
resolve({status: res.statusCode, body: body});
resolve({ status: res.statusCode, body: body });
}
});
});
Expand All @@ -258,7 +258,7 @@ export class Caps
}
else
{
resolve({status: res.statusCode, body: body});
resolve({ status: res.statusCode, body: body });
}
});
});
Expand All @@ -280,7 +280,7 @@ export class Caps
}
else
{
resolve({status: res.statusCode, body: body});
resolve({ status: res.statusCode, body: body });
}
});
});
Expand Down Expand Up @@ -403,10 +403,10 @@ export class Caps

capsPerformXMLPost(capURL: string, data: any): Promise<any>
{
return new Promise<any>(async (resolve, reject) =>
return new Promise<any>(async(resolve, reject) =>
{
const xml = LLSD.LLSD.formatXML(data);
this.request(capURL, xml, 'application/llsd+xml').then(async (resp: ICapResponse) =>
this.request(capURL, xml, 'application/llsd+xml').then(async(resp: ICapResponse) =>
{
let result: any = null;
try
Expand Down Expand Up @@ -443,7 +443,7 @@ export class Caps

capsPerformXMLPut(capURL: string, data: any): Promise<any>
{
return new Promise<any>(async (resolve, reject) =>
return new Promise<any>(async(resolve, reject) =>
{
const xml = LLSD.LLSD.formatXML(data);
this.requestPut(capURL, xml, 'application/llsd+xml').then((resp: ICapResponse) =>
Expand Down Expand Up @@ -479,7 +479,7 @@ export class Caps

capsPerformXMLGet(capURL: string): Promise<any>
{
return new Promise<any>(async (resolve, reject) =>
return new Promise<any>(async(resolve, reject) =>
{
this.requestGet(capURL).then((resp: ICapResponse) =>
{
Expand Down Expand Up @@ -512,10 +512,10 @@ export class Caps
});
}

async capsGetXML(capability: string | [string, {[key: string]: string}]): Promise<any>
async capsGetXML(capability: string | [string, { [key: string]: string }]): Promise<any>
{
let capName = '';
let queryParams: {[key: string]: string} = {};
let queryParams: { [key: string]: string } = {};
if (typeof capability === 'string')
{
capName = capability;
Expand Down Expand Up @@ -550,10 +550,10 @@ export class Caps
}
}

async capsPostXML(capability: string | [string, {[key: string]: string}], data: any): Promise<any>
async capsPostXML(capability: string | [string, { [key: string]: string }], data: any): Promise<any>
{
let capName = '';
let queryParams: {[key: string]: string} = {};
let queryParams: { [key: string]: string } = {};
if (typeof capability === 'string')
{
capName = capability;
Expand Down Expand Up @@ -588,10 +588,10 @@ export class Caps
}
}

async capsPutXML(capability: string | [string, {[key: string]: string}], data: any): Promise<any>
async capsPutXML(capability: string | [string, { [key: string]: string }], data: any): Promise<any>
{
let capName = '';
let queryParams: {[key: string]: string} = {};
let queryParams: { [key: string]: string } = {};
if (typeof capability === 'string')
{
capName = capability;
Expand Down
2 changes: 1 addition & 1 deletion lib/classes/Circuit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export class Circuit
return packet.sequenceNumber;
}

private sendXferPacket(xferID: Long, packetID: number, data: Buffer, pos: {position: number}): void
private sendXferPacket(xferID: Long, packetID: number, data: Buffer, pos: { position: number }): void
{
const sendXfer = new SendXferPacketMessage();
let final = false;
Expand Down
2 changes: 1 addition & 1 deletion lib/classes/CoalescedGameObject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,6 @@ export class CoalescedGameObject

async exportXML(rootNode?: string): Promise<string>
{
return (await this.exportXMLElement(rootNode)).end({pretty: true, allowEmpty: true});
return (await this.exportXMLElement(rootNode)).end({ pretty: true, allowEmpty: true });
}
}
6 changes: 3 additions & 3 deletions lib/classes/Inventory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,20 @@ import { InventoryLibrary } from '../enums/InventoryLibrary';
export class Inventory
{
main: {
skeleton: {[key: string]: InventoryFolder},
skeleton: { [key: string]: InventoryFolder },
root?: UUID
} = {
skeleton: {}
};
library: {
owner?: UUID,
skeleton: {[key: string]: InventoryFolder},
skeleton: { [key: string]: InventoryFolder },
root?: UUID
} = {
skeleton: {}
};

itemsByID: {[key: string]: InventoryItem} = {};
itemsByID: { [key: string]: InventoryItem } = {};

// @ts-ignore
private clientEvents: ClientEvents;
Expand Down
2 changes: 1 addition & 1 deletion lib/classes/InventoryFolder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ export class InventoryFolder

private uploadInventoryAssetLegacy(assetType: AssetType, inventoryType: InventoryType, data: Buffer, name: string, description: string, flags: InventoryItemFlags): Promise<UUID>
{
return new Promise<UUID>(async (resolve, reject) =>
return new Promise<UUID>(async(resolve, reject) =>
{
// Send an AssetUploadRequest and a CreateInventoryRequest simultaneously
const msg = new AssetUploadRequestMessage();
Expand Down
12 changes: 6 additions & 6 deletions lib/classes/InventoryItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export class InventoryItem
groupOwned: false
};

static fromAsset(lineObj: {lines: string[], lineNum: number}, container?: GameObject | InventoryFolder, agent?: Agent): InventoryItem
static fromAsset(lineObj: { lines: string[], lineNum: number }, container?: GameObject | InventoryFolder, agent?: Agent): InventoryItem
{
const item: InventoryItem = new InventoryItem(container, agent);
while (lineObj.lineNum < lineObj.lines.length)
Expand Down Expand Up @@ -673,7 +673,7 @@ export class InventoryItem
document.ele('Flags', this.flags);
document.ele('GroupID', this.permissions.group.toString());
document.ele('GroupOwned', this.permissions.groupOwned);
return document.end({pretty: true, allowEmpty: true});
return document.end({ pretty: true, allowEmpty: true });
}

async detachFromAvatar(): Promise<void>
Expand Down Expand Up @@ -760,7 +760,7 @@ export class InventoryItem

rezGroupInWorld(position: Vector3): Promise<GameObject[]>
{
return new Promise<GameObject[]>(async (resolve, reject) =>
return new Promise<GameObject[]>(async(resolve, reject) =>
{
if (this.agent === undefined)
{
Expand Down Expand Up @@ -818,7 +818,7 @@ export class InventoryItem

const gotObjects: GameObject[] = [];

objSub = this.agent.currentRegion.clientEvents.onNewObjectEvent.subscribe(async (evt: NewObjectEvent) =>
objSub = this.agent.currentRegion.clientEvents.onNewObjectEvent.subscribe(async(evt: NewObjectEvent) =>
{
if (evt.createSelected && !evt.object.resolvedAt)
{
Expand Down Expand Up @@ -863,7 +863,7 @@ export class InventoryItem

rezInWorld(position: Vector3, objectScale?: Vector3): Promise<GameObject>
{
return new Promise<GameObject>(async (resolve, reject) =>
return new Promise<GameObject>(async(resolve, reject) =>
{
if (this.agent === undefined)
{
Expand Down Expand Up @@ -932,7 +932,7 @@ export class InventoryItem
}, 10000);
let claimedPrim = false;
const agent = this.agent;
objSub = this.agent.currentRegion.clientEvents.onNewObjectEvent.subscribe(async (evt: NewObjectEvent) =>
objSub = this.agent.currentRegion.clientEvents.onNewObjectEvent.subscribe(async(evt: NewObjectEvent) =>
{
if (evt.createSelected && !evt.object.resolvedAt)
{
Expand Down
2 changes: 1 addition & 1 deletion lib/classes/LLLindenText.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export class LLLindenText
};

body = '';
embeddedItems: {[key: number]: InventoryItem} = {};
embeddedItems: { [key: number]: InventoryItem } = {};

constructor(data?: Buffer)
{
Expand Down
4 changes: 2 additions & 2 deletions lib/classes/LLWearable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ export class LLWearable
{
name: string;
type: WearableType;
parameters: {[key: number]: number} = {};
textures: {[key: number]: UUID} = {};
parameters: { [key: number]: number } = {};
textures: { [key: number]: UUID } = {};
permission: {
baseMask: number,
ownerMask: number,
Expand Down
2 changes: 1 addition & 1 deletion lib/classes/Logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as logger from 'winston';
import * as winston from 'winston';
import * as moment from 'moment';
import * as chalk from 'chalk';
import {TransformableInfo} from 'logform';
import { TransformableInfo } from 'logform';

const formatLevel = function(text: string, level: string): string
{
Expand Down
2 changes: 1 addition & 1 deletion lib/classes/MessageClasses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,7 @@ export * from './messages/JoinGroupRequestExtended';
export * from './messages/CreateGroupRequestExtended';
import { Message } from '../enums/Message';

const messages: {[index: number]: string} = {};
const messages: { [index: number]: string } = {};
messages[<number>Message.TestMessage] = 'TestMessageMessage';
messages[<number>Message.PacketAck] = 'PacketAckMessage';
messages[<number>Message.OpenCircuit] = 'OpenCircuitMessage';
Expand Down
6 changes: 3 additions & 3 deletions lib/classes/ObjectResolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import * as LLSD from '@caspertech/llsd';

export class ObjectResolver
{
private objectsInQueue: {[key: number]: IResolveJob} = {};
private objectsInQueue: { [key: number]: IResolveJob } = {};

private queue: number[] = [];

Expand All @@ -33,7 +33,7 @@ export class ObjectResolver
}

// First, create a map of all object IDs
const objs: {[key: number]: GameObject} = {};
const objs: { [key: number]: GameObject } = {};
const failed: GameObject[] = [];
for (const obj of objects)
{
Expand Down Expand Up @@ -202,7 +202,7 @@ export class ObjectResolver
});
}

private scanObject(obj: GameObject, map: {[key: number]: GameObject}): void
private scanObject(obj: GameObject, map: { [key: number]: GameObject }): void
{
const localID = obj.ID;
if (!map[localID])
Expand Down
Loading

0 comments on commit c24dc40

Please sign in to comment.