Setup PR check action (#2445) by Bruception

This commit is contained in:
Bruce Berrios 2022-02-08 15:27:14 -05:00 committed by GitHub
parent 43197ea21b
commit f4a9147308
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 253 additions and 505 deletions

View file

@ -20,7 +20,7 @@
],
"plugins": ["json", "require-path-exists"],
"parserOptions": {
"ecmaVersion": 12,
"ecmaVersion": 13,
"sourceType": "module"
},
"rules": {

20
.github/pr-check.yml vendored Normal file
View file

@ -0,0 +1,20 @@
name: PR Check
on:
push:
branches: [master]
pull_request:
branches: [master]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Node.js
uses: actions/setup-node@v1
with:
node-version: "16.13.2"
- run: npm ci
- run: npm run pretty
- run: npm run lint

View file

@ -1,6 +1,5 @@
const _ = require("lodash");
const LeaderboardsDAO = require("../../dao/leaderboards");
const { verifyIdToken } = require("../../handlers/auth");
class LeaderboardsController {
static async get(req, _res) {

View file

@ -1,18 +1,13 @@
const PresetDAO = require("../../dao/preset");
const {
isTagPresetNameValid,
validateConfig,
} = require("../../handlers/validation");
const MonkeyError = require("../../handlers/error");
class PresetController {
static async getPresets(req, res) {
static async getPresets(req, _res) {
const { uid } = req.ctx.decodedToken;
return await PresetDAO.getPresets(uid);
}
static async addPreset(req, res) {
static async addPreset(req, _res) {
const { name, config } = req.body;
const { uid } = req.ctx.decodedToken;

View file

@ -13,6 +13,7 @@ config({ path: path.join(__dirname, ".env") });
let validateResult;
let validateKeys;
try {
// eslint-disable-next-line
let module = require("../../anticheat/anticheat");
validateResult = module.validateResult;
validateKeys = module.validateKeys;

View file

@ -1,9 +1,6 @@
const UsersDAO = require("../../dao/user");
const BotDAO = require("../../dao/bot");
const {
isUsernameValid,
isTagPresetNameValid,
} = require("../../handlers/validation");
const { isUsernameValid } = require("../../handlers/validation");
const MonkeyError = require("../../handlers/error");
const fetch = require("node-fetch");
const Logger = require("./../../handlers/logger.js");

View file

@ -1,24 +1,23 @@
const MonkeyError = require("../handlers/error");
const { mongoDB } = require("../init/mongodb");
async function addCommand(command, arguments) {
async function addCommand(command, commandArguments) {
return await mongoDB().collection("bot-commands").insertOne({
command,
arguments,
arguments: commandArguments,
executed: false,
requestTimestamp: Date.now(),
});
}
async function addCommands(commands, arguments) {
if (commands.length === 0 || commands.length !== arguments.length) {
async function addCommands(commands, commandArguments) {
if (commands.length === 0 || commands.length !== commandArguments.length) {
return [];
}
const normalizedCommands = commands.map((command, index) => {
return {
command,
arguments: arguments[index],
arguments: commandArguments[index],
executed: false,
requestTimestamp: Date.now(),
};

View file

@ -1,4 +1,3 @@
const MonkeyError = require("../handlers/error");
const { mongoDB } = require("../init/mongodb");
class ConfigDAO {

View file

@ -1,6 +1,4 @@
const MonkeyError = require("../handlers/error");
const { mongoDB } = require("../init/mongodb");
const { ObjectID } = require("mongodb");
const Logger = require("../handlers/logger");
const { performance } = require("perf_hooks");

View file

@ -1,7 +1,7 @@
const { mongoDB } = require("../init/mongodb");
class PsaDAO {
static async get(uid, config) {
static async get(_uid, _config) {
return await mongoDB().collection("psa").find().toArray();
}
}

View file

@ -1,4 +1,3 @@
const MonkeyError = require("../handlers/error");
const { mongoDB } = require("../init/mongodb");
class QuoteRatingsDAO {

View file

@ -1,10 +1,11 @@
const uuid = require("uuid");
class MonkeyError {
constructor(status, message, stack = null, uid) {
constructor(status, message, stack = null, uid = null) {
this.status = status ?? 500;
this.errorID = uuid.v4();
this.stack = stack;
this.uid = uid;
// this.message =
// process.env.MODE === "dev"
// ? stack

View file

@ -1,5 +1,4 @@
const { CronJob } = require("cron");
const { mongoDB } = require("../init/mongodb");
const BotDAO = require("../dao/bot");
const LeaderboardsDAO = require("../dao/leaderboards");

View file

@ -27,7 +27,7 @@ async function refactor() {
for (let user of users) {
let obj = user.personalBests;
lbPb = {
let lbPb = {
time: {
15: {},
60: {},

691
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -7,14 +7,16 @@
"start:dev": "concurrently --kill-others \"cd ./frontend && npm run start:dev\" \"cd ./backend && npm run start:dev\"",
"start:dev:be": "cd backend && npm run start:dev",
"start:dev:fe": "cd frontend && npm run start:dev",
"deploy:live": "cd frontend && npm run deploy:live"
"deploy:live": "cd frontend && npm run deploy:live",
"lint": "./node_modules/.bin/eslint './backend/**/*.js' './frontend/src/js/**/*.js'",
"pretty": "prettier --check './backend/**/*.js' './frontend/src/**/*.{js,scss}' './frontend/static/**/*.{json,html}'"
},
"engines": {
"npm": "8.1.2"
},
"devDependencies": {
"concurrently": "5.3.0",
"eslint": "7.28.0",
"eslint": "8.8.0",
"eslint-config-standard": "16.0.3",
"eslint-formatter-github": "1.0.11",
"eslint-plugin-import": "2.23.4",