14declare global {
15 // allow global `var` declarations
16 // eslint-disable-next-line no-var
17 var prisma: PrismaClient<typeof clientOptions> | undefined18}
19
20const clientOptions = {
26 global.crowdinOta = crowdinOta
27}
28declare global {
29 var crowdinOta: OtaClient | undefined30}
31const { crowdinDistTimestamp, fetchCrowdinDbKey, fetchCrowdinFile } = createCommonFns(crowdinOta)
32
22 global.crowdinEdgeOta = crowdinEdgeOta
23}
24declare global {
25 var crowdinEdgeOta: OtaClient | undefined26}
27
28const { crowdinDistTimestamp, fetchCrowdinDbKey, fetchCrowdinFile } = createCommonFns(crowdinEdgeOta)
17 global.crowdinApi = crowdinApi
18}
19declare global {
20 var crowdinApi: Crowdin | undefined21}
22export const { getStringIdByKey } = createCommonFns(crowdinApi)
23export { branches, sourceFiles, projectId } from '../constants'
17 global.crowdinEdge = crowdinEdge
18}
19declare global {
20 var crowdinEdge: Crowdin | undefined21}
22export const { getStringIdByKey } = createCommonFns(crowdinEdge)
23export { branches, sourceFiles, projectId } from '../constants'
Declare variables at the top of their scope as it improves code readability, performance and also helps in code navigation.
The vars-on-top
rule generates warnings when variable declarations are not used serially at the top of a function scope or the top of a program. By default variable declarations are always moved (“hoisted”) invisibly to the top of their containing scope by the JavaScript interpreter. This rule forces the programmer to represent that behavior by manually moving the variable declaration to the top of its containing scope.
// Variable declarations in a block:
function doSomething() {
var first;
if (true) {
first = true;
}
var second;
}
// Variable declaration in for initializer:
function doSomething() {
for (var i=0; i<10; i++) {}
}
function doSomething() {
var first;
var second; //multiple declarations are allowed at the top
if (true) {
first = true;
}
}
function doSomething() {
var i;
for (i=0; i<10; i++) {}
}