Skip to content
This repository was archived by the owner on Apr 5, 2025. It is now read-only.

Commit 5998e51

Browse files
style: lint ALL the files
1 parent 47d799b commit 5998e51

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+218
-231
lines changed

src/cache.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@ export default class Cache<T> {
2424
get(): T | undefined {
2525
return this.data;
2626
}
27-
}
27+
}

src/config-manager.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import fs from 'fs-extra';
2-
import mongoose from 'mongoose';
32
import dotenv from 'dotenv';
43
import { LOG_INFO, LOG_WARN, LOG_ERROR } from '@/logger';
5-
import { Config } from '@/types/common/config';
4+
import type mongoose from 'mongoose';
5+
import type { Config } from '@/types/common/config';
66

77
dotenv.config();
88

@@ -72,7 +72,7 @@ if (!config.cdn_url) {
7272

7373
try {
7474
new URL(config.cdn_url);
75-
} catch (e) {
75+
} catch {
7676
LOG_ERROR('Invalid CDN URL, URL must be a valid URL with a protocol (http/https) and domain');
7777
process.exit(0);
7878
}
@@ -138,4 +138,4 @@ if (!config.grpc.account.api_key) {
138138
if (!config.aes_key) {
139139
LOG_ERROR('Token AES key is not set. Set the PN_MIIVERSE_API_CONFIG_AES_KEY environment variable to your AES-256-CBC key');
140140
process.exit(0);
141-
}
141+
}

src/database.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ import { Endpoint } from '@/models/endpoint';
77
import { Post } from '@/models/post';
88
import { Settings } from '@/models/settings';
99
import { config } from '@/config-manager';
10-
import { HydratedCommunityDocument } from '@/types/mongoose/community';
11-
import { HydratedPostDocument, IPost } from '@/types/mongoose/post';
12-
import { HydratedEndpointDocument } from '@/types/mongoose/endpoint';
13-
import { HydratedSettingsDocument } from '@/types/mongoose/settings';
14-
import { HydratedContentDocument } from '@/types/mongoose/content';
15-
import { HydratedConversationDocument } from '@/types/mongoose/conversation';
10+
import type { HydratedConversationDocument } from '@/types/mongoose/conversation';
11+
import type { HydratedContentDocument } from '@/types/mongoose/content';
12+
import type { HydratedSettingsDocument } from '@/types/mongoose/settings';
13+
import type { HydratedEndpointDocument } from '@/types/mongoose/endpoint';
14+
import type { HydratedPostDocument, IPost } from '@/types/mongoose/post';
15+
import type { HydratedCommunityDocument } from '@/types/mongoose/community';
1616

1717
const { mongoose: mongooseConfig } = config;
1818

@@ -176,4 +176,4 @@ export async function getFriendMessages(pid: string, search_key: string[], limit
176176
parent: null,
177177
removed: false
178178
}).sort({ created_at: 1 }).limit(limit);
179-
}
179+
}

src/logger.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,4 @@ export function LOG_INFO(input: string): void {
4444
streams.info.write(`${input}\n`);
4545

4646
console.log(`${input}`.cyan.bold);
47-
}
47+
}

src/middleware/auth.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import express from 'express';
21
import xmlbuilder from 'xmlbuilder';
32
import moment from 'moment';
43
import { z } from 'zod';
5-
import { GetUserDataResponse } from '@pretendonetwork/grpc/account/get_user_data_rpc';
6-
import { getEndpoint, getUserSettings } from '@/database';
74
import { getUserAccountData, getValueFromHeaders, decodeParamPack, getPIDFromServiceToken } from '@/util';
8-
import { HydratedEndpointDocument } from '@/types/mongoose/endpoint';
5+
import { getEndpoint, getUserSettings } from '@/database';
6+
import type express from 'express';
7+
import type { GetUserDataResponse } from '@pretendonetwork/grpc/account/get_user_data_rpc';
8+
import type { HydratedEndpointDocument } from '@/types/mongoose/endpoint';
99

