Updated types and dependencies #18

Merged
FrauJulian merged 6 commits from fraujulian into master 2025-10-10 16:12:13 +00:00
FrauJulian commented 2025-10-10 16:02:22 +00:00 (Migrated from github.com)

This pull request introduces several improvements focused on code quality, developer tooling, and documentation for the discord-audio-stream package. The most significant changes include the addition of a comprehensive ESLint and Prettier setup, new pre-commit hooks for code formatting and linting, updates to documentation for clarity, and the introduction of a new AudioManager class. These updates aim to standardize code style, enhance maintainability, and provide clearer guidance for users and contributors.

Developer Tooling and Code Quality

  • Added ESLint configuration (eslint.config.cjs, eslint.config.typeaware.cjs) with TypeScript and import rules, as well as plugins for promises and unused imports, improving code consistency and error detection. [1] [2]
  • Introduced Prettier configuration (.prettierrc) for standardized code formatting, and set up lint-staged and Husky pre-commit hooks to automatically format and lint code before commits. [1] [2] [3]

Documentation Updates

  • Improved installation instructions and clarified required dependencies in README.md, including supported package managers and encryption library requirements. Also updated method documentation and contributor credits for clarity. [1] [2] [3]

Core Functionality

  • Added a new AudioManager class (src/audio-manager.ts) that encapsulates voice connection and audio playback logic, providing a clear API for managing Discord audio streams.

Package Management

  • Updated package.json to version 0.6.16, added new dependencies for linting and formatting, improved script naming and structure, and refined keywords for better discoverability. [1] [2]
  • Updated pnpm-workspace.yaml to ignore certain built dependencies, streamlining workspace management.
