mirror of
https://github.com/tdurieux/anonymous_github.git
synced 2026-04-21 21:06:01 +02:00
Set up CI with ESLint linter and Mocha test runner (#661)
This commit is contained in:
@@ -126,7 +126,7 @@ router.get("/repos", async (req, res) => {
|
||||
sort = {};
|
||||
sort[req.query.sort as string] = -1;
|
||||
}
|
||||
let query = [];
|
||||
const query = [];
|
||||
if (req.query.search) {
|
||||
query.push({ repoId: { $regex: req.query.search } });
|
||||
}
|
||||
|
||||
@@ -99,7 +99,7 @@ router.get(
|
||||
);
|
||||
|
||||
function validateNewPullRequest(pullRequestUpdate: any): void {
|
||||
const validCharacters = /^[0-9a-zA-Z\-\_]+$/;
|
||||
const validCharacters = /^[0-9a-zA-Z\-_]+$/;
|
||||
if (
|
||||
!pullRequestUpdate.pullRequestId.match(validCharacters) ||
|
||||
pullRequestUpdate.pullRequestId.length < 3
|
||||
|
||||
@@ -281,7 +281,7 @@ router.get("/:repoId/", async (req: express.Request, res: express.Response) => {
|
||||
});
|
||||
|
||||
function validateNewRepo(repoUpdate: any): void {
|
||||
const validCharacters = /^[0-9a-zA-Z\-\_]+$/;
|
||||
const validCharacters = /^[0-9a-zA-Z\-_]+$/;
|
||||
if (
|
||||
!repoUpdate.repoId.match(validCharacters) ||
|
||||
repoUpdate.repoId.length < 3
|
||||
|
||||
@@ -85,7 +85,7 @@ function printError(error: any, req?: express.Request) {
|
||||
}
|
||||
console.error(message);
|
||||
} else if (error instanceof HTTPError) {
|
||||
let message = `[ERROR] HTTP.${
|
||||
const message = `[ERROR] HTTP.${
|
||||
error.code
|
||||
} ${error.message.toString()} ${error.stack?.split("\n")[1].trim()}`;
|
||||
console.error(message);
|
||||
|
||||
Reference in New Issue
Block a user