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

feat: rework eslint config #188

Merged
merged 15 commits into from
Aug 12, 2024
3 changes: 0 additions & 3 deletions .eslintignore

This file was deleted.

15 changes: 0 additions & 15 deletions .eslintrc.json

This file was deleted.

1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
.idea
.gitattributes
.DS_Store
.vscode
node_modules/
dist/
package-lock.json
Expand Down
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"editor.insertSpaces": false
}
4 changes: 4 additions & 0 deletions eslint.config.mjs
0t4u marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// @ts-check
import config from '@shipgirl/eslint-config';

export default [ ...config(import.meta.dirname) ];
25 changes: 15 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"build": "npm run build:ts && npm run build:docs",
"build:ts": "tsup --config tsup-config.json",
"build:docs": "typedoc --theme default --readme README.md --out docs/ --entryPointStrategy expand src/.",
"lint": "eslint --fix --ext .ts",
"lint": "eslint .",
"prepare": "npm run build:ts"
},
"keywords": [
Expand Down Expand Up @@ -44,15 +44,20 @@
"ws": "^8.18.0"
},
"devDependencies": {
"@augu/eslint-config": "4.0.1",
"@types/node": "^20.14.11",
"@augu/eslint-config": "5.2.4",
"@eslint/js": "^9.9.0",
"@shipgirl/eslint-config": "^0.2.0",
"@stylistic/eslint-plugin": "^2.6.2",
"@types/eslint__js": "^8.42.3",
"@types/node": "^22.2.0",
"@types/node-fetch": "^2.6.11",
"@types/ws": "^8.5.11",
"@typescript-eslint/eslint-plugin": "^7.16.1",
"@typescript-eslint/parser": "^7.16.1",
"eslint": "^8.56.0",
"tsup": "^8.2.0",
"typedoc": "^0.26.4",
"typescript": "^5.5.3"
"@types/ws": "^8.5.12",
"@typescript-eslint/eslint-plugin": "^8.0.1",
"@typescript-eslint/parser": "^8.0.1",
"eslint": "^9.9.0",
"tsup": "^8.2.4",
"typedoc": "^0.26.5",
"typescript": "^5.5.4",
"typescript-eslint": "^8.0.1"
}
}
74 changes: 37 additions & 37 deletions src/Constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,56 +2,56 @@
import { NodeOption, ShoukakuOptions } from './Shoukaku';

export enum State {
CONNECTING,
NEARLY,
CONNECTED,
RECONNECTING,
DISCONNECTING,
DISCONNECTED
CONNECTING,

Check warning on line 5 in src/Constants.ts

View workflow job for this annotation

GitHub Actions / build

'CONNECTING' is defined but never used

Check warning on line 5 in src/Constants.ts

View workflow job for this annotation

GitHub Actions / build

'CONNECTING' is defined but never used
NEARLY,

Check warning on line 6 in src/Constants.ts

View workflow job for this annotation

GitHub Actions / build

'NEARLY' is defined but never used

Check warning on line 6 in src/Constants.ts

View workflow job for this annotation

GitHub Actions / build

'NEARLY' is defined but never used
CONNECTED,

Check warning on line 7 in src/Constants.ts

View workflow job for this annotation

GitHub Actions / build

'CONNECTED' is defined but never used

Check warning on line 7 in src/Constants.ts

View workflow job for this annotation

GitHub Actions / build

'CONNECTED' is defined but never used
RECONNECTING,

Check warning on line 8 in src/Constants.ts

View workflow job for this annotation

GitHub Actions / build

'RECONNECTING' is defined but never used

Check warning on line 8 in src/Constants.ts

View workflow job for this annotation

GitHub Actions / build

'RECONNECTING' is defined but never used
DISCONNECTING,

Check warning on line 9 in src/Constants.ts

View workflow job for this annotation

GitHub Actions / build

'DISCONNECTING' is defined but never used

Check warning on line 9 in src/Constants.ts

View workflow job for this annotation

GitHub Actions / build

'DISCONNECTING' is defined but never used
DISCONNECTED

Check warning on line 10 in src/Constants.ts

View workflow job for this annotation

GitHub Actions / build

'DISCONNECTED' is defined but never used

Check warning on line 10 in src/Constants.ts

View workflow job for this annotation

GitHub Actions / build

'DISCONNECTED' is defined but never used
}