1010
const ParamPackSchema = z.object({
1111
title_id: z.string(),
@@ -112,7 +112,6 @@ async function auth(request: express.Request, response: express.Response, next:
112112
} else {
113113
return badAuth(response, 7, 'PNID_PERM_BAN');
114114
}
115-
116115
}
117116

118117
return next();

src/middleware/client-header.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
1-
import express from 'express';
21
import xmlbuilder from 'xmlbuilder';
32
import { getValueFromHeaders } from '@/util';
3+
import type express from 'express';
44

55
const VALID_CLIENT_ID_SECRET_PAIRS: { [key: string]: string } = {
66
// * 'Key' is the client ID, 'Value' is the client secret
7-
'a2efa818a34fa16b8afbc8a74eba3eda': 'c91cdb5658bd4954ade78533a339cf9a', // * Possibly WiiU exclusive?
8-
'daf6227853bcbdce3d75baee8332b': '3eff548eac636e2bf45bb7b375e7b6b0', // * Possibly 3DS exclusive?
9-
'ea25c66c26b403376b4c5ed94ab9cdea': 'd137be62cb6a2b831cad8c013b92fb55', // * Possibly 3DS exclusive?
7+
a2efa818a34fa16b8afbc8a74eba3eda: 'c91cdb5658bd4954ade78533a339cf9a', // * Possibly WiiU exclusive?
8+
daf6227853bcbdce3d75baee8332b: '3eff548eac636e2bf45bb7b375e7b6b0', // * Possibly 3DS exclusive?
9+
ea25c66c26b403376b4c5ed94ab9cdea: 'd137be62cb6a2b831cad8c013b92fb55' // * Possibly 3DS exclusive?
1010
};
1111

12-
1312
function nintendoClientHeaderCheck(request: express.Request, response: express.Response, next: express.NextFunction): void {
1413
response.type('text/xml');
1514
response.set('Server', 'Nintendo 3DS (http)');
@@ -41,4 +40,4 @@ function nintendoClientHeaderCheck(request: express.Request, response: express.R
4140
return next();
4241
}
4342

44-
export default nintendoClientHeaderCheck;
43+
export default nintendoClientHeaderCheck;

src/models/community.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Schema, model } from 'mongoose';
2-
import { CommunityData } from '@/types/miiverse/community';
3-
import { ICommunity, ICommunityMethods, CommunityModel, ICommunityPermissions, HydratedCommunityDocument } from '@/types/mongoose/community';
2+
import type { CommunityData } from '@/types/miiverse/community';
3+
import type { ICommunity, ICommunityMethods, CommunityModel, ICommunityPermissions, HydratedCommunityDocument } from '@/types/mongoose/community';
44

55
const PermissionsSchema = new Schema<ICommunityPermissions>({
66
open: {
@@ -18,7 +18,7 @@ const PermissionsSchema = new Schema<ICommunityPermissions>({
1818
minimum_new_community_access_level: {
1919
type: Number,
2020
default: 0
21-
},
21+
}
2222
});
2323

2424
const CommunitySchema = new Schema<ICommunity, CommunityModel, ICommunityMethods>({
@@ -54,7 +54,7 @@ const CommunitySchema = new Schema<ICommunity, CommunityModel, ICommunityMethods
5454
owner: Number,
5555
created_at: {
5656
type: Date,
57-
default: new Date(),
57+
default: new Date()
5858
},
5959
empathy_count: {
6060
type: Number,
@@ -120,4 +120,4 @@ CommunitySchema.method<HydratedCommunityDocument>('json', function json(): Commu
120120
};
121121
});
122122

123-
export const Community = model<ICommunity, CommunityModel>('Community', CommunitySchema);
123+
export const Community = model<ICommunity, CommunityModel>('Community', CommunitySchema);

src/models/content.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Schema, model } from 'mongoose';
2-
import { IContent, ContentModel } from '@/types/mongoose/content';
2+
import type { IContent, ContentModel } from '@/types/mongoose/content';
33

44
const ContentSchema = new Schema<IContent, ContentModel>({
55
pid: Number,

src/models/conversation.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Schema, model } from 'mongoose';
22
import { Snowflake } from 'node-snowflake';
3-
import { IConversation, IConversationMethods, ConversationModel, HydratedConversationDocument } from '@/types/mongoose/conversation';
3+
import type { IConversation, IConversationMethods, ConversationModel, HydratedConversationDocument } from '@/types/mongoose/conversation';
44

55
const ConversationSchema = new Schema<IConversation, ConversationModel, IConversationMethods>({
66
id: {
@@ -9,11 +9,11 @@ const ConversationSchema = new Schema<IConversation, ConversationModel, IConvers
99
},
1010
created_at: {
1111
type: Date,
12-
default: new Date(),
12+
default: new Date()
1313
},
1414
last_updated: {
1515
type: Date,
16-
default: new Date(),
16+
default: new Date()
1717
},
1818
message_preview: {
1919
type: String,
@@ -42,4 +42,4 @@ ConversationSchema.method<HydratedConversationDocument>('newMessage', async func
4242
await this.save();
4343
});
4444

45-
export const Conversation = model<IConversation, ConversationModel>('Conversation', ConversationSchema);
45+
export const Conversation = model<IConversation, ConversationModel>('Conversation', ConversationSchema);

src/models/endpoint.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Schema, model } from 'mongoose';
2-
import { IEndpoint, EndpointModel } from '@/types/mongoose/endpoint';
2+
import type { IEndpoint, EndpointModel } from '@/types/mongoose/endpoint';
33

44
const endpointSchema = new Schema<IEndpoint, EndpointModel>({
55
status: Number,

0 commit comments

Comments
 (0)