Skip to content

Commit

Permalink
deps: update eslint to v9 (#648)
Browse files Browse the repository at this point in the history
* deps: update to eslint 9

* Remove unused eslint directives

* ci: add @eslint/* modules to eslint group
  • Loading branch information
goto-bus-stop authored Oct 5, 2024
1 parent 84b2d22 commit c8dd501
Show file tree
Hide file tree
Showing 15 changed files with 16 additions and 22 deletions.
1 change: 1 addition & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ updates:
- "eslint"
- "eslint-plugin-*"
- "eslint-config-*"
- "@eslint/*"
- "@typescript-eslint/*"
passport:
patterns:
Expand Down
2 changes: 1 addition & 1 deletion bin/u-wave-core.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env node

/* eslint-disable no-console,n/no-process-exit */
/* eslint-disable n/no-process-exit */
import fs from 'node:fs';
import explain from 'explain-error';
import Ajv from 'ajv';
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
"yaml": "^2.0.0"
},
"devDependencies": {
"@eslint/js": "^8.57.1",
"@eslint/js": "^9.12.0",
"@tsconfig/node18": "^18.2.2",
"@types/bcryptjs": "^2.4.2",
"@types/cookie": "^0.6.0",
Expand Down Expand Up @@ -104,7 +104,7 @@
"concat-stream": "^2.0.0",
"delay": "^6.0.0",
"dotenv": "^16.0.0",
"eslint": "^8.2.0",
"eslint": "^9.12.0",
"eslint-plugin-import": "^2.30.0",
"eslint-plugin-n": "^17.10.2",
"get-port": "^7.0.0",
Expand Down
2 changes: 1 addition & 1 deletion src/Uwave.js
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ class UwaveServer extends EventEmitter {
* a source plugin factory was passed to `sourcePlugin`.
*/
source(sourcePlugin, opts = {}) {
if (typeof sourcePlugin === 'string') { // eslint-disable-line prefer-rest-params
if (typeof sourcePlugin === 'string') {
return this.#sources.get(sourcePlugin);
}

Expand Down
1 change: 0 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable import/extensions */
import Uwave from './Uwave.js';
import HttpApi from './HttpApi.js';
import SocketServer from './SocketServer.js';
Expand Down
1 change: 0 additions & 1 deletion src/plugins/acl.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ class Acl {
if (existingRoles === 0) {
this.#logger.info('no roles found, adding defaults');
for (const [roleName, permissions] of Object.entries(defaultRoles)) {
// eslint-disable-next-line no-await-in-loop
await this.createRole(roleName, permissions);
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/plugins/bans.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class Bans {
*
* @param {User} user A user object.
*/
// eslint-disable-next-line class-methods-use-this

async isBanned(user) {
return isValidBan(user);
}
Expand Down Expand Up @@ -171,7 +171,7 @@ class Bans {
* @param {import('../Uwave.js').default} uw
*/
async function bans(uw) {
uw.bans = new Bans(uw); // eslint-disable-line no-param-reassign
uw.bans = new Bans(uw);
}

export default bans;
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/booth.js
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ class Booth {
*
* @param {PopulateMedia} historyEntry
*/
// eslint-disable-next-line class-methods-use-this

getMediaForPlayback(historyEntry) {
return Object.assign(omit(historyEntry.media, 'sourceData'), {
media: {
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/emotes.js
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ class Emotes {
* @returns {Promise<void>}
*/
async function emotesPlugin(uw) {
uw.emotes = new Emotes(uw); // eslint-disable-line no-param-reassign
uw.emotes = new Emotes(uw);
uw.httpApi.use('/emotes', routes());
}

Expand Down
10 changes: 5 additions & 5 deletions src/plugins/playlists.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ class PlaylistsRepository {
* @param {object} patch
* @returns {Promise<Playlist>}
*/
// eslint-disable-next-line class-methods-use-this

async updatePlaylist(playlist, patch = {}) {
Object.assign(playlist, patch);
await playlist.save();
Expand All @@ -190,7 +190,7 @@ class PlaylistsRepository {
* @param {Playlist} playlist
* @returns {Promise<Playlist>}
*/
// eslint-disable-next-line class-methods-use-this

async shufflePlaylist(playlist) {
playlist.media = shuffle(playlist.media);
await playlist.save();
Expand All @@ -201,7 +201,7 @@ class PlaylistsRepository {
* @param {Playlist} playlist
* @returns {Promise<void>}
*/
// eslint-disable-next-line class-methods-use-this

async deletePlaylist(playlist) {
await playlist.deleteOne();
}
Expand Down Expand Up @@ -535,7 +535,7 @@ class PlaylistsRepository {
* @param {object} patch
* @returns {Promise<PlaylistItem>}
*/
// eslint-disable-next-line class-methods-use-this

async updatePlaylistItem(item, patch = {}) {
Object.assign(item, patch);
await item.save();
Expand All @@ -547,7 +547,7 @@ class PlaylistsRepository {
* @param {ObjectId[]} itemIDs
* @param {{ afterID: ObjectId? }} options
*/
// eslint-disable-next-line class-methods-use-this

async movePlaylistItems(playlist, itemIDs, { afterID }) {
// Use a plain array instead of a mongoose array because we need `splice()`.
const itemsInPlaylist = [...playlist.media];
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/waitlist.js
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ class Waitlist {
* @returns {Promise<void>}
*/
async function waitlistPlugin(uw) {
uw.waitlist = new Waitlist(uw); // eslint-disable-line no-param-reassign
uw.waitlist = new Waitlist(uw);
uw.httpApi.use('/waitlist', routes());
}

Expand Down
1 change: 0 additions & 1 deletion src/sockets/GuestConnection.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ class GuestConnection extends EventEmitter {
this.events.remove();
}

// eslint-disable-next-line class-methods-use-this
toString() {
return 'Guest';
}
Expand Down
2 changes: 1 addition & 1 deletion test/sources.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ describe('Media Sources', () => {
return {
name: 'test-source',
search,
get: get, // eslint-disable-line object-shorthand
get: get,
};
}

Expand Down
3 changes: 0 additions & 3 deletions test/utils/deleteDatabase.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,19 @@ export default async function deleteDatabase(url) {
const mongo = mongoose.createConnection(url);
await once(mongo, 'connected');

/* eslint-disable no-await-in-loop */
for (let i = 0; i < 50; i += 1) {
try {
await mongo.dropDatabase();
break;
} catch (error) {
if (error.code === IN_PROGRESS_ERROR) {
// eslint-disable-next-line no-console
console.log('database op in progress...waiting');
await delay(100);
} else {
throw error;
}
}
}
/* eslint-enable no-await-in-loop */

await mongo.close();
}
1 change: 0 additions & 1 deletion test/waitlist.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ describe('Waitlist', () => {

await Promise.all(users.map(createTestPlaylistItem));
for (const u of users) {
// eslint-disable-next-line no-await-in-loop
await uw.waitlist.addUser(u.id);
}

Expand Down

0 comments on commit c8dd501

Please sign in to comment.