export enum VoiceState {
SESSION_READY,
SESSION_ID_MISSING,
SESSION_ENDPOINT_MISSING,
SESSION_FAILED_UPDATE
SESSION_READY,

Check warning on line 14 in src/Constants.ts

View workflow job for this annotation

GitHub Actions / build

'SESSION_READY' is defined but never used

Check warning on line 14 in src/Constants.ts

View workflow job for this annotation

GitHub Actions / build

'SESSION_READY' is defined but never used
SESSION_ID_MISSING,

Check warning on line 15 in src/Constants.ts

View workflow job for this annotation

GitHub Actions / build

'SESSION_ID_MISSING' is defined but never used

Check warning on line 15 in src/Constants.ts

View workflow job for this annotation

GitHub Actions / build

'SESSION_ID_MISSING' is defined but never used
SESSION_ENDPOINT_MISSING,

Check warning on line 16 in src/Constants.ts

View workflow job for this annotation

GitHub Actions / build

'SESSION_ENDPOINT_MISSING' is defined but never used

Check warning on line 16 in src/Constants.ts

View workflow job for this annotation

GitHub Actions / build

'SESSION_ENDPOINT_MISSING' is defined but never used
SESSION_FAILED_UPDATE

Check warning on line 17 in src/Constants.ts

View workflow job for this annotation

GitHub Actions / build

'SESSION_FAILED_UPDATE' is defined but never used

Check warning on line 17 in src/Constants.ts

View workflow job for this annotation

GitHub Actions / build

'SESSION_FAILED_UPDATE' is defined but never used
}

export enum OpCodes {
PLAYER_UPDATE = 'playerUpdate',
STATS = 'stats',
EVENT = 'event',
READY = 'ready'
PLAYER_UPDATE = 'playerUpdate',
STATS = 'stats',
EVENT = 'event',
READY = 'ready'
}

export enum Versions {
REST_VERSION = 4,
WEBSOCKET_VERSION = 4
}
export const Versions = {
REST_VERSION: 4,
WEBSOCKET_VERSION: 4
};

export const ShoukakuDefaults: Required<ShoukakuOptions> = {
resume: false,
resumeTimeout: 30,
resumeByLibrary: false,
reconnectTries: 3,
reconnectInterval: 5,
restTimeout: 60,
moveOnDisconnect: false,
userAgent: 'Discord Bot/unknown (https://github.com/shipgirlproject/Shoukaku.git)',
structures: {},
voiceConnectionTimeout: 15,
nodeResolver: (nodes) => [ ...nodes.values() ]
.filter(node => node.state === State.CONNECTED)
.sort((a, b) => a.penalties - b.penalties)
.shift()
resume: false,
resumeTimeout: 30,
resumeByLibrary: false,
reconnectTries: 3,
reconnectInterval: 5,
restTimeout: 60,
moveOnDisconnect: false,
userAgent: 'Discord Bot/unknown (https://github.com/shipgirlproject/Shoukaku.git)',
structures: {},
voiceConnectionTimeout: 15,
nodeResolver: (nodes) => [ ...nodes.values() ]
.filter(node => node.state === State.CONNECTED)
.sort((a, b) => a.penalties - b.penalties)
.shift()
};

export const ShoukakuClientInfo = `${Info.name}/${Info.version} (${Info.repository.url})`;

export const NodeDefaults: NodeOption = {
name: 'Default',
url: '',
auth: '',
secure: false,
group: undefined
name: 'Default',
url: '',
auth: '',
secure: false,
group: undefined
};
Loading