mirror of
https://github.com/cryptpad/cryptpad.git
synced 2026-09-14 11:05:41 +05:00
Added eslint and ignored most of the warnings and fixed some
This commit is contained in:
parent
5784c8e97f
commit
158164fbbe
38
.eslintignore
Normal file
38
.eslintignore
Normal file
@ -0,0 +1,38 @@
|
||||
node_modules/
|
||||
www/components/
|
||||
www/bower_components/
|
||||
www/common/onlyoffice/sdkjs
|
||||
www/common/onlyoffice/web-apps
|
||||
www/common/onlyoffice/x2t
|
||||
www/common/onlyoffice/v1
|
||||
www/common/onlyoffice/v2*
|
||||
www/common/onlyoffice/v4
|
||||
www/common/onlyoffice/v5
|
||||
www/common/onlyoffice/v*/
|
||||
|
||||
www/scratch
|
||||
www/accounts
|
||||
www/lib
|
||||
www/accounts
|
||||
|
||||
www/common/toolbar.js
|
||||
www/common/hyperscript.js
|
||||
|
||||
www/pad/wysiwygarea-plugin.js
|
||||
www/pad/mediatag-plugin.js
|
||||
www/pad/mediatag-plugin-dialog.js
|
||||
www/pad/disable-base64.js
|
||||
www/pad/wordcount/
|
||||
|
||||
www/kanban/jkanban.js
|
||||
www/common/jscolor.js
|
||||
|
||||
www/common/media-tag-nacl.min.js
|
||||
|
||||
customize/
|
||||
|
||||
www/debug/chainpad.dist.js
|
||||
|
||||
www/pad/mathjax/
|
||||
www/code/mermaid*.js
|
||||
www/code/orgmode.js
|
||||
57
.eslintrc.js
Normal file
57
.eslintrc.js
Normal file
@ -0,0 +1,57 @@
|
||||
module.exports = {
|
||||
'env': {
|
||||
'browser': true,
|
||||
'es2021': true,
|
||||
'node': true
|
||||
},
|
||||
'extends': 'eslint:recommended',
|
||||
"globals": {
|
||||
"define": "readonly",
|
||||
},
|
||||
'overrides': [
|
||||
{
|
||||
'env': {
|
||||
'node': true
|
||||
},
|
||||
'files': [
|
||||
'.eslintrc.{js,cjs}'
|
||||
],
|
||||
'parserOptions': {
|
||||
'sourceType': 'script'
|
||||
}
|
||||
}
|
||||
],
|
||||
'parserOptions': {
|
||||
'ecmaVersion': 'latest'
|
||||
},
|
||||
'rules': {
|
||||
'indent': [
|
||||
'off', // TODO enable this check
|
||||
4
|
||||
],
|
||||
'linebreak-style': [
|
||||
'error',
|
||||
'unix'
|
||||
],
|
||||
'quotes': [
|
||||
'off', // TODO enable this check
|
||||
'single'
|
||||
],
|
||||
'semi': [
|
||||
'error',
|
||||
'always'
|
||||
],
|
||||
|
||||
// TODO remove these exceptions from the eslint defaults
|
||||
'no-irregular-whitespace': ['off'],
|
||||
'no-unused-vars': ['off'],
|
||||
'no-self-assign': ['off'],
|
||||
'no-empty': ['off'],
|
||||
'no-useless-escape': ['off'],
|
||||
'no-redeclare': ['off'],
|
||||
'no-undef': ['off'],
|
||||
'no-extra-boolean-cast': ['off'],
|
||||
'no-global-assign': ['off'],
|
||||
'no-prototype-builtins': ['off'],
|
||||
}
|
||||
};
|
||||
@ -85,7 +85,7 @@ var getActiveSessions = function (Env, Server, cb) {
|
||||
};
|
||||
|
||||
var shutdown = function (Env, Server, cb) {
|
||||
if (true) {
|
||||
if (true) { // eslint-disable-line no-constant-condition
|
||||
return void cb('E_NOT_IMPLEMENTED');
|
||||
}
|
||||
|
||||
|
||||
@ -268,7 +268,7 @@ var getMetadataAtPath = function (Env, path, _cb) {
|
||||
// if you can't parse, that's bad
|
||||
return void cb("INVALID_METADATA");
|
||||
}
|
||||
readMore();
|
||||
readMore(); // eslint-disable-line no-unreachable
|
||||
}, function (err) {
|
||||
cb(err);
|
||||
});
|
||||
|
||||
1054
package-lock.json
generated
1054
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
72
package.json
72
package.json
@ -13,61 +13,61 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@mcrowe/minibloom": "^0.2.0",
|
||||
"chainpad-crypto": "^0.2.5",
|
||||
"chainpad-server": "^5.1.0",
|
||||
"cookie-parser": "^1.4.6",
|
||||
"@node-saml/node-saml": "^4.0.5",
|
||||
"alertify.js": "1.0.11",
|
||||
"body-parser": "^1.20.2",
|
||||
"bootstrap": "^4.0.0",
|
||||
"bootstrap-tokenfield": "^0.12.0",
|
||||
"chainpad": "^5.2.6",
|
||||
"chainpad-crypto": "^0.2.5",
|
||||
"chainpad-listmap": "^1.0.0",
|
||||
"chainpad-netflux": "^1.0.0",
|
||||
"chainpad-server": "^5.1.0",
|
||||
"ckeditor": "npm:ckeditor4@~4.22.1",
|
||||
"codemirror": "^5.19.0",
|
||||
"components-font-awesome": "^4.6.3",
|
||||
"cookie-parser": "^1.4.6",
|
||||
"croppie": "^2.5.0",
|
||||
"dragula": "3.7.2",
|
||||
"drawio": "github:cryptpad/drawio-npm#npm-21.8.2+4",
|
||||
"express": "~4.18.2",
|
||||
"file-saver": "1.3.1",
|
||||
"fs-extra": "^7.0.0",
|
||||
"get-folder-size": "^2.0.1",
|
||||
"netflux-websocket": "^1.0.0",
|
||||
"html2canvas": "^1.4.0",
|
||||
"http-proxy-middleware": "^2.0.6",
|
||||
"hyper-json": "~1.4.0",
|
||||
"jquery": "3.6.0",
|
||||
"json.sortify": "~2.1.0",
|
||||
"jsonwebtoken": "^9.0.0",
|
||||
"jszip": "3.10.1",
|
||||
"localforage": "^1.5.2",
|
||||
"marked": "^4.3.0",
|
||||
"mathjax": "3.0.5",
|
||||
"netflux-websocket": "^1.0.0",
|
||||
"notp": "^2.0.3",
|
||||
"nthen": "0.1.8",
|
||||
"open-sans-fontface": "^1.4.0",
|
||||
"openid-client": "^5.4.2",
|
||||
"@node-saml/node-saml": "^4.0.5",
|
||||
"pako": "^2.1.0",
|
||||
"prompt-confirm": "^2.0.4",
|
||||
"pull-stream": "^3.6.1",
|
||||
"require-css": "0.1.10",
|
||||
"requirejs": "2.3.5",
|
||||
"requirejs-plugins": "^1.0.2",
|
||||
"saferphore": "0.0.1",
|
||||
"scrypt-async": "1.2.0",
|
||||
"sortablejs": "^1.6.0",
|
||||
"sortify": "^1.0.4",
|
||||
"stream-to-pull-stream": "^1.7.2",
|
||||
"thirty-two": "^1.0.2",
|
||||
"tweetnacl": "~0.12.2",
|
||||
"ulimit": "0.0.2",
|
||||
"ws": "^3.3.1",
|
||||
|
||||
"alertify.js": "1.0.11",
|
||||
"bootstrap": "^4.0.0",
|
||||
"bootstrap-tokenfield": "^0.12.0",
|
||||
"chainpad": "^5.2.6",
|
||||
"chainpad-listmap": "^1.0.0",
|
||||
"chainpad-netflux": "^1.0.0",
|
||||
"ckeditor": "npm:ckeditor4@~4.22.1",
|
||||
"codemirror": "^5.19.0",
|
||||
"components-font-awesome": "^4.6.3",
|
||||
"croppie": "^2.5.0",
|
||||
"file-saver": "1.3.1",
|
||||
"hyper-json": "~1.4.0",
|
||||
"jquery": "3.6.0",
|
||||
"json.sortify": "~2.1.0",
|
||||
"jszip": "3.10.1",
|
||||
"dragula": "3.7.2",
|
||||
"html2canvas": "^1.4.0",
|
||||
"localforage": "^1.5.2",
|
||||
"marked": "^4.3.0",
|
||||
"mathjax": "3.0.5",
|
||||
"open-sans-fontface": "^1.4.0",
|
||||
"require-css": "0.1.10",
|
||||
"requirejs": "2.3.5",
|
||||
"requirejs-plugins": "^1.0.2",
|
||||
"scrypt-async": "1.2.0",
|
||||
"sortablejs": "^1.6.0",
|
||||
"drawio": "github:cryptpad/drawio-npm#npm-21.8.2+4",
|
||||
"pako": "^2.1.0",
|
||||
"x2js": "^3.4.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"eslint": "^8.57.0",
|
||||
"jshint": "^2.13.4",
|
||||
"lesshint": "6.3.7"
|
||||
},
|
||||
@ -86,8 +86,8 @@
|
||||
"offline": "FRESH=1 OFFLINE=1 node server.js",
|
||||
"offlinedev": "DEV=1 OFFLINE=1 node server.js",
|
||||
"package": "PACKAGE=1 node server.js",
|
||||
"lint": "jshint --config .jshintrc --exclude-path .jshintignore . && ./node_modules/lesshint/bin/lesshint -c ./.lesshintrc ./customize.dist/src/less2/",
|
||||
"lint:js": "jshint --config .jshintrc --exclude-path .jshintignore .",
|
||||
"lint": "eslint . && ./node_modules/lesshint/bin/lesshint -c ./.lesshintrc ./customize.dist/src/less2/",
|
||||
"lint:js": "eslint .",
|
||||
"lint:server": "jshint --config .jshintrc lib",
|
||||
"lint:less": "./node_modules/lesshint/bin/lesshint -c ./.lesshintrc ./customize.dist/src/less2/",
|
||||
"lint:translations": "node ./scripts/translations/lint-translations.js",
|
||||
|
||||
@ -1287,6 +1287,7 @@ define([
|
||||
|
||||
// check if they provide legal data
|
||||
assert(function (cb, msg) {
|
||||
// eslint-disable-next-line no-constant-condition
|
||||
if (true) { return void cb(true); } // FIXME stubbed while we determine whether this is necessary
|
||||
if (ApiConfig.restrictRegistration) { return void cb(true); }
|
||||
|
||||
|
||||
@ -2717,6 +2717,7 @@ define([
|
||||
window.addEventListener('unload', function () {
|
||||
postMsg('CLOSE');
|
||||
});
|
||||
// eslint-disable-next-line no-constant-condition
|
||||
} else if (false && !noWorker && !noSharedWorker && 'serviceWorker' in navigator) {
|
||||
var initializing = true;
|
||||
var stopWaiting = waitFor2(); // Call this function when we're ready
|
||||
|
||||
@ -164,7 +164,7 @@ var init = function (client, cb) {
|
||||
onconnect = function(e) {
|
||||
debug('New SharedWorker client');
|
||||
var port = e.ports[0];
|
||||
var cId = Number(Math.floor(Math.random() * Number.MAX_SAFE_INTEGER))
|
||||
var cId = Number(Math.floor(Math.random() * Number.MAX_SAFE_INTEGER));
|
||||
var client = self.tabs[cId] = {
|
||||
id: cId,
|
||||
port: port
|
||||
|
||||
@ -121,7 +121,7 @@ define([
|
||||
|
||||
// Sanitize file names
|
||||
var illegalRe = /[\/\?<>\\:\*\|"]/g;
|
||||
var controlRe = /[\x00-\x1f\x80-\x9f]/g;
|
||||
var controlRe = /[\x00-\x1f\x80-\x9f]/g; // eslint-disable-line no-control-regex
|
||||
var reservedRe = /^\.+$/;
|
||||
var safeRe = /[&'%!"{}[\]]/g;
|
||||
var sanitize = function (input) {
|
||||
|
||||
@ -8,7 +8,7 @@
|
||||
// IF YOU EDIT THIS FILE, bump the version (replace 1.3 in the following command with the next version.)
|
||||
// grep -nr '/common/sframe-boot.js?ver=' | sed 's/:.*$//' | grep -v 'sframe-boot.js' | while read x; do \
|
||||
// sed -i -e 's@/common/sframe-boot.js?ver=[^"]*@/common/sframe-boot.js?ver=1.3@' $x; done
|
||||
;(function () {
|
||||
(function () {
|
||||
|
||||
var _alert = function (cb) {
|
||||
return void require([
|
||||
|
||||
@ -2,7 +2,9 @@
|
||||
//
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
/* jshint ignore:start */
|
||||
/* eslint-env worker */
|
||||
/* global clients */
|
||||
|
||||
var id;
|
||||
//= Math.floor(Math.random()*100000);
|
||||
|
||||
@ -17,17 +19,17 @@ var broadcast = function (data, excludes) {
|
||||
if (excludes.indexOf(client.id) === -1) {
|
||||
postMsg(client, data);
|
||||
}
|
||||
})
|
||||
})
|
||||
});
|
||||
});
|
||||
};
|
||||
var sendTo = function (data, clientId){
|
||||
clients.matchAll().then(function (clients) {
|
||||
clients.some(function (client) {
|
||||
if (client.id === clientId) {
|
||||
postMsg(client, data)
|
||||
postMsg(client, data);
|
||||
}
|
||||
})
|
||||
})
|
||||
});
|
||||
});
|
||||
};
|
||||
var getClients = function () {
|
||||
clients.matchAll().then(function (clients) {
|
||||
|
||||
@ -2,9 +2,9 @@
|
||||
//
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
/* jshint ignore:start */
|
||||
/* eslint-env worker */
|
||||
|
||||
var window = self;
|
||||
var window = self; // eslint-disable-line no-unused-vars
|
||||
var localStorage = {
|
||||
setItem: function (k, v) { localStorage[k] = v; },
|
||||
getItem: function (k) { return localStorage[k]; }
|
||||
|
||||
Loading…
Reference in New Issue
Block a user