Revert "Add no-use-before-define linter rule"

This reverts commit fdcc5d68a2.

Unfortunately, this requires us to move exports to the bottom.
This in turn causes circular dep issues and also access of
exports.GLOBAL_VAR in the global context
This commit is contained in:
Girish Ramakrishnan
2025-10-08 20:11:55 +02:00
parent a5224258c3
commit 43e426ab9f
41 changed files with 718 additions and 681 deletions
+49 -48
View File
@@ -1,5 +1,54 @@
'use strict';
exports = module.exports = {
get,
add,
update,
setCompleted,
setCompletedByType,
list,
getLogs,
startTask,
stopTask,
stopAllTasks,
removePrivateFields,
_del: del,
// task types. if you add a task here, fill up the function table in taskworker and dashboard constants.js
// '_' prefix is removed for lookup
TASK_APP: 'app',
// "prefix" allows us to locate the tasks of a specific app or backup site
TASK_APP_BACKUP_PREFIX: 'appBackup_',
TASK_FULL_BACKUP_PREFIX: 'backup_', // full backup
TASK_CLEAN_BACKUPS_PREFIX: 'cleanBackups_',
TASK_BOX_UPDATE: 'boxUpdate',
TASK_CHECK_CERTS: 'checkCerts',
TASK_SYNC_DYNDNS: 'syncDyndns',
TASK_PREPARE_DASHBOARD_LOCATION: 'prepareDashboardLocation',
TASK_SYNC_EXTERNAL_LDAP: 'syncExternalLdap',
TASK_CHANGE_MAIL_LOCATION: 'changeMailLocation',
TASK_SYNC_DNS_RECORDS: 'syncDnsRecords',
TASK_CHECK_BACKUP_INTEGRITY: 'checkBackupIntegrity',
// error codes
ESTOPPED: 'stopped',
ECRASHED: 'crashed',
ETIMEOUT: 'timeout',
// testing
_TASK_IDENTITY: 'identity',
_TASK_CRASH: 'crash',
_TASK_ERROR: 'error',
_TASK_SLEEP: 'sleep'
};
const assert = require('node:assert'),
BoxError = require('./boxerror.js'),
database = require('./database.js'),
@@ -243,51 +292,3 @@ async function del(id) {
if (result.affectedRows !== 1) throw new BoxError(BoxError.NOT_FOUND, 'Task not found');
}
exports = module.exports = {
get,
add,
update,
setCompleted,
setCompletedByType,
list,
getLogs,
startTask,
stopTask,
stopAllTasks,
removePrivateFields,
_del: del,
// task types. if you add a task here, fill up the function table in taskworker and dashboard constants.js
// '_' prefix is removed for lookup
TASK_APP: 'app',
// "prefix" allows us to locate the tasks of a specific app or backup site
TASK_APP_BACKUP_PREFIX: 'appBackup_',
TASK_FULL_BACKUP_PREFIX: 'backup_', // full backup
TASK_CLEAN_BACKUPS_PREFIX: 'cleanBackups_',
TASK_BOX_UPDATE: 'boxUpdate',
TASK_CHECK_CERTS: 'checkCerts',
TASK_SYNC_DYNDNS: 'syncDyndns',
TASK_PREPARE_DASHBOARD_LOCATION: 'prepareDashboardLocation',
TASK_SYNC_EXTERNAL_LDAP: 'syncExternalLdap',
TASK_CHANGE_MAIL_LOCATION: 'changeMailLocation',
TASK_SYNC_DNS_RECORDS: 'syncDnsRecords',
TASK_CHECK_BACKUP_INTEGRITY: 'checkBackupIntegrity',
// error codes
ESTOPPED: 'stopped',
ECRASHED: 'crashed',
ETIMEOUT: 'timeout',
// testing
_TASK_IDENTITY: 'identity',
_TASK_CRASH: 'crash',
_TASK_ERROR: 'error',
_TASK_SLEEP: 'sleep'
};