mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-02-12 17:47:54 +01:00
feat: testing eslint9 (#13266)
* feat: testing eslint9 * fix: restore original functionality
This commit is contained in:
committed by
GitHub
parent
87b617e9bb
commit
6813664120
@@ -1,21 +0,0 @@
|
|||||||
node_modules/
|
|
||||||
*.sublime-project
|
|
||||||
*.sublime-workspace
|
|
||||||
.project
|
|
||||||
.vagrant
|
|
||||||
.DS_Store
|
|
||||||
logs/
|
|
||||||
/public/templates
|
|
||||||
/public/uploads
|
|
||||||
/public/vendor
|
|
||||||
/public/src/modules/string.js
|
|
||||||
.idea/
|
|
||||||
.vscode/
|
|
||||||
*.ipr
|
|
||||||
*.iws
|
|
||||||
/coverage
|
|
||||||
/build
|
|
||||||
.eslintrc
|
|
||||||
test/files
|
|
||||||
*.min.js
|
|
||||||
install/docker/
|
|
||||||
62
eslint.config.cjs
Normal file
62
eslint.config.cjs
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
'use strict';
|
||||||
|
const serverConfig = require('eslint-config-nodebb');
|
||||||
|
const publicConfig = require('eslint-config-nodebb/public');
|
||||||
|
|
||||||
|
const { configs } = require('@eslint/js');
|
||||||
|
const globals = require('globals');
|
||||||
|
|
||||||
|
module.exports = [
|
||||||
|
{
|
||||||
|
ignores: [
|
||||||
|
'node_modules/',
|
||||||
|
'.project',
|
||||||
|
'.vagrant',
|
||||||
|
'.DS_Store',
|
||||||
|
'.tx',
|
||||||
|
'logs/',
|
||||||
|
'public/uploads/',
|
||||||
|
'public/vendor/',
|
||||||
|
'.idea/',
|
||||||
|
'.vscode/',
|
||||||
|
'*.ipr',
|
||||||
|
'*.iws',
|
||||||
|
'coverage/',
|
||||||
|
'build/',
|
||||||
|
'test/files/',
|
||||||
|
'*.min.js',
|
||||||
|
'install/docker/',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
configs.recommended,
|
||||||
|
{
|
||||||
|
rules: {
|
||||||
|
'no-bitwise': 'warn',
|
||||||
|
'no-await-in-loop': 'warn',
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// tests
|
||||||
|
{
|
||||||
|
files: ['test/**/*.js'],
|
||||||
|
languageOptions: {
|
||||||
|
ecmaVersion: 2020,
|
||||||
|
sourceType: 'commonjs',
|
||||||
|
globals: {
|
||||||
|
...globals.node,
|
||||||
|
...globals.browser,
|
||||||
|
it: 'readonly',
|
||||||
|
describe: 'readonly',
|
||||||
|
before: 'readonly',
|
||||||
|
beforeEach: 'readonly',
|
||||||
|
after: 'readonly',
|
||||||
|
afterEach: 'readonly',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
'no-unused-vars': 'off',
|
||||||
|
'no-prototype-builtins': 'off',
|
||||||
|
}
|
||||||
|
},
|
||||||
|
...publicConfig,
|
||||||
|
...serverConfig
|
||||||
|
];
|
||||||
|
|
||||||
@@ -162,8 +162,8 @@
|
|||||||
"@commitlint/cli": "19.8.0",
|
"@commitlint/cli": "19.8.0",
|
||||||
"@commitlint/config-angular": "19.8.0",
|
"@commitlint/config-angular": "19.8.0",
|
||||||
"coveralls": "3.1.1",
|
"coveralls": "3.1.1",
|
||||||
"eslint": "8.57.1",
|
"@eslint/js": "9.23.0",
|
||||||
"eslint-config-nodebb": "0.2.1",
|
"eslint-config-nodebb": "1.0.7",
|
||||||
"eslint-plugin-import": "2.31.0",
|
"eslint-plugin-import": "2.31.0",
|
||||||
"grunt": "1.6.1",
|
"grunt": "1.6.1",
|
||||||
"grunt-contrib-watch": "1.1.0",
|
"grunt-contrib-watch": "1.1.0",
|
||||||
|
|||||||
@@ -1,3 +0,0 @@
|
|||||||
{
|
|
||||||
"extends": "nodebb/public"
|
|
||||||
}
|
|
||||||
@@ -4,7 +4,6 @@ require('../app');
|
|||||||
|
|
||||||
// scripts-admin.js is generated during build, it contains javascript files
|
// scripts-admin.js is generated during build, it contains javascript files
|
||||||
// from plugins that add files to "acpScripts" block in plugin.json
|
// from plugins that add files to "acpScripts" block in plugin.json
|
||||||
// eslint-disable-next-line
|
|
||||||
require('../../scripts-admin');
|
require('../../scripts-admin');
|
||||||
|
|
||||||
app.onDomReady();
|
app.onDomReady();
|
||||||
|
|||||||
@@ -23,7 +23,6 @@ Chart.register(
|
|||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
// eslint-disable-next-line import/prefer-default-export
|
|
||||||
export function init() {
|
export function init() {
|
||||||
setupCharts();
|
setupCharts();
|
||||||
|
|
||||||
|
|||||||
@@ -64,7 +64,6 @@ $(window).on('action:ajaxify.start', function () {
|
|||||||
usedTopicColors.length = 0;
|
usedTopicColors.length = 0;
|
||||||
});
|
});
|
||||||
|
|
||||||
// eslint-disable-next-line import/prefer-default-export
|
|
||||||
export function init() {
|
export function init() {
|
||||||
app.enterRoom('admin');
|
app.enterRoom('admin');
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ Chart.register(
|
|||||||
Filler
|
Filler
|
||||||
);
|
);
|
||||||
|
|
||||||
// eslint-disable-next-line import/prefer-default-export
|
|
||||||
export function init() {
|
export function init() {
|
||||||
categorySelector.init($('[component="category-selector"]'), {
|
categorySelector.init($('[component="category-selector"]'), {
|
||||||
onSelect: function (selectedCategory) {
|
onSelect: function (selectedCategory) {
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ import { error } from '../../modules/alerts';
|
|||||||
|
|
||||||
import * as categorySelector from '../../modules/categorySelector';
|
import * as categorySelector from '../../modules/categorySelector';
|
||||||
|
|
||||||
// eslint-disable-next-line import/prefer-default-export
|
|
||||||
export function init() {
|
export function init() {
|
||||||
categorySelector.init($('[component="category-selector"]'), {
|
categorySelector.init($('[component="category-selector"]'), {
|
||||||
onSelect: function (selectedCategory) {
|
onSelect: function (selectedCategory) {
|
||||||
|
|||||||
@@ -30,7 +30,6 @@ Chart.register(
|
|||||||
let _current = null;
|
let _current = null;
|
||||||
let isMobile = false;
|
let isMobile = false;
|
||||||
|
|
||||||
// eslint-disable-next-line import/prefer-default-export
|
|
||||||
export function init({ set, dataset }) {
|
export function init({ set, dataset }) {
|
||||||
const canvas = document.getElementById('analytics-traffic');
|
const canvas = document.getElementById('analytics-traffic');
|
||||||
const canvasCtx = canvas.getContext('2d');
|
const canvasCtx = canvas.getContext('2d');
|
||||||
|
|||||||
@@ -38,12 +38,13 @@ ajaxify.widgets = { render: render };
|
|||||||
if (!pathname) {
|
if (!pathname) {
|
||||||
({ pathname } = urlObj);
|
({ pathname } = urlObj);
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (err) {
|
||||||
|
console.error(err);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const internalLink = utils.isInternalURI(urlObj, window.location, config.relative_path);
|
const internalLink = utils.isInternalURI(urlObj, window.location, config.relative_path);
|
||||||
// eslint-disable-next-line no-script-url
|
|
||||||
const hrefEmpty = href => href === undefined || href === '' || href === 'javascript:;';
|
const hrefEmpty = href => href === undefined || href === '' || href === 'javascript:;';
|
||||||
|
|
||||||
if (item instanceof Element) {
|
if (item instanceof Element) {
|
||||||
@@ -55,7 +56,6 @@ ajaxify.widgets = { render: render };
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// eslint-disable-next-line no-script-url
|
|
||||||
if (hrefEmpty(urlObj.href) || urlObj.protocol === 'javascript:' || pathname === '#' || pathname === '') {
|
if (hrefEmpty(urlObj.href) || urlObj.protocol === 'javascript:' || pathname === '#' || pathname === '') {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -514,7 +514,6 @@ ajaxify.widgets = { render: render };
|
|||||||
cache: false,
|
cache: false,
|
||||||
dataType: 'text',
|
dataType: 'text',
|
||||||
success: function (script) {
|
success: function (script) {
|
||||||
// eslint-disable-next-line no-new-func
|
|
||||||
const renderFunction = new Function('module', script);
|
const renderFunction = new Function('module', script);
|
||||||
const moduleObj = { exports: {} };
|
const moduleObj = { exports: {} };
|
||||||
renderFunction(moduleObj);
|
renderFunction(moduleObj);
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ require('./app');
|
|||||||
|
|
||||||
// scripts-client.js is generated during build, it contains javascript files
|
// scripts-client.js is generated during build, it contains javascript files
|
||||||
// from plugins that add files to "scripts" block in plugin.json
|
// from plugins that add files to "scripts" block in plugin.json
|
||||||
// eslint-disable-next-line
|
|
||||||
require('../scripts-client');
|
require('../scripts-client');
|
||||||
|
|
||||||
app.onDomReady();
|
app.onDomReady();
|
||||||
|
|||||||
@@ -26,7 +26,8 @@ define('forum/account/sessions', ['forum/account/header', 'components', 'api', '
|
|||||||
window.location.href = config.relative_path + '/login?error=' + errorObj.title;
|
window.location.href = config.relative_path + '/login?error=' + errorObj.title;
|
||||||
}
|
}
|
||||||
alerts.error(errorObj.title);
|
alerts.error(errorObj.title);
|
||||||
} catch (e) {
|
} catch (err) {
|
||||||
|
console.error(err);
|
||||||
alerts.error('[[error:invalid-data]]');
|
alerts.error('[[error:invalid-data]]');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -132,6 +132,7 @@ define('forum/chats/manage', [
|
|||||||
try {
|
try {
|
||||||
data = await api.get(`/chats/${roomId}/users`, {});
|
data = await api.get(`/chats/${roomId}/users`, {});
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
console.error(err);
|
||||||
listEl.find('li').text(await translator.translate('[[error:invalid-data]]'));
|
listEl.find('li').text(await translator.translate('[[error:invalid-data]]'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
/* eslint-disable no-redeclare */
|
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const $ = require('jquery');
|
const $ = require('jquery');
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
/* eslint-disable import/first */
|
|
||||||
|
|
||||||
export * from 'ace-builds';
|
export * from 'ace-builds';
|
||||||
|
|
||||||
// only import the modes and theme we use
|
// only import the modes and theme we use
|
||||||
@@ -9,8 +7,7 @@ import 'ace-builds/src-noconflict/mode-html';
|
|||||||
import 'ace-builds/src-noconflict/ext-searchbox';
|
import 'ace-builds/src-noconflict/ext-searchbox';
|
||||||
import 'ace-builds/src-noconflict/theme-twilight';
|
import 'ace-builds/src-noconflict/theme-twilight';
|
||||||
|
|
||||||
/* eslint-disable import/no-webpack-loader-syntax */
|
|
||||||
/* eslint-disable import/no-unresolved */
|
|
||||||
import htmlWorkerUrl from 'file-loader!ace-builds/src-noconflict/worker-html';
|
import htmlWorkerUrl from 'file-loader!ace-builds/src-noconflict/worker-html';
|
||||||
import javascriptWorkerUrl from 'file-loader!ace-builds/src-noconflict/worker-javascript';
|
import javascriptWorkerUrl from 'file-loader!ace-builds/src-noconflict/worker-javascript';
|
||||||
import cssWorkerUrl from 'file-loader!ace-builds/src-noconflict/worker-css';
|
import cssWorkerUrl from 'file-loader!ace-builds/src-noconflict/worker-css';
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
/* eslint-disable import/no-unresolved */
|
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
import { fire as fireHook } from 'hooks';
|
import { fire as fireHook } from 'hooks';
|
||||||
|
|||||||
@@ -222,6 +222,7 @@ define('iconSelect', ['benchpress', 'bootbox'], function (Benchpress, bootbox) {
|
|||||||
{ id: 'android', label: 'Android (brands)', style: 'brands' },
|
{ id: 'android', label: 'Android (brands)', style: 'brands' },
|
||||||
{ id: 'address-book', label: 'Address Book (solid)', style: 'solid' },
|
{ id: 'address-book', label: 'Address Book (solid)', style: 'solid' },
|
||||||
];
|
];
|
||||||
|
|
||||||
iconSelect.init = function (el, onModified) {
|
iconSelect.init = function (el, onModified) {
|
||||||
onModified = onModified || function () { };
|
onModified = onModified || function () { };
|
||||||
let selected = cleanFAClass(el[0].classList);
|
let selected = cleanFAClass(el[0].classList);
|
||||||
@@ -230,6 +231,7 @@ define('iconSelect', ['benchpress', 'bootbox'], function (Benchpress, bootbox) {
|
|||||||
try {
|
try {
|
||||||
$(`#icons .nbb-fa-icons ${selected.styles.length ? '.' + selected.styles.join('.') : ''}.${selected.icon}`).addClass('selected');
|
$(`#icons .nbb-fa-icons ${selected.styles.length ? '.' + selected.styles.join('.') : ''}.${selected.icon}`).addClass('selected');
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
console.error(err);
|
||||||
selected = {
|
selected = {
|
||||||
icon: '',
|
icon: '',
|
||||||
style: '',
|
style: '',
|
||||||
|
|||||||
@@ -270,7 +270,8 @@ define('search', [
|
|||||||
let term = data.term.replace(/^[ ?#]*/, '');
|
let term = data.term.replace(/^[ ?#]*/, '');
|
||||||
try {
|
try {
|
||||||
term = encodeURIComponent(term);
|
term = encodeURIComponent(term);
|
||||||
} catch (e) {
|
} catch (err) {
|
||||||
|
console.error(err);
|
||||||
return alerts.error('[[error:invalid-search-term]]');
|
return alerts.error('[[error:invalid-search-term]]');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -291,7 +292,8 @@ define('search', [
|
|||||||
Search.getSearchPreferences = function () {
|
Search.getSearchPreferences = function () {
|
||||||
try {
|
try {
|
||||||
return JSON.parse(storage.getItem('search-preferences') || '{}');
|
return JSON.parse(storage.getItem('search-preferences') || '{}');
|
||||||
} catch (e) {
|
} catch (err) {
|
||||||
|
console.error(err);
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -2,11 +2,10 @@
|
|||||||
|
|
||||||
|
|
||||||
define('settings', ['hooks', 'alerts'], function (hooks, alerts) {
|
define('settings', ['hooks', 'alerts'], function (hooks, alerts) {
|
||||||
// eslint-disable-next-line prefer-const
|
|
||||||
let Settings;
|
let Settings;
|
||||||
let onReady = [];
|
let onReady = [];
|
||||||
let waitingJobs = 0;
|
let waitingJobs = 0;
|
||||||
// eslint-disable-next-line prefer-const
|
|
||||||
let helper;
|
let helper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -30,7 +29,6 @@ define('settings', ['hooks', 'alerts'], function (hooks, alerts) {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// eslint-disable-next-line prefer-const
|
|
||||||
helper = {
|
helper = {
|
||||||
/**
|
/**
|
||||||
@returns Object A deep clone of the given object.
|
@returns Object A deep clone of the given object.
|
||||||
@@ -326,12 +324,13 @@ define('settings', ['hooks', 'alerts'], function (hooks, alerts) {
|
|||||||
use: function (settings) {
|
use: function (settings) {
|
||||||
try {
|
try {
|
||||||
settings._ = JSON.parse(settings._);
|
settings._ = JSON.parse(settings._);
|
||||||
} catch (_error) {}
|
} catch (err) {
|
||||||
|
console.error(err);
|
||||||
|
}
|
||||||
Settings.cfg = settings;
|
Settings.cfg = settings;
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
// eslint-disable-next-line prefer-const
|
|
||||||
Settings = {
|
Settings = {
|
||||||
helper: helper,
|
helper: helper,
|
||||||
plugins: {},
|
plugins: {},
|
||||||
@@ -474,8 +473,8 @@ define('settings', ['hooks', 'alerts'], function (hooks, alerts) {
|
|||||||
if (key && values.hasOwnProperty(key)) {
|
if (key && values.hasOwnProperty(key)) {
|
||||||
try {
|
try {
|
||||||
values[key] = JSON.parse(values[key]);
|
values[key] = JSON.parse(values[key]);
|
||||||
} catch (e) {
|
} catch (err) {
|
||||||
// Leave the value as is
|
console.error(err);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -105,7 +105,8 @@ define('settings/array', function () {
|
|||||||
separator = (function () {
|
separator = (function () {
|
||||||
try {
|
try {
|
||||||
return $(separator);
|
return $(separator);
|
||||||
} catch (_error) {
|
} catch (err) {
|
||||||
|
console.error(err);
|
||||||
return $(document.createTextNode(separator));
|
return $(document.createTextNode(separator));
|
||||||
}
|
}
|
||||||
}());
|
}());
|
||||||
|
|||||||
@@ -68,7 +68,8 @@ define('settings/object', function () {
|
|||||||
separator = (function () {
|
separator = (function () {
|
||||||
try {
|
try {
|
||||||
return $(separator);
|
return $(separator);
|
||||||
} catch (_error) {
|
} catch (err) {
|
||||||
|
console.error(err);
|
||||||
return $(document.createTextNode(separator));
|
return $(document.createTextNode(separator));
|
||||||
}
|
}
|
||||||
}());
|
}());
|
||||||
|
|||||||
@@ -107,7 +107,8 @@ define('uploader', ['jquery-form'], function () {
|
|||||||
if (typeof response === 'string') {
|
if (typeof response === 'string') {
|
||||||
try {
|
try {
|
||||||
return JSON.parse(response);
|
return JSON.parse(response);
|
||||||
} catch (e) {
|
} catch (err) {
|
||||||
|
console.error(err);
|
||||||
return { error: '[[error:parse-error]]' };
|
return { error: '[[error:parse-error]]' };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,7 +51,9 @@ define('userFilter', ['api', 'hooks', 'slugify', 'benchpress'], function (api, h
|
|||||||
try {
|
try {
|
||||||
const userData = await api.get(`/api/user/${slugify(query)}`);
|
const userData = await api.get(`/api/user/${slugify(query)}`);
|
||||||
result.users.push(userData);
|
result.users.push(userData);
|
||||||
} catch (err) {}
|
} catch (err) {
|
||||||
|
console.error(err);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!result.users.length) {
|
if (!result.users.length) {
|
||||||
|
|||||||
@@ -1,10 +1,8 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
// eslint-disable-next-line no-redeclare
|
|
||||||
const io = require('socket.io-client');
|
const io = require('socket.io-client');
|
||||||
// eslint-disable-next-line no-redeclare
|
|
||||||
const $ = require('jquery');
|
const $ = require('jquery');
|
||||||
// eslint-disable-next-line import/no-unresolved
|
|
||||||
const { alert } = require('alerts');
|
const { alert } = require('alerts');
|
||||||
|
|
||||||
app = window.app || {};
|
app = window.app || {};
|
||||||
|
|||||||
@@ -272,7 +272,6 @@ const HTMLEntities = Object.freeze({
|
|||||||
'diams;': 9830,
|
'diams;': 9830,
|
||||||
});
|
});
|
||||||
|
|
||||||
/* eslint-disable no-redeclare */
|
|
||||||
const utils = {
|
const utils = {
|
||||||
// https://github.com/substack/node-ent/blob/master/index.js
|
// https://github.com/substack/node-ent/blob/master/index.js
|
||||||
decodeHTMLEntities: function (html) {
|
decodeHTMLEntities: function (html) {
|
||||||
@@ -467,7 +466,8 @@ const utils = {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
return new Date(parseInt(timestamp, 10)).toISOString();
|
return new Date(parseInt(timestamp, 10)).toISOString();
|
||||||
} catch (e) {
|
} catch (err) {
|
||||||
|
console.error(err);
|
||||||
return timestamp;
|
return timestamp;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -631,7 +631,9 @@ const utils = {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
str = JSON.parse(str);
|
str = JSON.parse(str);
|
||||||
} catch (e) {}
|
} catch (err) {
|
||||||
|
console.error(err)
|
||||||
|
}
|
||||||
|
|
||||||
return str;
|
return str;
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
/* eslint-disable no-redeclare */
|
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
|||||||
@@ -37,7 +37,7 @@
|
|||||||
if ($el.css('background-size') == "cover") {
|
if ($el.css('background-size') == "cover") {
|
||||||
var elementWidth = $el.innerWidth(),
|
var elementWidth = $el.innerWidth(),
|
||||||
elementHeight = $el.innerHeight(),
|
elementHeight = $el.innerHeight(),
|
||||||
elementAspectRatio = elementWidth / elementHeight;
|
elementAspectRatio = elementWidth / elementHeight,
|
||||||
imageAspectRatio = image.width / image.height,
|
imageAspectRatio = image.width / image.height,
|
||||||
scale = 1;
|
scale = 1;
|
||||||
|
|
||||||
@@ -182,18 +182,17 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
$.fn.backgroundDraggable = function(options) {
|
$.fn.backgroundDraggable = function(options) {
|
||||||
var options = options;
|
|
||||||
var args = Array.prototype.slice.call(arguments, 1);
|
var args = Array.prototype.slice.call(arguments, 1);
|
||||||
|
|
||||||
return this.each(function() {
|
return this.each(function() {
|
||||||
var $this = $(this);
|
var $this = $(this);
|
||||||
|
var plugin;
|
||||||
if (typeof options == 'undefined' || typeof options == 'object') {
|
if (typeof options == 'undefined' || typeof options == 'object') {
|
||||||
options = $.extend({}, $.fn.backgroundDraggable.defaults, options);
|
options = $.extend({}, $.fn.backgroundDraggable.defaults, options);
|
||||||
var plugin = new Plugin(this, options);
|
plugin = new Plugin(this, options);
|
||||||
$this.data('dbg', plugin);
|
$this.data('dbg', plugin);
|
||||||
} else if (typeof options == 'string' && $this.data('dbg')) {
|
} else if (typeof options == 'string' && $this.data('dbg')) {
|
||||||
var plugin = $this.data('dbg');
|
plugin = $this.data('dbg');
|
||||||
Plugin.prototype[options].apply(plugin, args);
|
Plugin.prototype[options].apply(plugin, args);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -202,6 +201,6 @@
|
|||||||
$.fn.backgroundDraggable.defaults = {
|
$.fn.backgroundDraggable.defaults = {
|
||||||
bound: true,
|
bound: true,
|
||||||
axis: undefined,
|
axis: undefined,
|
||||||
units: 'pixels'
|
units: 'pixels',
|
||||||
};
|
};
|
||||||
}(jQuery));
|
}(jQuery));
|
||||||
@@ -1,5 +1,3 @@
|
|||||||
/* eslint-disable import/order */
|
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
|
|||||||
@@ -21,8 +21,8 @@ eventsController.get = async function (req, res) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Limit by date
|
// Limit by date
|
||||||
let from = req.query.start ? new Date(req.query.start) || undefined : undefined;
|
let from = req.query.start ? new Date(req.query.start) : undefined;
|
||||||
let to = req.query.end ? new Date(req.query.end) || undefined : new Date();
|
let to = req.query.end ? new Date(req.query.end) : new Date();
|
||||||
from = from && from.setUTCHours(0, 0, 0, 0); // setHours returns a unix timestamp (Number, not Date)
|
from = from && from.setUTCHours(0, 0, 0, 0); // setHours returns a unix timestamp (Number, not Date)
|
||||||
to = to && to.setUTCHours(23, 59, 59, 999); // setHours returns a unix timestamp (Number, not Date)
|
to = to && to.setUTCHours(23, 59, 59, 999); // setHours returns a unix timestamp (Number, not Date)
|
||||||
|
|
||||||
|
|||||||
@@ -106,8 +106,7 @@ events.log = async function (data) {
|
|||||||
events.getEvents = async function (options) {
|
events.getEvents = async function (options) {
|
||||||
// backwards compatibility
|
// backwards compatibility
|
||||||
if (arguments.length > 1) {
|
if (arguments.length > 1) {
|
||||||
// eslint-disable-next-line prefer-rest-params
|
const args = [...arguments];
|
||||||
const args = Array.prototype.slice.call(arguments);
|
|
||||||
options = {
|
options = {
|
||||||
filter: args[0],
|
filter: args[0],
|
||||||
start: args[1],
|
start: args[1],
|
||||||
|
|||||||
@@ -146,7 +146,6 @@ Upgrade.process = async function (files, skipCount) {
|
|||||||
process.stdout.write(chalk.grey(' skipped\n'));
|
process.stdout.write(chalk.grey(' skipped\n'));
|
||||||
|
|
||||||
await db.sortedSetAdd('schemaLog', Date.now(), path.basename(file, '.js'));
|
await db.sortedSetAdd('schemaLog', Date.now(), path.basename(file, '.js'));
|
||||||
// eslint-disable-next-line no-continue
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
/* eslint-disable no-await-in-loop */
|
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const db = require('../../database');
|
const db = require('../../database');
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
/* eslint-disable no-await-in-loop */
|
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const db = require('../../database');
|
const db = require('../../database');
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ module.exports = {
|
|||||||
batch: 500,
|
batch: 500,
|
||||||
withScores: true,
|
withScores: true,
|
||||||
});
|
});
|
||||||
// eslint-disable-next-line no-await-in-loop
|
|
||||||
await db.deleteAll(`uid:${uid}:chat:room:${roomId}:mids`);
|
await db.deleteAll(`uid:${uid}:chat:room:${roomId}:mids`);
|
||||||
progress.incr(1);
|
progress.incr(1);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
/* eslint-disable no-await-in-loop */
|
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const db = require('../../database');
|
const db = require('../../database');
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
/* eslint-disable no-await-in-loop */
|
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const db = require('../../database');
|
const db = require('../../database');
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
/* eslint-disable no-await-in-loop */
|
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const db = require('../../database');
|
const db = require('../../database');
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
/* eslint-disable no-await-in-loop */
|
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const db = require('../../database');
|
const db = require('../../database');
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
/* eslint-disable no-await-in-loop */
|
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const db = require('../../database');
|
const db = require('../../database');
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
/* eslint-disable no-await-in-loop */
|
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const db = require('../../database');
|
const db = require('../../database');
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
/* eslint-disable no-await-in-loop */
|
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const db = require('../../database');
|
const db = require('../../database');
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
/* eslint-disable no-await-in-loop */
|
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const db = require('../../database');
|
const db = require('../../database');
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
/* eslint-disable no-await-in-loop */
|
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
/* eslint-disable no-await-in-loop */
|
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
const async = require('async');
|
const async = require('async');
|
||||||
const nconf = require('nconf');
|
const nconf = require('nconf');
|
||||||
const validator = require('validator');
|
const validator = require('validator');
|
||||||
|
const winston = require('winston');
|
||||||
|
|
||||||
const db = require('../database');
|
const db = require('../database');
|
||||||
const meta = require('../meta');
|
const meta = require('../meta');
|
||||||
@@ -88,7 +89,8 @@ module.exports = function (User) {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
groupsToJoin = JSON.parse(groupsToJoin);
|
groupsToJoin = JSON.parse(groupsToJoin);
|
||||||
} catch (e) {
|
} catch (err) {
|
||||||
|
winston.error(`[User.joinGroupsFromInvitation] ${err.stack}`);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -45,7 +45,8 @@ utils.getSass = function () {
|
|||||||
try {
|
try {
|
||||||
const sass = require('sass-embedded');
|
const sass = require('sass-embedded');
|
||||||
return sass;
|
return sass;
|
||||||
} catch (_err) {
|
} catch (err) {
|
||||||
|
console.error(err.message)
|
||||||
return require('sass');
|
return require('sass');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -134,7 +134,7 @@ widgets.getWidgetDataForTemplates = async function (templates) {
|
|||||||
try {
|
try {
|
||||||
returnData[template][location] = parseWidgetData(templateWidgetData[location]);
|
returnData[template][location] = parseWidgetData(templateWidgetData[location]);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
winston.error(`can not parse widget data. template: ${template} location: ${location}`);
|
winston.error(`can not parse widget data. template: ${template} location: ${location}\n${err.stack}`);
|
||||||
returnData[template][location] = [];
|
returnData[template][location] = [];
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -1,8 +0,0 @@
|
|||||||
{
|
|
||||||
"env": {
|
|
||||||
"mocha": true
|
|
||||||
},
|
|
||||||
"rules": {
|
|
||||||
"no-unused-vars": "off"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
const nconf = require('nconf');
|
const nconf = require('nconf');
|
||||||
const assert = require('assert');
|
const assert = require('assert');
|
||||||
const async = require('async');
|
|
||||||
|
|
||||||
const db = require('../mocks/databasemock');
|
const db = require('../mocks/databasemock');
|
||||||
|
|
||||||
@@ -10,7 +9,6 @@ const user = require('../../src/user');
|
|||||||
const groups = require('../../src/groups');
|
const groups = require('../../src/groups');
|
||||||
|
|
||||||
const request = require('../../src/request');
|
const request = require('../../src/request');
|
||||||
const socketUser = require('../../src/socket.io/user');
|
|
||||||
const adminUser = require('../../src/socket.io/admin/user');
|
const adminUser = require('../../src/socket.io/admin/user');
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const assert = require('assert');
|
const assert = require('assert');
|
||||||
const nconf = require('nconf');
|
|
||||||
const util = require('util');
|
|
||||||
|
|
||||||
const db = require('../mocks/databasemock');
|
const db = require('../mocks/databasemock');
|
||||||
|
|
||||||
@@ -16,7 +14,7 @@ const utils = require('../../src/utils');
|
|||||||
|
|
||||||
describe('email confirmation (library methods)', () => {
|
describe('email confirmation (library methods)', () => {
|
||||||
let uid;
|
let uid;
|
||||||
async function dummyEmailerHook(data) {
|
async function dummyEmailerHook() {
|
||||||
// pretend to handle sending emails
|
// pretend to handle sending emails
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -159,7 +157,6 @@ describe('email confirmation (v3 api)', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should have a pending validation', async () => {
|
it('should have a pending validation', async () => {
|
||||||
const code = await db.get(`confirm:byUid:${userObj.uid}`);
|
|
||||||
assert.strictEqual(await user.email.isValidationPending(userObj.uid, 'test@example.org'), true);
|
assert.strictEqual(await user.email.isValidationPending(userObj.uid, 'test@example.org'), true);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -96,6 +96,7 @@ describe('Utility Methods', () => {
|
|||||||
const email = 'sample@example.com';
|
const email = 'sample@example.com';
|
||||||
assert(utils.isEmailValid(email), 'invalid email');
|
assert(utils.isEmailValid(email), 'invalid email');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('rejects empty address', () => {
|
it('rejects empty address', () => {
|
||||||
const email = '';
|
const email = '';
|
||||||
assert.equal(utils.isEmailValid(email), false, 'accepted as valid email');
|
assert.equal(utils.isEmailValid(email), false, 'accepted as valid email');
|
||||||
@@ -560,6 +561,7 @@ describe('Utility Methods', () => {
|
|||||||
const shim = require('../src/translator');
|
const shim = require('../src/translator');
|
||||||
|
|
||||||
const { Translator } = shim;
|
const { Translator } = shim;
|
||||||
|
|
||||||
it('should translate in place', async () => {
|
it('should translate in place', async () => {
|
||||||
const translator = Translator.create('en-GB');
|
const translator = Translator.create('en-GB');
|
||||||
const el = $(`<div><span id="search" title="[[global:search]]"></span><span id="text">[[global:home]]</span></div>`);
|
const el = $(`<div><span id="search" title="[[global:search]]"></span><span id="text">[[global:home]]</span></div>`);
|
||||||
|
|||||||
Reference in New Issue
Block a user