This pull request introduces several improvements focused on code quality, developer tooling, and documentation for the `discord-audio-stream` package. The most significant changes include the addition of a comprehensive ESLint and Prettier setup, new pre-commit hooks for code formatting and linting, updates to documentation for clarity, and the introduction of a new `AudioManager` class. These updates aim to standardize code style, enhance maintainability, and provide clearer guidance for users and contributors. **Developer Tooling and Code Quality** * Added ESLint configuration (`eslint.config.cjs`, `eslint.config.typeaware.cjs`) with TypeScript and import rules, as well as plugins for promises and unused imports, improving code consistency and error detection. [[1]](diffhunk://#diff-ade92dc557e1c37f3e97d3323edfba82ec5ae154ff4325ddd06962631a5c2666R1-R101) [[2]](diffhunk://#diff-6539c9fd76705b79e2782d037eb247f5c02cd4002580c86eb2dd76fefaf8efa7R1-R25) * Introduced Prettier configuration (`.prettierrc`) for standardized code formatting, and set up `lint-staged` and Husky pre-commit hooks to automatically format and lint code before commits. [[1]](diffhunk://#diff-663ade211b3a1552162de21c4031fcd16be99407aae5ceecbb491a2efc43d5d2R1-R13) [[2]](diffhunk://#diff-d2bc4bbf14eadc292d84e0ef5f7a93115c23557f533809fc80b896934291529dR1-R3) [[3]](diffhunk://#diff-7ae45ad102eab3b6d7e7896acd08c427a9b25b346470d7bc6507b6481575d519L28-R79) **Documentation Updates** * Improved installation instructions and clarified required dependencies in `README.md`, including supported package managers and encryption library requirements. Also updated method documentation and contributor credits for clarity. [[1]](diffhunk://#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5L18-R36) [[2]](diffhunk://#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5L57-R73) [[3]](diffhunk://#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5L82-L120) **Core Functionality** * Added a new `AudioManager` class (`src/audio-manager.ts`) that encapsulates voice connection and audio playback logic, providing a clear API for managing Discord audio streams. **Package Management** * Updated `package.json` to version `0.6.16`, added new dependencies for linting and formatting, improved script naming and structure, and refined keywords for better discoverability. [[1]](diffhunk://#diff-7ae45ad102eab3b6d7e7896acd08c427a9b25b346470d7bc6507b6481575d519L3-R3) [[2]](diffhunk://#diff-7ae45ad102eab3b6d7e7896acd08c427a9b25b346470d7bc6507b6481575d519L28-R79) * Updated `pnpm-workspace.yaml` to ignore certain built dependencies, streamlining workspace management.
copilot-pull-request-reviewer[bot] (Migrated from github.com) reviewed 2025-10-10 16:03:13 +00:00
copilot-pull-request-reviewer[bot] (Migrated from github.com) left a comment

Pull Request Overview

This pull request introduces comprehensive code quality improvements and developer tooling for the discord-audio-stream package. The changes focus on establishing consistent code formatting, linting standards, and modernizing the codebase structure while maintaining the same functionality.

  • Added ESLint and Prettier configurations with pre-commit hooks for automated code quality enforcement
  • Reorganized and renamed the core AudioManager class file from audioManager.ts to audio-manager.ts following kebab-case conventions
  • Updated package dependencies, build scripts, and documentation to reflect modern development practices

Reviewed Changes

Copilot reviewed 12 out of 19 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
eslint.config.cjs Base ESLint configuration with TypeScript, import, and promise rules
eslint.config.typeaware.cjs Extended ESLint config with TypeScript type-aware rules
tsconfig.eslint.json TypeScript configuration specifically for ESLint
.prettierrc Code formatting configuration
.husky/pre-commit Pre-commit hook for automated formatting and linting
pnpm-workspace.yaml Workspace configuration ignoring built dependencies
package.json Updated dependencies, scripts, and project metadata
src/index.ts Updated export path to match renamed AudioManager file
src/audioManager.ts Removed old AudioManager implementation
src/audio-manager.ts Reformatted AudioManager with consistent code style
tsup.config.ts Applied consistent formatting to build configuration
README.md Enhanced installation instructions and documentation clarity
Comments suppressed due to low confidence (1)

package.json:1

  • The del-cli dependency was removed but is still referenced in the clean:dist script on line 35. This will cause the build script to fail.
{

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

## Pull Request Overview This pull request introduces comprehensive code quality improvements and developer tooling for the `discord-audio-stream` package. The changes focus on establishing consistent code formatting, linting standards, and modernizing the codebase structure while maintaining the same functionality. - Added ESLint and Prettier configurations with pre-commit hooks for automated code quality enforcement - Reorganized and renamed the core AudioManager class file from `audioManager.ts` to `audio-manager.ts` following kebab-case conventions - Updated package dependencies, build scripts, and documentation to reflect modern development practices ### Reviewed Changes Copilot reviewed 12 out of 19 changed files in this pull request and generated 3 comments. <details> <summary>Show a summary per file</summary> | File | Description | | ---- | ----------- | | `eslint.config.cjs` | Base ESLint configuration with TypeScript, import, and promise rules | | `eslint.config.typeaware.cjs` | Extended ESLint config with TypeScript type-aware rules | | `tsconfig.eslint.json` | TypeScript configuration specifically for ESLint | | `.prettierrc` | Code formatting configuration | | `.husky/pre-commit` | Pre-commit hook for automated formatting and linting | | `pnpm-workspace.yaml` | Workspace configuration ignoring built dependencies | | `package.json` | Updated dependencies, scripts, and project metadata | | `src/index.ts` | Updated export path to match renamed AudioManager file | | `src/audioManager.ts` | Removed old AudioManager implementation | | `src/audio-manager.ts` | Reformatted AudioManager with consistent code style | | `tsup.config.ts` | Applied consistent formatting to build configuration | | `README.md` | Enhanced installation instructions and documentation clarity | </details> <details> <summary>Comments suppressed due to low confidence (1)</summary> **package.json:1** * The `del-cli` dependency was removed but is still referenced in the `clean:dist` script on line 35. This will cause the build script to fail. ``` { ``` </details> --- <sub>**Tip:** Customize your code reviews with copilot-instructions.md. <a href="/FrauJulian/Discord-Audio-Stream/new/master/.github?filename=copilot-instructions.md" class="Link--inTextBlock" target="_blank" rel="noopener noreferrer">Create the file</a> or <a href="https://docs.github.com/en/copilot/customizing-copilot/adding-repository-custom-instructions-for-github-copilot" class="Link--inTextBlock" target="_blank" rel="noopener noreferrer">learn how to get started</a>.</sub>
@@ -57,3 +80,4 @@
"ts-jest": "^29.4.5",
"tsup": "^8.5.0",
"typescript": "^5.9.3"
},
copilot-pull-request-reviewer[bot] (Migrated from github.com) commented 2025-10-10 16:03:13 +00:00

TypeScript ESLint dependencies should be in devDependencies since they're development tools, not runtime dependencies required by package consumers.

    "@discordjs/voice": "^0.19.0"
  },
  "devDependencies": {
    "@typescript-eslint/eslint-plugin": "^8.46.0",
    "@typescript-eslint/parser": "^8.46.0",
TypeScript ESLint dependencies should be in devDependencies since they're development tools, not runtime dependencies required by package consumers. ```suggestion "@discordjs/voice": "^0.19.0" }, "devDependencies": { "@typescript-eslint/eslint-plugin": "^8.46.0", "@typescript-eslint/parser": "^8.46.0", ```
@@ -0,0 +1,159 @@
import type { AudioPlayer, AudioResource, VoiceConnection } from '@discordjs/voice';
import { createAudioPlayer, createAudioResource, joinVoiceChannel } from '@discordjs/voice';
import { join } from 'node:path';
import type { VoiceAudioDataModel, VoiceConnectionDataModel } from './index.d';
copilot-pull-request-reviewer[bot] (Migrated from github.com) commented 2025-10-10 16:03:13 +00:00

The import path './index.d' appears to be incorrect. TypeScript definition files typically use '.d.ts' extension, and this path doesn't match the file structure shown in the changes.

import type { VoiceAudioDataModel, VoiceConnectionDataModel } from './index.d.ts';
The import path './index.d' appears to be incorrect. TypeScript definition files typically use '.d.ts' extension, and this path doesn't match the file structure shown in the changes. ```suggestion import type { VoiceAudioDataModel, VoiceConnectionDataModel } from './index.d.ts'; ```
@@ -0,0 +152,4 @@
private CheckIfNull<T>(value: T | null): boolean {
if (value === null) {
throw new Error(`${value} cannot be null in this case.`);
}
copilot-pull-request-reviewer[bot] (Migrated from github.com) commented 2025-10-10 16:03:13 +00:00

The error message will always display 'null' since value is null when the condition is true. The message should describe which parameter or property cannot be null.

The error message will always display 'null' since `value` is null when the condition is true. The message should describe which parameter or property cannot be null.
FrauJulian (Migrated from github.com) reviewed 2025-10-10 16:09:34 +00:00
@@ -0,0 +1,159 @@
import type { AudioPlayer, AudioResource, VoiceConnection } from '@discordjs/voice';
import { createAudioPlayer, createAudioResource, joinVoiceChannel } from '@discordjs/voice';
import { join } from 'node:path';
import type { VoiceAudioDataModel, VoiceConnectionDataModel } from './index.d';
FrauJulian (Migrated from github.com) commented 2025-10-10 16:09:34 +00:00

doesnt make sense

doesnt make sense
FrauJulian (Migrated from github.com) reviewed 2025-10-10 16:10:03 +00:00
@@ -0,0 +152,4 @@
private CheckIfNull<T>(value: T | null): boolean {
if (value === null) {
throw new Error(`${value} cannot be null in this case.`);
}
FrauJulian (Migrated from github.com) commented 2025-10-10 16:10:03 +00:00

nope? guess not

nope? guess not
FrauJulian (Migrated from github.com) reviewed 2025-10-10 16:10:31 +00:00
@@ -57,3 +80,4 @@
"ts-jest": "^29.4.5",
"tsup": "^8.5.0",
"typescript": "^5.9.3"
},
FrauJulian (Migrated from github.com) commented 2025-10-10 16:10:31 +00:00

nope best pratise is this:

nope best pratise is this:
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: fraujulian/Discord-Audio-Stream#18