Add ESLint (#941)
* Add eslint, switch to lint-staged for precommit * Fix all ESLint errors * Update GH workflow to check prettier and eslint
This commit is contained in:
@@ -64,8 +64,8 @@ router.post("/", route({}), async (req: Request, res: Response) => {
|
||||
});
|
||||
|
||||
router.post("/reset", route({}), async (req: Request, res: Response) => {
|
||||
let bot = await User.findOneOrFail({ where: { id: req.params.id } });
|
||||
let owner = await User.findOneOrFail({ where: { id: req.user_id } });
|
||||
const bot = await User.findOneOrFail({ where: { id: req.params.id } });
|
||||
const owner = await User.findOneOrFail({ where: { id: req.user_id } });
|
||||
|
||||
if (owner.id != req.user_id)
|
||||
throw DiscordApiErrors.ACTION_NOT_AUTHORIZED_ON_APPLICATION;
|
||||
@@ -80,7 +80,7 @@ router.post("/reset", route({}), async (req: Request, res: Response) => {
|
||||
|
||||
await bot.save();
|
||||
|
||||
let token = await generateToken(bot.id);
|
||||
const token = await generateToken(bot.id);
|
||||
|
||||
res.json({ token }).status(200);
|
||||
});
|
||||
|
||||
@@ -20,10 +20,8 @@ import { Request, Response, Router } from "express";
|
||||
import { route } from "@fosscord/api";
|
||||
import {
|
||||
Application,
|
||||
OrmUtils,
|
||||
DiscordApiErrors,
|
||||
ApplicationModifySchema,
|
||||
User,
|
||||
} from "@fosscord/util";
|
||||
import { verifyToken } from "node-2fa";
|
||||
import { HTTPError } from "lambert-server";
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
|
||||
import { Request, Response, Router } from "express";
|
||||
import { route } from "@fosscord/api";
|
||||
import { Application, OrmUtils, Team, trimSpecial, User } from "@fosscord/util";
|
||||
|
||||
const router: Router = Router();
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ import {
|
||||
const router: Router = Router();
|
||||
|
||||
router.get("/", route({}), async (req: Request, res: Response) => {
|
||||
let results = await Application.find({
|
||||
const results = await Application.find({
|
||||
where: { owner: { id: req.user_id } },
|
||||
relations: ["owner", "bot"],
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user