Add stricter ESLint rules

This commit is contained in:
Jesse Wierzbinski 2023-09-12 14:29:13 -10:00
parent 887128356e
commit e618996936
No known key found for this signature in database
GPG key ID: F9A1E418934E40B0
18 changed files with 102 additions and 63 deletions

View file

@ -7,20 +7,20 @@ export interface ConfigType {
username: string;
password: string;
database: string;
}
};
http: {
port: number;
base_url: string;
}
[ key: string ]: unknown;
};
[key: string]: unknown;
}
export const getConfig = () => {
return data as ConfigType;
}
};
export const getHost = () => {
const url = new URL(getConfig().http.base_url);
return url.host;
}
};

View file

@ -4,11 +4,11 @@ import { NodeObject } from "jsonld";
export const jsonResponse = (data: object, status = 200) => {
return new Response(JSON.stringify(data), {
headers: {
"Content-Type": "application/json"
"Content-Type": "application/json",
},
status,
});
}
};
export const jsonLdResponse = (data: NodeObject | APObject, status = 200) => {
return new Response(JSON.stringify(data), {
@ -20,7 +20,10 @@ export const jsonLdResponse = (data: NodeObject | APObject, status = 200) => {
};
export const errorResponse = (error: string, status = 500) => {
return jsonResponse({
error: error
}, status);
}
return jsonResponse(
{
error: error,
},
status
);
};