forked from OpenWF/SpaceNinjaServer
		
	improve: ensure 'npm run lint' passes without errors (#249)
This commit is contained in:
		
							parent
							
								
									f83f80c991
								
							
						
					
					
						commit
						e3f543d9be
					
				
							
								
								
									
										21
									
								
								.eslintrc
									
									
									
									
									
								
							
							
						
						
									
										21
									
								
								.eslintrc
									
									
									
									
									
								
							@ -4,22 +4,27 @@
 | 
				
			|||||||
        "plugin:@typescript-eslint/recommended",
 | 
					        "plugin:@typescript-eslint/recommended",
 | 
				
			||||||
        "plugin:@typescript-eslint/recommended-requiring-type-checking"
 | 
					        "plugin:@typescript-eslint/recommended-requiring-type-checking"
 | 
				
			||||||
    ],
 | 
					    ],
 | 
				
			||||||
    "plugins": ["@typescript-eslint", "prettier"],
 | 
					    "plugins": ["@typescript-eslint"],
 | 
				
			||||||
    "env": {
 | 
					    "env": {
 | 
				
			||||||
        "browser": true,
 | 
					        "browser": true,
 | 
				
			||||||
        "es6": true,
 | 
					        "es6": true,
 | 
				
			||||||
        "node": true
 | 
					        "node": true
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    "rules": {
 | 
					    "rules": {
 | 
				
			||||||
        "prettier/prettier": "error",
 | 
					 | 
				
			||||||
        "@typescript-eslint/semi": ["error"],
 | 
					        "@typescript-eslint/semi": ["error"],
 | 
				
			||||||
        "@typescript-eslint/explicit-function-return-type": "off",
 | 
					        "@typescript-eslint/explicit-function-return-type": "warn",
 | 
				
			||||||
        "@typescript-eslint/explicit-module-boundary-types": "off",
 | 
					        "@typescript-eslint/explicit-module-boundary-types": "warn",
 | 
				
			||||||
        "@typescript-eslint/restrict-template-expressions": "off",
 | 
					        "@typescript-eslint/restrict-template-expressions": "warn",
 | 
				
			||||||
        "@typescript-eslint/restrict-plus-operands": "off",
 | 
					        "@typescript-eslint/restrict-plus-operands": "warn",
 | 
				
			||||||
        "@typescript-eslint/no-unsafe-member-access": "off",
 | 
					        "@typescript-eslint/no-unsafe-member-access": "warn",
 | 
				
			||||||
        "@typescript-eslint/no-unused-vars": ["error", { "argsIgnorePattern": "^_" }],
 | 
					        "@typescript-eslint/no-unused-vars": ["error", { "argsIgnorePattern": "^_" }],
 | 
				
			||||||
        "no-case-declarations": "off"
 | 
					        "@typescript-eslint/no-misused-promises": "warn",
 | 
				
			||||||
 | 
					        "@typescript-eslint/no-unsafe-argument": "warn",
 | 
				
			||||||
 | 
					        "@typescript-eslint/no-unsafe-call": "warn",
 | 
				
			||||||
 | 
					        "@typescript-eslint/no-unsafe-assignment": "warn",
 | 
				
			||||||
 | 
					        "@typescript-eslint/no-explicit-any": "warn",
 | 
				
			||||||
 | 
					        "@typescript-eslint/no-loss-of-precision": "warn",
 | 
				
			||||||
 | 
					        "no-case-declarations": "warn"
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    "parser": "@typescript-eslint/parser",
 | 
					    "parser": "@typescript-eslint/parser",
 | 
				
			||||||
    "parserOptions": {
 | 
					    "parserOptions": {
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										1
									
								
								.github/workflows/build.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								.github/workflows/build.yml
									
									
									
									
										vendored
									
									
								
							@ -18,3 +18,4 @@ jobs:
 | 
				
			|||||||
            - run: cp config.json.example config.json
 | 
					            - run: cp config.json.example config.json
 | 
				
			||||||
            - run: echo '{"version":"","buildLabel":"","matchmakingBuildId":""}' > static/data/buildConfig.json
 | 
					            - run: echo '{"version":"","buildLabel":"","matchmakingBuildId":""}' > static/data/buildConfig.json
 | 
				
			||||||
            - run: npm run build
 | 
					            - run: npm run build
 | 
				
			||||||
 | 
					            - run: npm run lint
 | 
				
			||||||
 | 
				
			|||||||
@ -1,4 +1,3 @@
 | 
				
			|||||||
import { parseString } from "@/src/helpers/general";
 | 
					 | 
				
			||||||
import { getJSONfromString } from "@/src/helpers/stringHelpers";
 | 
					import { getJSONfromString } from "@/src/helpers/stringHelpers";
 | 
				
			||||||
import { getAccountIdForRequest } from "@/src/services/loginService";
 | 
					import { getAccountIdForRequest } from "@/src/services/loginService";
 | 
				
			||||||
import { upgradeMod } from "@/src/services/inventoryService";
 | 
					import { upgradeMod } from "@/src/services/inventoryService";
 | 
				
			||||||
 | 
				
			|||||||
@ -8,7 +8,6 @@ import { IOid } from "@/src/types/commonTypes";
 | 
				
			|||||||
import { getJSONfromString } from "@/src/helpers/stringHelpers";
 | 
					import { getJSONfromString } from "@/src/helpers/stringHelpers";
 | 
				
			||||||
import { getAccountIdForRequest } from "@/src/services/loginService";
 | 
					import { getAccountIdForRequest } from "@/src/services/loginService";
 | 
				
			||||||
import { getInventory } from "@/src/services/inventoryService";
 | 
					import { getInventory } from "@/src/services/inventoryService";
 | 
				
			||||||
import { IInventoryDatabase } from "@/src/types/inventoryTypes/inventoryTypes";
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
export interface IClaimCompletedRecipeRequest {
 | 
					export interface IClaimCompletedRecipeRequest {
 | 
				
			||||||
    RecipeIds: IOid[];
 | 
					    RecipeIds: IOid[];
 | 
				
			||||||
 | 
				
			|||||||
@ -23,7 +23,7 @@ export const getGuildDojoController: RequestHandler = async (req, res) => {
 | 
				
			|||||||
                CompletionTime: new Date(Date.now())
 | 
					                CompletionTime: new Date(Date.now())
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        ];
 | 
					        ];
 | 
				
			||||||
        guild.save();
 | 
					        await guild.save();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const dojo: IDojoClient = {
 | 
					    const dojo: IDojoClient = {
 | 
				
			||||||
 | 
				
			|||||||
@ -4,7 +4,6 @@ import allShipFeatures from "@/static/fixed_responses/allShipFeatures.json";
 | 
				
			|||||||
import { getAccountIdForRequest } from "@/src/services/loginService";
 | 
					import { getAccountIdForRequest } from "@/src/services/loginService";
 | 
				
			||||||
import { getPersonalRooms } from "@/src/services/personalRoomsService";
 | 
					import { getPersonalRooms } from "@/src/services/personalRoomsService";
 | 
				
			||||||
import { getShip } from "@/src/services/shipService";
 | 
					import { getShip } from "@/src/services/shipService";
 | 
				
			||||||
import { PersonalRooms } from "@/src/models/personalRoomsModel";
 | 
					 | 
				
			||||||
import { Loadout } from "@/src/models/inventoryModels/loadoutModel";
 | 
					import { Loadout } from "@/src/models/inventoryModels/loadoutModel";
 | 
				
			||||||
import { logger } from "@/src/utils/logger";
 | 
					import { logger } from "@/src/utils/logger";
 | 
				
			||||||
import { toOid } from "@/src/helpers/inventoryHelpers";
 | 
					import { toOid } from "@/src/helpers/inventoryHelpers";
 | 
				
			||||||
 | 
				
			|||||||
@ -56,7 +56,7 @@ const inventoryController: RequestHandler = async (request: Request, response: R
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    if (config.unlockAllSkins) {
 | 
					    if (config.unlockAllSkins) {
 | 
				
			||||||
        inventoryResponse.WeaponSkins = [];
 | 
					        inventoryResponse.WeaponSkins = [];
 | 
				
			||||||
        for (let skin of allSkins) {
 | 
					        for (const skin of allSkins) {
 | 
				
			||||||
            inventoryResponse.WeaponSkins.push({
 | 
					            inventoryResponse.WeaponSkins.push({
 | 
				
			||||||
                ItemId: {
 | 
					                ItemId: {
 | 
				
			||||||
                    $oid: "000000000000000000000000"
 | 
					                    $oid: "000000000000000000000000"
 | 
				
			||||||
 | 
				
			|||||||
@ -66,7 +66,7 @@ const loginController: RequestHandler = async (request, response) => {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    if (account.Nonce == 0 || loginRequest.ClientType != "webui") {
 | 
					    if (account.Nonce == 0 || loginRequest.ClientType != "webui") {
 | 
				
			||||||
        account.Nonce = nonce;
 | 
					        account.Nonce = nonce;
 | 
				
			||||||
        account.save();
 | 
					        await account.save();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const { email, password, ...databaseAccount } = account.toJSON();
 | 
					    const { email, password, ...databaseAccount } = account.toJSON();
 | 
				
			||||||
 | 
				
			|||||||
@ -1,14 +1,13 @@
 | 
				
			|||||||
import { RequestHandler } from "express";
 | 
					import { RequestHandler } from "express";
 | 
				
			||||||
import { getAccountIdForRequest } from "@/src/services/loginService";
 | 
					import { getAccountIdForRequest } from "@/src/services/loginService";
 | 
				
			||||||
import { Account } from "@/src/models/loginModel";
 | 
					import { Account } from "@/src/models/loginModel";
 | 
				
			||||||
import { IDatabaseAccountDocument } from "@/src/types/loginTypes";
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
const logoutController: RequestHandler = async (req, res) => {
 | 
					const logoutController: RequestHandler = async (req, res) => {
 | 
				
			||||||
    const accountId = await getAccountIdForRequest(req);
 | 
					    const accountId = await getAccountIdForRequest(req);
 | 
				
			||||||
    const account = await Account.findOne({ _id: accountId });
 | 
					    const account = await Account.findOne({ _id: accountId });
 | 
				
			||||||
    if (account) {
 | 
					    if (account) {
 | 
				
			||||||
        account.Nonce = 0;
 | 
					        account.Nonce = 0;
 | 
				
			||||||
        account.save();
 | 
					        await account.save();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    res.writeHead(200, {
 | 
					    res.writeHead(200, {
 | 
				
			||||||
        "Content-Type": "text/html",
 | 
					        "Content-Type": "text/html",
 | 
				
			||||||
 | 
				
			|||||||
@ -13,7 +13,7 @@ const updateChallengeProgressController: RequestHandler = async (req, res) => {
 | 
				
			|||||||
    const accountId = await getAccountIdForRequest(req);
 | 
					    const accountId = await getAccountIdForRequest(req);
 | 
				
			||||||
    const inventory = await getInventory(accountId);
 | 
					    const inventory = await getInventory(accountId);
 | 
				
			||||||
    addChallenges(inventory, payload.ChallengeProgress);
 | 
					    addChallenges(inventory, payload.ChallengeProgress);
 | 
				
			||||||
    inventory.save();
 | 
					    await inventory.save();
 | 
				
			||||||
    res.status(200).end();
 | 
					    res.status(200).end();
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -15,7 +15,7 @@ export const upgradesController: RequestHandler = async (req, res) => {
 | 
				
			|||||||
            operation.UpgradeRequirement == "/Lotus/Types/Items/MiscItems/ModSlotUnlocker" ||
 | 
					            operation.UpgradeRequirement == "/Lotus/Types/Items/MiscItems/ModSlotUnlocker" ||
 | 
				
			||||||
            operation.UpgradeRequirement == "/Lotus/Types/Items/MiscItems/CustomizationSlotUnlocker"
 | 
					            operation.UpgradeRequirement == "/Lotus/Types/Items/MiscItems/CustomizationSlotUnlocker"
 | 
				
			||||||
        ) {
 | 
					        ) {
 | 
				
			||||||
            updateCurrency(10, true, accountId);
 | 
					            await updateCurrency(10, true, accountId);
 | 
				
			||||||
        } else {
 | 
					        } else {
 | 
				
			||||||
            addMiscItems(inventory, [
 | 
					            addMiscItems(inventory, [
 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
 | 
				
			|||||||
@ -8,7 +8,7 @@ import allScans from "@/static/fixed_responses/allScans.json";
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
const viewController: RequestHandler = async (req, res) => {
 | 
					const viewController: RequestHandler = async (req, res) => {
 | 
				
			||||||
    const accountId = await getAccountIdForRequest(req);
 | 
					    const accountId = await getAccountIdForRequest(req);
 | 
				
			||||||
    const inventory = await Inventory.findOne({ accountOwnerId: req.query.accountId });
 | 
					    const inventory = await Inventory.findOne({ accountOwnerId: accountId });
 | 
				
			||||||
    if (!inventory) {
 | 
					    if (!inventory) {
 | 
				
			||||||
        res.status(400).json({ error: "inventory was undefined" });
 | 
					        res.status(400).json({ error: "inventory was undefined" });
 | 
				
			||||||
        return;
 | 
					        return;
 | 
				
			||||||
 | 
				
			|||||||
@ -1,4 +1,4 @@
 | 
				
			|||||||
import { isString, parseString } from "@/src/helpers/general";
 | 
					import { isString } from "@/src/helpers/general";
 | 
				
			||||||
import { items } from "@/src/services/itemDataService";
 | 
					import { items } from "@/src/services/itemDataService";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export enum ItemType {
 | 
					export enum ItemType {
 | 
				
			||||||
 | 
				
			|||||||
@ -20,9 +20,8 @@ const httpsPort = config.httpsPort || 443;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
// const server = http.createServer(app).listen(80);
 | 
					// const server = http.createServer(app).listen(80);
 | 
				
			||||||
http.createServer(app).listen(httpPort, () => logger.info("HTTP server started on port " + httpPort));
 | 
					http.createServer(app).listen(httpPort, () => logger.info("HTTP server started on port " + httpPort));
 | 
				
			||||||
const server = https
 | 
					const server = https.createServer(options, app);
 | 
				
			||||||
    .createServer(options, app)
 | 
					server.listen(httpsPort, () => logger.info("HTTPS server started on port " + httpsPort));
 | 
				
			||||||
    .listen(httpsPort, () => logger.info("HTTPS server started on port " + httpsPort));
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
// server.keepAliveTimeout = 60 * 1000 + 1000;
 | 
					// server.keepAliveTimeout = 60 * 1000 + 1000;
 | 
				
			||||||
// server.headersTimeout = 60 * 1000 + 2000;
 | 
					// server.headersTimeout = 60 * 1000 + 2000;
 | 
				
			||||||
 | 
				
			|||||||
@ -1016,6 +1016,7 @@ type InventoryDocumentProps = {
 | 
				
			|||||||
    PendingRecipes: Types.DocumentArray<IPendingRecipeDatabase>;
 | 
					    PendingRecipes: Types.DocumentArray<IPendingRecipeDatabase>;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// eslint-disable-next-line @typescript-eslint/ban-types
 | 
				
			||||||
type InventoryModelType = Model<IInventoryDatabase, {}, InventoryDocumentProps>;
 | 
					type InventoryModelType = Model<IInventoryDatabase, {}, InventoryDocumentProps>;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export const Inventory = model<IInventoryDatabase, InventoryModelType>("Inventory", inventorySchema);
 | 
					export const Inventory = model<IInventoryDatabase, InventoryModelType>("Inventory", inventorySchema);
 | 
				
			||||||
 | 
				
			|||||||
@ -89,6 +89,7 @@ type loadoutDocumentProps = {
 | 
				
			|||||||
    DRIFTER: Types.DocumentArray<ILoadoutConfigDatabase>;
 | 
					    DRIFTER: Types.DocumentArray<ILoadoutConfigDatabase>;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// eslint-disable-next-line @typescript-eslint/ban-types
 | 
				
			||||||
type loadoutModelType = Model<ILoadoutDatabase, {}, loadoutDocumentProps>;
 | 
					type loadoutModelType = Model<ILoadoutDatabase, {}, loadoutDocumentProps>;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export const Loadout = model<ILoadoutDatabase, loadoutModelType>("Loadout", loadoutSchema);
 | 
					export const Loadout = model<ILoadoutDatabase, loadoutModelType>("Loadout", loadoutSchema);
 | 
				
			||||||
 | 
				
			|||||||
@ -1,6 +1,7 @@
 | 
				
			|||||||
// Hooks node to support require from "@/" paths for `npm run build && npm run start`.
 | 
					// Hooks node to support require from "@/" paths for `npm run build && npm run start`.
 | 
				
			||||||
// Based on https://github.com/dividab/tsconfig-paths
 | 
					// Based on https://github.com/dividab/tsconfig-paths
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* eslint-disable */
 | 
				
			||||||
const Module = require("module");
 | 
					const Module = require("module");
 | 
				
			||||||
const originalResolveFilename = Module._resolveFilename;
 | 
					const originalResolveFilename = Module._resolveFilename;
 | 
				
			||||||
Module._resolveFilename = function (request: string, _parent: any): string {
 | 
					Module._resolveFilename = function (request: string, _parent: any): string {
 | 
				
			||||||
 | 
				
			|||||||
@ -26,4 +26,5 @@ export type PersonalRoomsDocumentProps = {
 | 
				
			|||||||
    };
 | 
					    };
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// eslint-disable-next-line @typescript-eslint/ban-types
 | 
				
			||||||
export type PersonalRoomsModelType = Model<IPersonalRooms, {}, PersonalRoomsDocumentProps>;
 | 
					export type PersonalRoomsModelType = Model<IPersonalRooms, {}, PersonalRoomsDocumentProps>;
 | 
				
			||||||
 | 
				
			|||||||
@ -80,5 +80,5 @@ export interface IUpgradeOperation {
 | 
				
			|||||||
    UpgradeRequirement: string; // uniqueName of item being consumed
 | 
					    UpgradeRequirement: string; // uniqueName of item being consumed
 | 
				
			||||||
    PolarizeSlot: number;
 | 
					    PolarizeSlot: number;
 | 
				
			||||||
    PolarizeValue: FocusSchool;
 | 
					    PolarizeValue: FocusSchool;
 | 
				
			||||||
    PolarityRemap: {}[];
 | 
					    PolarityRemap: object[];
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user