Fix various linter errors
This commit is contained in:
14
package-lock.json
generated
14
package-lock.json
generated
@@ -63,6 +63,7 @@
|
||||
"eslint": "^10.0.0",
|
||||
"eventsource": "^4.1.0",
|
||||
"expect.js": "*",
|
||||
"globals": "^17.3.0",
|
||||
"mocha": "^11.7.5",
|
||||
"nock": "^14.0.11",
|
||||
"ssh2": "^1.17.0"
|
||||
@@ -5413,6 +5414,19 @@
|
||||
"node": ">=10.13.0"
|
||||
}
|
||||
},
|
||||
"node_modules/globals": {
|
||||
"version": "17.3.0",
|
||||
"resolved": "https://registry.npmjs.org/globals/-/globals-17.3.0.tgz",
|
||||
"integrity": "sha512-yMqGUQVVCkD4tqjOJf3TnrvaaHDMYp4VlUSObbkIiuCPe/ofdMBFIAcBbCSRFWOnos6qRiTVStDwqPLUclaxIw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/google-auth-library": {
|
||||
"version": "9.8.0",
|
||||
"resolved": "https://registry.npmjs.org/google-auth-library/-/google-auth-library-9.8.0.tgz",
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
"url": "https://git.cloudron.io/platform/box.git"
|
||||
},
|
||||
"dependencies": {
|
||||
"@simplewebauthn/server": "^13.2.2",
|
||||
"@aws-sdk/client-route-53": "^3.990.0",
|
||||
"@aws-sdk/client-s3": "^3.990.0",
|
||||
"@aws-sdk/lib-storage": "^3.990.0",
|
||||
@@ -23,6 +22,7 @@
|
||||
"@cloudron/superagent": "^1.0.1",
|
||||
"@google-cloud/dns": "^5.3.1",
|
||||
"@google-cloud/storage": "^7.19.0",
|
||||
"@simplewebauthn/server": "^13.2.2",
|
||||
"@smithy/node-http-handler": "^4.4.10",
|
||||
"@smithy/util-retry": "^4.2.8",
|
||||
"@types/node": "^25.2.3",
|
||||
@@ -68,6 +68,7 @@
|
||||
"eslint": "^10.0.0",
|
||||
"eventsource": "^4.1.0",
|
||||
"expect.js": "*",
|
||||
"globals": "^17.3.0",
|
||||
"mocha": "^11.7.5",
|
||||
"nock": "^14.0.11",
|
||||
"ssh2": "^1.17.0"
|
||||
|
||||
@@ -208,7 +208,7 @@ async function cleanupMissingBackups(site, progressCallback) {
|
||||
|
||||
if (constants.TEST) return missingBackupPaths;
|
||||
|
||||
let page = 1, result = [];
|
||||
let page = 1, result;
|
||||
do {
|
||||
result = await backups.listByTypePaged(backups.BACKUP_TYPE_BOX, site.id, page, perPage);
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ async function addFile(sourceFile, encryption, uploader, progressCallback) {
|
||||
const hash = new HashStream();
|
||||
const destStream = uploader.createStream();
|
||||
|
||||
let pipeline = null;
|
||||
let pipeline;
|
||||
if (encryption) {
|
||||
const encryptStream = new EncryptStream(encryption);
|
||||
pipeline = safe(stream.pipeline(sourceStream, encryptStream, ps, hash, destStream));
|
||||
|
||||
@@ -152,7 +152,7 @@ async function tarPack(dataLayout, encryption, uploader, progressCallback) {
|
||||
const hash = new HashStream();
|
||||
const destStream = uploader.createStream();
|
||||
|
||||
let pipeline = null;
|
||||
let pipeline;
|
||||
if (encryption) {
|
||||
const encryptStream = new EncryptStream(encryption);
|
||||
pipeline = safe(stream.pipeline(pack, gzip, encryptStream, ps, hash, destStream));
|
||||
|
||||
@@ -62,7 +62,7 @@ async function getZoneRecords(domainConfig, zoneName, name, type) {
|
||||
|
||||
const zoneId = await getZoneId(domainConfig, zoneName);
|
||||
|
||||
let page = 0, more = false;
|
||||
let page = 0, more;
|
||||
let records = [];
|
||||
|
||||
do {
|
||||
|
||||
@@ -43,7 +43,7 @@ class LogStream extends TransformStream {
|
||||
|
||||
_transform(chunk, encoding, callback) {
|
||||
const data = this._soFar + this._decoder.write(chunk);
|
||||
let start = this._soFar.length, end = -1;
|
||||
let start = this._soFar.length, end;
|
||||
while ((end = data.indexOf('\n', start)) !== -1) {
|
||||
const line = data.slice(start, end); // does not include end
|
||||
this.push(this._format(line));
|
||||
|
||||
@@ -10,6 +10,7 @@ import network from './network.js';
|
||||
import os from 'node:os';
|
||||
import { Readable } from 'node:stream';
|
||||
import safe from 'safetydance';
|
||||
import services from './services.js';
|
||||
import shellModule from './shell.js';
|
||||
import superagent from '@cloudron/superagent';
|
||||
import _ from './underscore.js';
|
||||
@@ -214,7 +215,7 @@ async function sendToGraphite() {
|
||||
// the datapoint is (value, timestamp) https://graphite.readthedocs.io/en/latest/
|
||||
async function getGraphiteUrl() {
|
||||
const [error, result] = await safe(docker.inspect('graphite'));
|
||||
if (error && error.reason === BoxError.NOT_FOUND) return { status: SERVICE_STATUS_STOPPED };
|
||||
if (error && error.reason === BoxError.NOT_FOUND) return { status: services.SERVICE_STATUS_STOPPED };
|
||||
if (error) throw error;
|
||||
|
||||
const ip = safe.query(result, 'NetworkSettings.Networks.cloudron.IPAddress', null);
|
||||
|
||||
@@ -2,7 +2,6 @@ import assert from 'node:assert';
|
||||
import AuditSource from './auditsource.js';
|
||||
import BoxError from './boxerror.js';
|
||||
import changelog from './changelog.js';
|
||||
import constants from './constants.js';
|
||||
import dashboard from './dashboard.js';
|
||||
import database from './database.js';
|
||||
import debugModule from 'debug';
|
||||
|
||||
@@ -317,7 +317,7 @@ async function renderInteractionPage(req, res) {
|
||||
|
||||
return res.send(ejs.render(TEMPLATE_LOGIN, data));
|
||||
} else if (prompt.name === 'consent') {
|
||||
let hasAccess = false;
|
||||
let hasAccess;
|
||||
|
||||
const data = {
|
||||
iconUrl: '/api/v1/cloudron/avatar',
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -5,7 +5,6 @@ import common from './common.js';
|
||||
import constants from '../../constants.js';
|
||||
import expect from 'expect.js';
|
||||
import nock from 'nock';
|
||||
import settings from '../../settings.js';
|
||||
import superagent from '@cloudron/superagent';
|
||||
|
||||
/* global describe:false */
|
||||
|
||||
@@ -143,7 +143,6 @@ describe('Cloudron', function () {
|
||||
const email = 'setup3@account.com';
|
||||
const password = 'test?!3434543534';
|
||||
const username = 'setupuser3';
|
||||
const displayName = 'setup user3';
|
||||
|
||||
const response0 = await superagent.post(`${serverUrl}/api/v1/user_directory/profile_config`)
|
||||
.query({ access_token: owner.token })
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
/* jslint node:true */
|
||||
|
||||
import common from './common.js';
|
||||
import constants from '../../constants.js';
|
||||
import expect from 'expect.js';
|
||||
import superagent from '@cloudron/superagent';
|
||||
|
||||
|
||||
@@ -383,13 +383,11 @@ describe('Users API', function () {
|
||||
});
|
||||
|
||||
it('can change avatar', async function () {
|
||||
let customAvatarSize = 0;
|
||||
|
||||
const response = await superagent.post(`${serverUrl}/api/v1/users/${user2.id}/avatar`)
|
||||
.query({ access_token: owner.token })
|
||||
.attach('avatar', './logo.png');
|
||||
|
||||
customAvatarSize = fs.readFileSync('./logo.png').length;
|
||||
const customAvatarSize = fs.readFileSync('./logo.png').length;
|
||||
|
||||
expect(response.status).to.equal(204);
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@ describe('Volumes API', function () {
|
||||
});
|
||||
|
||||
it('cannot update volume', async function () {
|
||||
const [error, response] = await safe(superagent.post(`${serverUrl}/api/v1/volumes/${volumeId}`)
|
||||
const [, response] = await safe(superagent.post(`${serverUrl}/api/v1/volumes/${volumeId}`)
|
||||
.query({ access_token: owner.token })
|
||||
.send({ mountOptions: { hostPath: '/media/cloudron-test-music-2' }})
|
||||
.ok(() => true));
|
||||
|
||||
@@ -2017,6 +2017,17 @@ const ADDONS = {
|
||||
}
|
||||
};
|
||||
|
||||
async function importAppDatabase(app, addon) {
|
||||
assert.strictEqual(typeof app, 'object');
|
||||
assert.strictEqual(typeof addon, 'string');
|
||||
|
||||
if (!(addon in ADDONS)) throw new BoxError(BoxError.NOT_FOUND, `No such addon: ${addon}`);
|
||||
|
||||
await ADDONS[addon].setup(app, app.manifest.addons[addon]);
|
||||
await ADDONS[addon].clear(app, app.manifest.addons[addon]); // clear in case we crashed in a restore
|
||||
await ADDONS[addon].restore(app, app.manifest.addons[addon]);
|
||||
}
|
||||
|
||||
async function setupAddons(app, addons) {
|
||||
assert.strictEqual(typeof app, 'object');
|
||||
assert(!addons || typeof addons === 'object');
|
||||
|
||||
@@ -271,7 +271,7 @@ class S3MultipartDownloadStream extends Readable {
|
||||
}
|
||||
|
||||
_nextDownload() {
|
||||
let len = 0;
|
||||
let len;
|
||||
if (this._readSize + this._blockSize < this._fileSize) {
|
||||
len = this._blockSize;
|
||||
} else {
|
||||
|
||||
@@ -194,7 +194,7 @@ async function startTask(id, options) {
|
||||
assert.ok(sudoError, 'sudo should have errored because task did not complete!');
|
||||
|
||||
// taskworker.sh forwards the exit code of the actual worker. It's either a raw signal number OR the exit code
|
||||
let taskError = null;
|
||||
let taskError;
|
||||
if (sudoError.timedOut) taskError = { message: `Task ${id} timed out`, code: ETIMEOUT };
|
||||
else if (sudoError.code === 70) taskError = { message: `Task ${id} stopped`, code: ESTOPPED }; // set by taskworker SIGTERM
|
||||
else if (sudoError.code === 9 /* SIGKILL */) taskError = { message: `Task ${id} ran out of memory or terminated`, code: ECRASHED }; // SIGTERM with oom gets set as 2 by nodejs
|
||||
|
||||
@@ -4,7 +4,6 @@ import DataLayout from '../datalayout.js';
|
||||
import expect from 'expect.js';
|
||||
|
||||
/* global describe:false */
|
||||
/* global before:false */
|
||||
|
||||
describe('DataLayout', function () {
|
||||
describe('no dirMap', function () {
|
||||
|
||||
@@ -280,7 +280,8 @@ describe('Syncer', function () {
|
||||
});
|
||||
|
||||
const dataLayout = new DataLayout(gTmpDir, []);
|
||||
let changes = await getChanges(dataLayout);
|
||||
let changes;
|
||||
await getChanges(dataLayout);
|
||||
|
||||
execSync(`rm a; \
|
||||
mkdir a; \
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* global it, describe, before, after */
|
||||
/* global it, describe */
|
||||
|
||||
import expect from 'expect.js';
|
||||
import _ from '../underscore.js';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* global it, describe, before, after */
|
||||
/* global it, describe */
|
||||
|
||||
import expect from 'expect.js';
|
||||
import validator from '../validator.js';
|
||||
|
||||
@@ -600,7 +600,7 @@ async function verify(user, password, identifier, options) {
|
||||
return user;
|
||||
}
|
||||
|
||||
let localTotpCheck = true; // does 2fa need to be verified with local database 2fa creds
|
||||
let localTotpCheck; // does 2fa need to be verified with local database 2fa creds
|
||||
if (user.source === 'ldap') {
|
||||
await externalLdap.verifyPassword(user.username, password, options);
|
||||
const externalLdapConfig = await externalLdap.getConfig();
|
||||
|
||||
Reference in New Issue
Block a user