Unexpected string concatenation
12 const apiKeyHeaderValue = req.headers.get("ApiKey");
13 let session: Session | null;
14
15 logger.info("Creating OpenAPI fetch handler for user " + (apiKeyHeaderValue ? 'with an api key' : 'without an api key'));16
17 if (apiKeyHeaderValue !== null) {
18 const apiKeyFromDb = await db.query.apiKeys.findFirst({
Description
In ES2015 (ES6), we can use template literals instead of string concatenation.
var str = `Hello, ${name}!`;
Bad Practice
var str = "Hello, " + name + "!";
var str = "Time: " + (12 * 60 * 60 * 1000);
Recommended
var str = "Hello World!";
var str = `Hello, ${name}!`;
var str = `Time: ${12 * 60 * 60 * 1000}`;
var str = "Hello, " + "World!";