Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pull Request: ESLint Configuration, Dependency Updates, and Type Safety Improvements #1178

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

soulwax
Copy link

@soulwax soulwax commented Dec 28, 2024

Description

I have worked for quite a while on this project, albeit 80% of it went into (learning how to) configuring eslint in an already established environment. This PR comes with a few enhancements to the project, focusing on code quality, security, and maintainability. The main changes include:

ESLint Configuration: A new flat ESLint configuration file (eslint.config.js) has been added to the project. This configuration defines a set of linting rules to ensure consistent code style and catch potential issues early in the development process. The linter has been run on the codebase, and any identified problems have been fixed.

Dependency Updates: Critical dependencies have been updated to their latest versions while I also tested everything thoroughly in order to not break anything. The updates address security vulnerabilities and some of them came from dependabot out of the blue after forking your original. I tested mainly on unix OSes using node v18 and v20 as you intended from what I took out of your dovcs. Project works fine with v18, v20 is problematic on windows due to discordjs/opus but that's a known problem not related to muse.

Type Safety Improvements: To enhance type safety, occurrences of any have been converted to unknown where appropriate. This should help catch potential type-related issues down the line.

Husky Configuration: The Husky configuration has been resolved to facilitate easier contributions to the project. Any future contributors shouldn't have husky serve as a gatekeeper against linting problems.

Motivation and Context

I like and use a fork of the bot myself for quite some time now albeit I am rewriting a different approach from scratch either.

How Has This Been Tested?

The changes introduced in this pull request have been thoroughly enough tested to ensure that the project's functionality remains intact and there are only wins for everyone involved, be it non techies or active cooooontributors. The ESLint rules have been applied to the codebase, and any identified issues have been resolved.

Types of Changes, let's try out those checkboxes lol

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

Related Issues

  • Resolves: broadband

Acknowledgements

Max Isom's great work for a not sucking discord music bot.

Introduce: ESLint flat config file `eslint.config.js` and update some critical dependencies to their latest versions for better security and partly compatibility. More recent node version is still recommended.

Chore: Resolves a few critical vulnerabilities, implement working flat eslint by:
introducing ESLint configuration. Fix problems defined by the linter.

Chore: Ensure type safety by converting any's into unknowns, while preserving full functionality across the board.

ESLint config file is mainly for linting rules for now.

Resolves errors with husky in order to make contribution easier.

Low-Mid Priority PR, a sort of Hello to Max.
@codetheweb
Copy link
Collaborator

📦 🤖 A new release has been made for this pull request.

To play around with this PR, pull ghcr.io/museofficial/muse:pr-1178.

Images are available for x86_64 and ARM64.

Latest commit: 707243f

@soulwax
Copy link
Author

soulwax commented Dec 29, 2024

Can you elaborate? Did you abandon the project, or only release docker images now? Otherwise why not just merge the PR?

@Codixer
Copy link
Contributor

Codixer commented Dec 29, 2024

@soulwax that message is from a bot, not the creator himself. Look at uhhhhh, #1063.

Copy link
Contributor

@Codixer Codixer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While I can understand some changes, almost half to the entire code here looks like it's been thrown through a fault checker with intellisense and/or ran through CoPilot/ChatGPT.

What's the use of all these changes (commented ones).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like it has been added with chatgpt, why should this be added exactly?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not widly known with eslint configuration, I'm assuming this is added for linting during development. Instead of only during committing?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like it has only been ordered correctly. No functional changes what-so-ever.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like it has only been ordered correctly. No functional changes what-so-ever.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Has the bot been checked to still work with all these dependencies? I tried updating some a while back and they still broke the functionality of the bot.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So I'm assuming here that several variables have been changed and or replaced. What about the code it was attached to?

@@ -75,7 +75,7 @@ export default class {

async search(query: string, shouldSplitChapters: boolean): Promise<SongMetadata[]> {
const {items} = await this.ytsrQueue.add(async () => this.cache.wrap(
ytsr,
async (...args) => ytsr(args[0] as string, args[1] as ytsr.Options),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What made this change come up?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants