diff --git a/.eslintrc.js b/.eslintrc.js index 523d0fb26..209a4718e 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -49,13 +49,10 @@ module.exports = { // TODO remove these exceptions from the eslint defaults 'no-irregular-whitespace': ['off'], - 'no-unused-vars': ['warn'], 'no-self-assign': ['off'], 'no-empty': ['off'], 'no-useless-escape': ['off'], - 'no-redeclare': ['off'], 'no-extra-boolean-cast': ['off'], - 'no-global-assign': ['off'], 'no-prototype-builtins': ['off'], } }; diff --git a/config/config.example.js b/config/config.example.js index 371640fb7..63a75f059 100644 --- a/config/config.example.js +++ b/config/config.example.js @@ -2,8 +2,6 @@ // // SPDX-License-Identifier: AGPL-3.0-or-later -/* globals module */ - /* DISCLAIMER: There are two recommended methods of running a CryptPad instance: diff --git a/customize.dist/src/less2/include/toolbar.less b/customize.dist/src/less2/include/toolbar.less index 7a1690900..76333017b 100644 --- a/customize.dist/src/less2/include/toolbar.less +++ b/customize.dist/src/less2/include/toolbar.less @@ -81,7 +81,7 @@ outline: @cryptpad_color_brand solid 2px; } } - button:nth-of-type(1){ + button:nth-of-type(1) { margin-left: 0.3rem; } } diff --git a/lib/challenge-commands/totp.js b/lib/challenge-commands/totp.js index ca44e0010..a4ecfaa06 100644 --- a/lib/challenge-commands/totp.js +++ b/lib/challenge-commands/totp.js @@ -2,7 +2,6 @@ // // SPDX-License-Identifier: AGPL-3.0-or-later -/* globals Buffer */ const B32 = require("thirty-two"); const OTP = require("notp"); const nThen = require("nthen"); diff --git a/lib/commands/admin-rpc.js b/lib/commands/admin-rpc.js index 954c1c4c1..bce956147 100644 --- a/lib/commands/admin-rpc.js +++ b/lib/commands/admin-rpc.js @@ -2,7 +2,6 @@ // // SPDX-License-Identifier: AGPL-3.0-or-later -/* globals process */ const nThen = require("nthen"); const getFolderSize = require("get-folder-size"); const Util = require("../common-util"); diff --git a/lib/commands/block.js b/lib/commands/block.js index 1d64364df..c1bee1d65 100644 --- a/lib/commands/block.js +++ b/lib/commands/block.js @@ -2,7 +2,6 @@ // // SPDX-License-Identifier: AGPL-3.0-or-later -/* globals Buffer*/ const Block = module.exports; const Nacl = require("tweetnacl/nacl-fast"); const nThen = require("nthen"); diff --git a/lib/commands/core.js b/lib/commands/core.js index 79f3f40e8..6c92af74f 100644 --- a/lib/commands/core.js +++ b/lib/commands/core.js @@ -2,7 +2,6 @@ // // SPDX-License-Identifier: AGPL-3.0-or-later -/* globals process */ const Core = module.exports; const Util = require("../common-util"); const escapeKeyCharacters = Util.escapeKeyCharacters; diff --git a/lib/commands/quota.js b/lib/commands/quota.js index 7a92dbda9..4c068fad0 100644 --- a/lib/commands/quota.js +++ b/lib/commands/quota.js @@ -2,7 +2,6 @@ // // SPDX-License-Identifier: AGPL-3.0-or-later -/* globals Buffer*/ const Quota = module.exports; //const Util = require("../common-util"); diff --git a/lib/decrees.js b/lib/decrees.js index 79a978398..317d492df 100644 --- a/lib/decrees.js +++ b/lib/decrees.js @@ -169,6 +169,7 @@ var isInteger = function (n) { var args_isString = function (args) { return !(!Array.isArray(args) || !isString(args[0])); }; + var args_isInteger = function (args) { return !(!Array.isArray(args) || !isInteger(args[0])); }; @@ -211,10 +212,6 @@ commands.SET_ARCHIVE_RETENTION_TIME = makeIntegerSetter('archiveRetentionTime'); // CryptPad_AsyncStore.rpc.send('ADMIN', [ 'ADMIN_DECREE', ['SET_ACCOUNT_RETENTION_TIME', [365]]], console.log) commands.SET_ACCOUNT_RETENTION_TIME = makeIntegerSetter('accountRetentionTime'); -var args_isString = function (args) { - return Array.isArray(args) && typeof(args[0]) === "string"; -}; - // CryptPad_AsyncStore.rpc.send('ADMIN', [ 'ADMIN_DECREE', ['SET_ADMIN_EMAIL', ['admin@website.tld']]], console.log) commands.SET_ADMIN_EMAIL = makeGenericSetter('adminEmail', args_isString); diff --git a/lib/env.js b/lib/env.js index 1a8b3917e..d3748750f 100644 --- a/lib/env.js +++ b/lib/env.js @@ -2,8 +2,6 @@ // // SPDX-License-Identifier: AGPL-3.0-or-later -/* globals process */ - const { existsSync, readdirSync } = require('node:fs'); const Crypto = require('crypto'); diff --git a/lib/hk-util.js b/lib/hk-util.js index da0a63ab8..7080d3d4a 100644 --- a/lib/hk-util.js +++ b/lib/hk-util.js @@ -2,7 +2,6 @@ // // SPDX-License-Identifier: AGPL-3.0-or-later -/* global Buffer */ var HK = module.exports; const nThen = require('nthen'); diff --git a/lib/log.js b/lib/log.js index c5b27fb85..c0a825daf 100644 --- a/lib/log.js +++ b/lib/log.js @@ -39,8 +39,6 @@ var handlers = {}; handlers[level] = function (ctx, content) { console.error(content); }; }); -var noop = function () {}; - var createLogType = function (ctx, type) { if (logLevels.indexOf(type) < logLevels.indexOf(ctx.logLevel)) { return noop; diff --git a/lib/storage/blob.js b/lib/storage/blob.js index b029b95c5..aeb9c1f70 100644 --- a/lib/storage/blob.js +++ b/lib/storage/blob.js @@ -2,7 +2,6 @@ // // SPDX-License-Identifier: AGPL-3.0-or-later -/* globals Buffer */ var Fs = require("fs"); var Fse = require("fs-extra"); var Path = require("path"); diff --git a/lib/storage/file.js b/lib/storage/file.js index d8617f300..2c2888f7a 100644 --- a/lib/storage/file.js +++ b/lib/storage/file.js @@ -3,7 +3,6 @@ // SPDX-License-Identifier: AGPL-3.0-or-later /*@flow*/ -/* globals Buffer */ var Fs = require("fs"); var Fse = require("fs-extra"); var Path = require("path"); diff --git a/lib/stream-file.js b/lib/stream-file.js index 372148836..18e691373 100644 --- a/lib/stream-file.js +++ b/lib/stream-file.js @@ -2,8 +2,6 @@ // // SPDX-License-Identifier: AGPL-3.0-or-later -/* global Buffer */ - const ToPull = require('stream-to-pull-stream'); const Pull = require('pull-stream'); diff --git a/lib/workers/db-worker.js b/lib/workers/db-worker.js index 9878d2c22..63b2a8497 100644 --- a/lib/workers/db-worker.js +++ b/lib/workers/db-worker.js @@ -2,8 +2,6 @@ // // SPDX-License-Identifier: AGPL-3.0-or-later -/* globals process, Buffer */ - const HK = require("../hk-util"); const Store = require("../storage/file"); const BlobStore = require("../storage/blob"); diff --git a/lib/workers/index.js b/lib/workers/index.js index 6db3f8bbd..55487c848 100644 --- a/lib/workers/index.js +++ b/lib/workers/index.js @@ -2,7 +2,6 @@ // // SPDX-License-Identifier: AGPL-3.0-or-later -/* global process */ const Util = require("../common-util"); const nThen = require('nthen'); const OS = require("os"); diff --git a/scripts/TestSelenium.js b/scripts/TestSelenium.js index f5930e69a..0447671ea 100644 --- a/scripts/TestSelenium.js +++ b/scripts/TestSelenium.js @@ -2,7 +2,6 @@ // // SPDX-License-Identifier: AGPL-3.0-or-later -/* global process */ var WebDriver = require("selenium-webdriver"); var nThen = require('nthen'); diff --git a/scripts/build.js b/scripts/build.js index b04b830f3..5cb823286 100644 --- a/scripts/build.js +++ b/scripts/build.js @@ -2,8 +2,6 @@ // // SPDX-License-Identifier: AGPL-3.0-or-later -/* globals process */ - var Fs = require("fs"); var Fse = require("fs-extra"); var Path = require("path"); diff --git a/scripts/check-accounts.js b/scripts/check-accounts.js index 8b15616b9..81835f5c8 100644 --- a/scripts/check-accounts.js +++ b/scripts/check-accounts.js @@ -2,7 +2,6 @@ // // SPDX-License-Identifier: AGPL-3.0-or-later -/* globals Buffer */ var Https = require('https'); var Config = require("../lib/load-config"); var Package = require("../package.json"); diff --git a/scripts/issue-jwt.js b/scripts/issue-jwt.js index da36caa8e..c7efb80f5 100644 --- a/scripts/issue-jwt.js +++ b/scripts/issue-jwt.js @@ -2,7 +2,6 @@ // // SPDX-License-Identifier: AGPL-3.0-or-later -/* globals process */ const jwt = require("jsonwebtoken"); const Sessions = require("../lib/storage/sessions.js"); diff --git a/scripts/tests/test-lkh.js b/scripts/tests/test-lkh.js index f346ba385..38bc140c4 100644 --- a/scripts/tests/test-lkh.js +++ b/scripts/tests/test-lkh.js @@ -2,7 +2,6 @@ // // SPDX-License-Identifier: AGPL-3.0-or-later -/* globals process */ var Client = require("../../lib/client"); var Nacl = require("tweetnacl/nacl-fast"); var nThen = require("nthen"); diff --git a/scripts/tests/test-mailbox.js b/scripts/tests/test-mailbox.js index 3b88c7939..f5611a6e3 100644 --- a/scripts/tests/test-mailbox.js +++ b/scripts/tests/test-mailbox.js @@ -2,8 +2,6 @@ // // SPDX-License-Identifier: AGPL-3.0-or-later -/* globals process */ - var Client = require("../../lib/client/"); var Crypto = require("../../www/components/chainpad-crypto"); var Mailbox = Crypto.Mailbox; diff --git a/scripts/tests/test-rpc.js b/scripts/tests/test-rpc.js index 632de4424..9963bc997 100644 --- a/scripts/tests/test-rpc.js +++ b/scripts/tests/test-rpc.js @@ -2,8 +2,6 @@ // // SPDX-License-Identifier: AGPL-3.0-or-later -/* globals process */ - var Client = require("../../lib/client/"); var Crypto = require("../../www/components/chainpad-crypto"); var Mailbox = Crypto.Mailbox; diff --git a/server.js b/server.js index f8e8ffd94..e84bec70b 100644 --- a/server.js +++ b/server.js @@ -2,9 +2,6 @@ // // SPDX-License-Identifier: AGPL-3.0-or-later -/* - globals process -*/ var Express = require('express'); var Http = require('http'); var Fs = require('fs'); diff --git a/www/common/outer/serviceworker.js b/www/common/outer/serviceworker.js index 106e4d848..5bd343980 100644 --- a/www/common/outer/serviceworker.js +++ b/www/common/outer/serviceworker.js @@ -6,8 +6,8 @@ importScripts('/components/requirejs/require.js'); -window = self; -localStorage = { +window = self; // eslint-disable-line no-global-assign +localStorage = { // eslint-disable-line no-global-assign setItem: function (k, v) { localStorage[k] = v; }, getItem: function (k) { return localStorage[k]; } }; diff --git a/www/common/outer/sharedworker.js b/www/common/outer/sharedworker.js index d7743dbf6..59c818ab8 100644 --- a/www/common/outer/sharedworker.js +++ b/www/common/outer/sharedworker.js @@ -6,8 +6,8 @@ importScripts('/components/requirejs/require.js'); -window = self; -localStorage = { +window = self; // eslint-disable-line no-global-assign +localStorage = { // eslint-disable-line no-global-assign setItem: function (k, v) { localStorage[k] = v; }, getItem: function (k) { return localStorage[k]; } }; diff --git a/www/common/outer/webworker.js b/www/common/outer/webworker.js index 96d174848..d5cc0b7d9 100644 --- a/www/common/outer/webworker.js +++ b/www/common/outer/webworker.js @@ -6,8 +6,8 @@ importScripts('/components/requirejs/require.js'); -window = self; -localStorage = { +window = self; // eslint-disable-line no-global-assign +localStorage = { // eslint-disable-line no-global-assign setItem: function (k, v) { localStorage[k] = v; }, getItem: function (k) { return localStorage[k]; } };