chore: upgrade eslint

This commit is contained in:
Barış Soner Uşaklı 2025-05-01 10:06:00 -04:00
parent dcd2808e23
commit 70ca805f0b
6 changed files with 26 additions and 19 deletions

View file

@ -1,3 +0,0 @@
{
"extends": "nodebb/lib"
}

10
eslint.config.mjs Normal file
View file

@ -0,0 +1,10 @@
'use strict';

import serverConfig from 'eslint-config-nodebb';
import publicConfig from 'eslint-config-nodebb/public';

export default [
...publicConfig,
...serverConfig,
];

View file

@ -33,8 +33,8 @@
"validator": "^13.7.0"
},
"devDependencies": {
"eslint": "^7.32.0",
"eslint-config-nodebb": "^0.0.1",
"eslint-plugin-import": "^2.23.4"
"eslint": "^9.25.1",
"eslint-config-nodebb": "^1.1.4",
"eslint-plugin-import": "^2.31.0"
}
}

View file

@ -89,15 +89,15 @@ define('composer', [

if (!isMobile && window.location.pathname.startsWith(config.relative_path + '/compose')) {
/*
* If this conditional is met, we're no longer in mobile/tablet
* resolution but we've somehow managed to have a mobile
* composer load, so let's go back to the topic
* If this conditional is met, we're no longer in mobile/tablet
* resolution but we've somehow managed to have a mobile
* composer load, so let's go back to the topic
*/
history.back();
} else if (isMobile && !window.location.pathname.startsWith(config.relative_path + '/compose')) {
/*
* In this case, we're in mobile/tablet resolution but the composer
* that loaded was a regular composer, so let's fix the address bar
* In this case, we're in mobile/tablet resolution but the composer
* that loaded was a regular composer, so let's fix the address bar
*/
mobileHistoryAppend();
}
@ -121,7 +121,7 @@ define('composer', [
id = post[type];

// Find a match
for (var uuid in composer.posts) {
for (const uuid of Object.keys(composer.posts)) {
if (composer.posts[uuid].hasOwnProperty(type) && id === composer.posts[uuid][type]) {
return uuid;
}
@ -179,8 +179,8 @@ define('composer', [

composer.findByTid = function (tid) {
// Iterates through the initialised composers and returns the uuid of the matching composer
for (var uuid in composer.posts) {
if (composer.posts.hasOwnProperty(uuid) && composer.posts[uuid].hasOwnProperty('tid') && parseInt(composer.posts[uuid].tid, 10) === parseInt(tid, 10)) {
for (const uuid of Object.keys(composer.posts)) {
if (composer.posts[uuid].hasOwnProperty('tid') && String(composer.posts[uuid].tid) === String(tid)) {
return uuid;
}
}
@ -354,7 +354,7 @@ define('composer', [

postContainer.on('click', '.composer-submit', function (e) {
e.preventDefault();
e.stopPropagation(); // Other click events bring composer back to active state which is undesired on submit
e.stopPropagation(); // Other click events bring composer back to active state which is undesired on submit

$(this).attr('disabled', true);
post(post_uuid);
@ -488,8 +488,8 @@ define('composer', [
submitOptions: [
// Add items using `filter:composer.create`, or just add them to the <ul> in DOM
// {
// action: 'foobar',
// text: 'Text Label',
// action: 'foobar',
// text: 'Text Label',
// }
],
};

View file

@ -29,7 +29,7 @@ define('composer/formatting', [

if (composerObj.action === 'topics.post' || (composerObj.action === 'posts.edit' && composerObj.isMain)) {
topicThumbs.modal.open({ id: uuid, pid: composerObj.pid }).then(() => {
postContainer.trigger('thumb.uploaded'); // toggle draft save
postContainer.trigger('thumb.uploaded'); // toggle draft save

// Update client-side with count
composer.updateThumbCount(uuid, postContainer);

View file

@ -4,7 +4,7 @@ define('composer/post-queue', [], function () {
const postQueue = {};

postQueue.showAlert = async function (postContainer, postData) {
const alertEl = postContainer.find('[component="composer/post-queue/alert"]')
const alertEl = postContainer.find('[component="composer/post-queue/alert"]');
if (!config.postQueue || app.user.isAdmin || app.user.isGlobalMod || app.user.isMod) {
alertEl.remove();
return;