Resolve "Transition to ESLint"

This commit is contained in:
Thea Schöbl
2022-06-27 14:40:09 +00:00
committed by Rainer Killinger
parent ca1d2444e0
commit 418ba67d15
47 changed files with 1854 additions and 1634 deletions

View File

@@ -24,7 +24,6 @@ const app = express();
/**
* Get port from environment and store in Express.
*/
// tslint:disable-next-line: strict-boolean-expressions
const port = normalizePort(process.env.PORT || '3000');
/**
@@ -42,9 +41,9 @@ server.on('listening', onListening);
* Normalize a port into a number, string, or false.
*/
function normalizePort(value: string) {
const portNumber = parseInt(value, 10);
const portNumber = Number.parseInt(value, 10);
if (isNaN(portNumber)) {
if (Number.isNaN(portNumber)) {
// named pipe
return value;
}
@@ -60,15 +59,12 @@ function normalizePort(value: string) {
/**
* Event listener for HTTP server "error" event.
*/
// tslint:disable-next-line: completed-docs
async function onError(error: { code: string; syscall: string; }) {
async function onError(error: {code: string; syscall: string}) {
if (error.syscall !== 'listen') {
throw error;
}
const bind = typeof port === 'string'
? `Pipe ${port}`
: `Port ${port}`;
const bind = typeof port === 'string' ? `Pipe ${port}` : `Port ${port}`;
// handle specific listen errors with friendly messages
switch (error.code) {
@@ -92,13 +88,10 @@ function onListening() {
const addr = server.address();
if (addr !== null) {
const bind = typeof addr === 'string'
? `pipe ${addr}`
: `port ${addr.port}`;
const bind = typeof addr === 'string' ? `pipe ${addr}` : `port ${addr.port}`;
Logger.ok(`Listening on ${bind}`);
} else {
// tslint:disable-next-line: no-floating-promises
Logger.error(`Failed to start binding`);
void Logger.error(`Failed to start binding`);
}
}
@@ -108,6 +101,6 @@ configureApp(app, {elasticsearch: Elasticsearch})
// After app setup listen on provided port, on all network interfaces
server.listen(port);
})
.catch((err) => {
throw err;
.catch(error => {
throw error;
});