mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-27 09:06:15 +01:00
refactor: switch eslint configs to esm
add rules from https://eslint.style/ refactor for in loops to use Object.entries
This commit is contained in:
@@ -1,11 +1,14 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
const serverConfig = require('eslint-config-nodebb');
|
|
||||||
const publicConfig = require('eslint-config-nodebb/public');
|
|
||||||
|
|
||||||
const { configs } = require('@eslint/js');
|
import serverConfig from 'eslint-config-nodebb';
|
||||||
const globals = require('globals');
|
import publicConfig from 'eslint-config-nodebb/public';
|
||||||
|
|
||||||
module.exports = [
|
import { defineConfig } from 'eslint/config';
|
||||||
|
import globals from 'globals';
|
||||||
|
|
||||||
|
import js from '@eslint/js';
|
||||||
|
|
||||||
|
export default defineConfig([
|
||||||
{
|
{
|
||||||
ignores: [
|
ignores: [
|
||||||
'node_modules/',
|
'node_modules/',
|
||||||
@@ -27,7 +30,6 @@ module.exports = [
|
|||||||
'install/docker/',
|
'install/docker/',
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
configs.recommended,
|
|
||||||
{
|
{
|
||||||
rules: {
|
rules: {
|
||||||
'no-bitwise': 'warn',
|
'no-bitwise': 'warn',
|
||||||
@@ -58,5 +60,5 @@ module.exports = [
|
|||||||
},
|
},
|
||||||
...publicConfig,
|
...publicConfig,
|
||||||
...serverConfig
|
...serverConfig
|
||||||
];
|
]);
|
||||||
|
|
||||||
@@ -162,7 +162,8 @@
|
|||||||
"@commitlint/config-angular": "19.8.0",
|
"@commitlint/config-angular": "19.8.0",
|
||||||
"coveralls": "3.1.1",
|
"coveralls": "3.1.1",
|
||||||
"@eslint/js": "9.24.0",
|
"@eslint/js": "9.24.0",
|
||||||
"eslint-config-nodebb": "1.0.7",
|
"@stylistic/eslint-plugin-js": "4.2.0",
|
||||||
|
"eslint-config-nodebb": "1.1.0",
|
||||||
"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",
|
||||||
|
|||||||
@@ -84,14 +84,10 @@ define('admin/extend/rewards', [
|
|||||||
let inputs;
|
let inputs;
|
||||||
let html = '';
|
let html = '';
|
||||||
|
|
||||||
for (const reward in available) {
|
const selectedReward = available.find(reward => reward.rid === el.attr('data-selected'));
|
||||||
if (available.hasOwnProperty(reward)) {
|
if (selectedReward) {
|
||||||
if (available[reward].rid === el.attr('data-selected')) {
|
inputs = selectedReward.inputs;
|
||||||
inputs = available[reward].inputs;
|
parent.attr('data-rid', selectedReward.rid);
|
||||||
parent.attr('data-rid', available[reward].rid);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!inputs) {
|
if (!inputs) {
|
||||||
@@ -122,10 +118,8 @@ define('admin/extend/rewards', [
|
|||||||
const div = $(this).find('.inputs');
|
const div = $(this).find('.inputs');
|
||||||
const rewards = active[i].rewards;
|
const rewards = active[i].rewards;
|
||||||
|
|
||||||
for (const reward in rewards) {
|
for (const [reward, value] of Object.entries(rewards)) {
|
||||||
if (rewards.hasOwnProperty(reward)) {
|
div.find('[name="' + reward + '"]').val(value);
|
||||||
div.find('[name="' + reward + '"]').val(rewards[reward]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -117,23 +117,21 @@ define('admin/extend/widgets', [
|
|||||||
area.find('.widget-panel[data-widget]').each(function () {
|
area.find('.widget-panel[data-widget]').each(function () {
|
||||||
const widgetData = {};
|
const widgetData = {};
|
||||||
const data = $(this).find('form').serializeArray();
|
const data = $(this).find('form').serializeArray();
|
||||||
|
data.forEach((widgetField) => {
|
||||||
for (const d in data) {
|
const { name, value } = widgetField;
|
||||||
if (data.hasOwnProperty(d)) {
|
if (name) {
|
||||||
if (data[d].name) {
|
if (widgetData[name]) {
|
||||||
if (widgetData[data[d].name]) {
|
if (!Array.isArray(widgetData[name])) {
|
||||||
if (!Array.isArray(widgetData[data[d].name])) {
|
widgetData[name] = [
|
||||||
widgetData[data[d].name] = [
|
widgetData[name],
|
||||||
widgetData[data[d].name],
|
];
|
||||||
];
|
|
||||||
}
|
|
||||||
widgetData[data[d].name].push(data[d].value);
|
|
||||||
} else {
|
|
||||||
widgetData[data[d].name] = data[d].value;
|
|
||||||
}
|
}
|
||||||
|
widgetData[name].push(value);
|
||||||
|
} else {
|
||||||
|
widgetData[name] = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
|
|
||||||
widgets.push({
|
widgets.push({
|
||||||
widget: $(this).attr('data-widget'),
|
widget: $(this).attr('data-widget'),
|
||||||
|
|||||||
@@ -215,10 +215,8 @@ define('admin/settings', [
|
|||||||
return callback(err);
|
return callback(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const field in data) {
|
for (const [field, value] of Object.entries(data)) {
|
||||||
if (data.hasOwnProperty(field)) {
|
app.config[field] = value;
|
||||||
app.config[field] = data[field];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
callback();
|
callback();
|
||||||
|
|||||||
@@ -192,7 +192,6 @@ if (document.readyState === 'loading') {
|
|||||||
const pageParams = utils.params();
|
const pageParams = utils.params();
|
||||||
function queryMatch(search) {
|
function queryMatch(search) {
|
||||||
const mySearchParams = new URLSearchParams(search);
|
const mySearchParams = new URLSearchParams(search);
|
||||||
// eslint-disable-next-line no-restricted-syntax
|
|
||||||
for (const [key, value] of mySearchParams) {
|
for (const [key, value] of mySearchParams) {
|
||||||
if (pageParams[key] === value) {
|
if (pageParams[key] === value) {
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -75,17 +75,15 @@ define('forum/account/settings', [
|
|||||||
api.put(`/users/${ajaxify.data.uid}/settings`, { settings }).then((newSettings) => {
|
api.put(`/users/${ajaxify.data.uid}/settings`, { settings }).then((newSettings) => {
|
||||||
alerts.success('[[success:settings-saved]]');
|
alerts.success('[[success:settings-saved]]');
|
||||||
let languageChanged = false;
|
let languageChanged = false;
|
||||||
for (const key in newSettings) {
|
for (const [key, value] of Object.entries(newSettings)) {
|
||||||
if (newSettings.hasOwnProperty(key)) {
|
if (key === 'userLang' && config.userLang !== newSettings.userLang) {
|
||||||
if (key === 'userLang' && config.userLang !== newSettings.userLang) {
|
languageChanged = true;
|
||||||
languageChanged = true;
|
}
|
||||||
}
|
if (key === 'bootswatchSkin') {
|
||||||
if (key === 'bootswatchSkin') {
|
savedSkin = newSettings.bootswatchSkin;
|
||||||
savedSkin = newSettings.bootswatchSkin;
|
config.bootswatchSkin = savedSkin === 'noskin' ? '' : savedSkin;
|
||||||
config.bootswatchSkin = savedSkin === 'noskin' ? '' : savedSkin;
|
} else if (config.hasOwnProperty(key)) {
|
||||||
} else if (config.hasOwnProperty(key)) {
|
config[key] = value;
|
||||||
config[key] = newSettings[key];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -103,10 +103,8 @@ export function enableFilterForm() {
|
|||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
// Persona; parse ajaxify data to set form values to reflect current filters
|
// Persona; parse ajaxify data to set form values to reflect current filters
|
||||||
for (const filter in ajaxify.data.filters) {
|
for (const [filter, value] of Object.entries(ajaxify.data.filters)) {
|
||||||
if (ajaxify.data.filters.hasOwnProperty(filter)) {
|
$filtersEl.find('[name="' + filter + '"]').val(value);
|
||||||
$filtersEl.find('[name="' + filter + '"]').val(ajaxify.data.filters[filter]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
$filtersEl.find('[name="sort"]').val(ajaxify.data.sort);
|
$filtersEl.find('[name="sort"]').val(ajaxify.data.sort);
|
||||||
|
|
||||||
|
|||||||
@@ -50,18 +50,14 @@ define('forum/topic/events', [
|
|||||||
|
|
||||||
Events.init = function () {
|
Events.init = function () {
|
||||||
Events.removeListeners();
|
Events.removeListeners();
|
||||||
for (const eventName in events) {
|
for (const [eventName, handler] of Object.entries(events)) {
|
||||||
if (events.hasOwnProperty(eventName)) {
|
socket.on(eventName, handler);
|
||||||
socket.on(eventName, events[eventName]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
Events.removeListeners = function () {
|
Events.removeListeners = function () {
|
||||||
for (const eventName in events) {
|
for (const [eventName, handler] of Object.entries(events)) {
|
||||||
if (events.hasOwnProperty(eventName)) {
|
socket.removeListener(eventName, handler);
|
||||||
socket.removeListener(eventName, events[eventName]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -180,14 +180,12 @@ module.exports = function (utils, Benchpress, relative_path) {
|
|||||||
|
|
||||||
function spawnPrivilegeStates(cid, member, privileges, types) {
|
function spawnPrivilegeStates(cid, member, privileges, types) {
|
||||||
const states = [];
|
const states = [];
|
||||||
for (const priv in privileges) {
|
for (const [priv, state] of Object.entries(privileges)) {
|
||||||
if (privileges.hasOwnProperty(priv)) {
|
states.push({
|
||||||
states.push({
|
name: priv,
|
||||||
name: priv,
|
state: state,
|
||||||
state: privileges[priv],
|
type: types[priv],
|
||||||
type: types[priv],
|
});
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return states.map(function (priv) {
|
return states.map(function (priv) {
|
||||||
const guestDisabled = ['groups:moderate', 'groups:posts:upvote', 'groups:posts:downvote', 'groups:local:login', 'groups:group:create'];
|
const guestDisabled = ['groups:moderate', 'groups:posts:upvote', 'groups:posts:downvote', 'groups:local:login', 'groups:group:create'];
|
||||||
|
|||||||
@@ -255,7 +255,6 @@ define('iconSelect', ['benchpress', 'bootbox'], function (Benchpress, bootbox) {
|
|||||||
className: 'btn-default',
|
className: 'btn-default',
|
||||||
callback: function () {
|
callback: function () {
|
||||||
el.removeClass(selected.icon);
|
el.removeClass(selected.icon);
|
||||||
// eslint-disable-next-line no-restricted-syntax
|
|
||||||
for (const style of selected.styles) {
|
for (const style of selected.styles) {
|
||||||
el.removeClass(style);
|
el.removeClass(style);
|
||||||
}
|
}
|
||||||
@@ -272,11 +271,9 @@ define('iconSelect', ['benchpress', 'bootbox'], function (Benchpress, bootbox) {
|
|||||||
const newIcon = cleanFAClass(iconClass);
|
const newIcon = cleanFAClass(iconClass);
|
||||||
if (newIcon.icon) {
|
if (newIcon.icon) {
|
||||||
el.removeClass(selected.icon).addClass(newIcon.icon);
|
el.removeClass(selected.icon).addClass(newIcon.icon);
|
||||||
// eslint-disable-next-line no-restricted-syntax
|
|
||||||
for (const style of selected.styles || []) {
|
for (const style of selected.styles || []) {
|
||||||
el.removeClass(style);
|
el.removeClass(style);
|
||||||
}
|
}
|
||||||
// eslint-disable-next-line no-restricted-syntax
|
|
||||||
for (const style of newIcon.styles || []) {
|
for (const style of newIcon.styles || []) {
|
||||||
el.addClass(style);
|
el.addClass(style);
|
||||||
}
|
}
|
||||||
@@ -391,7 +388,6 @@ define('iconSelect', ['benchpress', 'bootbox'], function (Benchpress, bootbox) {
|
|||||||
function cleanFAClass(classList) {
|
function cleanFAClass(classList) {
|
||||||
const styles = [];
|
const styles = [];
|
||||||
let icon;
|
let icon;
|
||||||
// eslint-disable-next-line no-restricted-syntax
|
|
||||||
for (const className of classList) {
|
for (const className of classList) {
|
||||||
if (className.startsWith('fa-') && !excludedClassRegex.test(className)) {
|
if (className.startsWith('fa-') && !excludedClassRegex.test(className)) {
|
||||||
if (styleRegex.test(className)) {
|
if (styleRegex.test(className)) {
|
||||||
|
|||||||
@@ -267,7 +267,7 @@ define('search', [
|
|||||||
|
|
||||||
function createQueryString(data) {
|
function createQueryString(data) {
|
||||||
const searchIn = data.in || 'titles';
|
const searchIn = data.in || 'titles';
|
||||||
let term = data.term.replace(/^[ ?#]*/, '');
|
const term = data.term.replace(/^[ ?#]*/, '');
|
||||||
|
|
||||||
const query = {
|
const query = {
|
||||||
...data,
|
...data,
|
||||||
|
|||||||
@@ -2,12 +2,9 @@
|
|||||||
|
|
||||||
|
|
||||||
define('settings', ['hooks', 'alerts'], function (hooks, alerts) {
|
define('settings', ['hooks', 'alerts'], function (hooks, alerts) {
|
||||||
let Settings;
|
|
||||||
let onReady = [];
|
let onReady = [];
|
||||||
let waitingJobs = 0;
|
let waitingJobs = 0;
|
||||||
|
|
||||||
let helper;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Returns the hook of given name that matches the given type or element.
|
Returns the hook of given name that matches the given type or element.
|
||||||
@param type The type of the element to get the matching hook for, or the element itself.
|
@param type The type of the element to get the matching hook for, or the element itself.
|
||||||
@@ -29,7 +26,7 @@ define('settings', ['hooks', 'alerts'], function (hooks, alerts) {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
helper = {
|
const helper = {
|
||||||
/**
|
/**
|
||||||
@returns Object A deep clone of the given object.
|
@returns Object A deep clone of the given object.
|
||||||
*/
|
*/
|
||||||
@@ -48,10 +45,8 @@ define('settings', ['hooks', 'alerts'], function (hooks, alerts) {
|
|||||||
*/
|
*/
|
||||||
createElement: function (tagName, data, text) {
|
createElement: function (tagName, data, text) {
|
||||||
const element = document.createElement(tagName);
|
const element = document.createElement(tagName);
|
||||||
for (const k in data) {
|
for (const [k, val] of Object.entries(data)) {
|
||||||
if (data.hasOwnProperty(k)) {
|
element.setAttribute(k, val);
|
||||||
element.setAttribute(k, data[k]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (text) {
|
if (text) {
|
||||||
element.appendChild(document.createTextNode(text));
|
element.appendChild(document.createTextNode(text));
|
||||||
@@ -331,7 +326,7 @@ define('settings', ['hooks', 'alerts'], function (hooks, alerts) {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
Settings = {
|
const Settings = {
|
||||||
helper: helper,
|
helper: helper,
|
||||||
plugins: {},
|
plugins: {},
|
||||||
cfg: {},
|
cfg: {},
|
||||||
|
|||||||
@@ -45,16 +45,13 @@ define('settings/array', function () {
|
|||||||
element.attr('data-parent', '_' + key);
|
element.attr('data-parent', '_' + key);
|
||||||
delete attributes['data-type'];
|
delete attributes['data-type'];
|
||||||
delete attributes.tagName;
|
delete attributes.tagName;
|
||||||
for (const name in attributes) {
|
for (const [name, val] of Object.entries(attributes)) {
|
||||||
if (attributes.hasOwnProperty(name)) {
|
if (name.search('data-') === 0) {
|
||||||
const val = attributes[name];
|
element.data(name.substring(5), val);
|
||||||
if (name.search('data-') === 0) {
|
} else if (name.search('prop-') === 0) {
|
||||||
element.data(name.substring(5), val);
|
element.prop(name.substring(5), val);
|
||||||
} else if (name.search('prop-') === 0) {
|
} else {
|
||||||
element.prop(name.substring(5), val);
|
element.attr(name, val);
|
||||||
} else {
|
|
||||||
element.attr(name, val);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
helper.fillField(element, value);
|
helper.fillField(element, value);
|
||||||
|
|||||||
@@ -25,16 +25,13 @@ define('settings/object', function () {
|
|||||||
element.attr('data-prop', prop);
|
element.attr('data-prop', prop);
|
||||||
delete attributes['data-type'];
|
delete attributes['data-type'];
|
||||||
delete attributes.tagName;
|
delete attributes.tagName;
|
||||||
for (const name in attributes) {
|
for (const [name, val] of Object.entries(attributes)) {
|
||||||
if (attributes.hasOwnProperty(name)) {
|
if (name.search('data-') === 0) {
|
||||||
const val = attributes[name];
|
element.data(name.substring(5), val);
|
||||||
if (name.search('data-') === 0) {
|
} else if (name.search('prop-') === 0) {
|
||||||
element.data(name.substring(5), val);
|
element.prop(name.substring(5), val);
|
||||||
} else if (name.search('prop-') === 0) {
|
} else {
|
||||||
element.prop(name.substring(5), val);
|
element.attr(name, val);
|
||||||
} else {
|
|
||||||
element.attr(name, val);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
helper.fillField(element, value);
|
helper.fillField(element, value);
|
||||||
@@ -62,9 +59,7 @@ define('settings/object', function () {
|
|||||||
const properties = element.data('attributes') || element.data('properties');
|
const properties = element.data('attributes') || element.data('properties');
|
||||||
const key = element.data('key') || element.data('parent');
|
const key = element.data('key') || element.data('parent');
|
||||||
let separator = element.data('split') || ', ';
|
let separator = element.data('split') || ', ';
|
||||||
let propertyIndex;
|
|
||||||
let propertyName;
|
|
||||||
let attributes;
|
|
||||||
separator = (function () {
|
separator = (function () {
|
||||||
try {
|
try {
|
||||||
return $(separator);
|
return $(separator);
|
||||||
@@ -77,27 +72,26 @@ define('settings/object', function () {
|
|||||||
if (typeof value !== 'object') {
|
if (typeof value !== 'object') {
|
||||||
value = {};
|
value = {};
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Array.isArray(properties)) {
|
if (Array.isArray(properties)) {
|
||||||
for (propertyIndex in properties) {
|
for (const [propertyIndex, attr] of Object.entries(properties)) {
|
||||||
if (properties.hasOwnProperty(propertyIndex)) {
|
let attributes = attr;
|
||||||
attributes = properties[propertyIndex];
|
if (typeof attr !== 'object') {
|
||||||
if (typeof attributes !== 'object') {
|
attributes = {};
|
||||||
attributes = {};
|
|
||||||
}
|
|
||||||
propertyName = attributes['data-prop'] || attributes['data-property'] || propertyIndex;
|
|
||||||
if (value[propertyName] === undefined && attributes['data-new'] !== undefined) {
|
|
||||||
value[propertyName] = attributes['data-new'];
|
|
||||||
}
|
|
||||||
addObjectPropertyElement(
|
|
||||||
element,
|
|
||||||
key,
|
|
||||||
attributes,
|
|
||||||
propertyName,
|
|
||||||
value[propertyName],
|
|
||||||
separator.clone(),
|
|
||||||
function (el) { element.append(el); }
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
const propertyName = attributes['data-prop'] || attributes['data-property'] || propertyIndex;
|
||||||
|
if (value[propertyName] === undefined && attributes['data-new'] !== undefined) {
|
||||||
|
value[propertyName] = attributes['data-new'];
|
||||||
|
}
|
||||||
|
addObjectPropertyElement(
|
||||||
|
element,
|
||||||
|
key,
|
||||||
|
attributes,
|
||||||
|
propertyName,
|
||||||
|
value[propertyName],
|
||||||
|
separator.clone(),
|
||||||
|
function (el) { element.append(el); }
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -64,7 +64,6 @@ define('settings/sorted-list', [
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
// todo: parse() needs to be refactored to return the html, so multiple calls can be parallelized
|
// todo: parse() needs to be refactored to return the html, so multiple calls can be parallelized
|
||||||
// eslint-disable-next-line no-restricted-syntax
|
|
||||||
for (const { itemUUID, item } of items) {
|
for (const { itemUUID, item } of items) {
|
||||||
// eslint-disable-next-line no-await-in-loop
|
// eslint-disable-next-line no-await-in-loop
|
||||||
const element = await parse($container, itemUUID, item);
|
const element = await parse($container, itemUUID, item);
|
||||||
|
|||||||
@@ -631,7 +631,6 @@ const utils = {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
str = JSON.parse(str);
|
str = JSON.parse(str);
|
||||||
// eslint-disable-next-line no-unused-vars
|
|
||||||
} catch (err) { /* empty */ }
|
} catch (err) { /* empty */ }
|
||||||
|
|
||||||
return str;
|
return str;
|
||||||
|
|||||||
@@ -646,7 +646,7 @@ Mocks.notes.public = async (post) => {
|
|||||||
content: post.content,
|
content: post.content,
|
||||||
published,
|
published,
|
||||||
attachment: normalizeAttachment(noteAttachment),
|
attachment: normalizeAttachment(noteAttachment),
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
let context = await posts.getPostField(post.pid, 'context');
|
let context = await posts.getPostField(post.pid, 'context');
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ const nconf = require('nconf');
|
|||||||
const winston = require('winston');
|
const winston = require('winston');
|
||||||
const validator = require('validator');
|
const validator = require('validator');
|
||||||
const cronJob = require('cron').CronJob;
|
const cronJob = require('cron').CronJob;
|
||||||
const { setTimeout } = require('timers/promises')
|
const { setTimeout } = require('timers/promises');
|
||||||
|
|
||||||
const db = require('../database');
|
const db = require('../database');
|
||||||
const analytics = require('../analytics');
|
const analytics = require('../analytics');
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ utils.getSass = function () {
|
|||||||
const sass = require('sass-embedded');
|
const sass = require('sass-embedded');
|
||||||
return sass;
|
return sass;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error(err.message)
|
console.error(err.message);
|
||||||
return require('sass');
|
return require('sass');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -285,7 +285,6 @@ describe('Utility Methods', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should return passed in value if invalid', (done) => {
|
it('should return passed in value if invalid', (done) => {
|
||||||
// eslint-disable-next-line no-loss-of-precision
|
|
||||||
const bigInt = -111111111111111111;
|
const bigInt = -111111111111111111;
|
||||||
const result = utils.toISOString(bigInt);
|
const result = utils.toISOString(bigInt);
|
||||||
assert.equal(bigInt, result);
|
assert.equal(bigInt, result);
|
||||||
|
|||||||
Reference in New Issue
Block a user