52 })
53}
54
55export let imageBlacklist56export const loadImageBlacklist = () => {
57 const rawData = fs.readFileSync('./config/image_blacklist.json')
58 imageBlacklist = JSON.parse(rawData)
22});
23
24/** Redis client. */
25export let redisClient: Redis.RedisClient | undefined;26if (config.has("redis_url")) {
27 redisClient = Redis.createClient({
28 url: config.get("redis_url") as string,
It is recommended not to mutate a name after exporting it. That is to avoid using mutable variable declarator kinds like let
and var
, which can be mutated even after exporting the name. This creates unexpected results when using the name in the module where it is being imported.
This can be unexpected errors like this.
// <!-- utils.js -->
export let magicNumber = 2
magicNumber = 3
And when using this
// <!-- index.js -->
import { magicNumber } from './utils.js;
console.log(magicNumber) // we might be expecting here the value 2, but it would be 3
// <!-- config.js -->
export let retryLimit = 2 // it is recommended to use `const` instead
// <!-- config.js -->
export const retryLimit = 2