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: use biome instead of eslint for linting #194

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
.github
.idea
.vscode
.eslintignore
.eslintrc.json
.gitattributes
.gitignore
assets/
Expand Down
85 changes: 85 additions & 0 deletions biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
{
"$schema": "https://biomejs.dev/schemas/1.8.3/schema.json",
"organizeImports": {
"enabled": true
},
"linter": {
"enabled": true,
"rules": {
"all": true,
"suspicious": {
"noConfusingVoidType": "off",
"noConsoleLog": "off",
"noEmptyBlockStatements": "off",
"noExplicitAny": "off",
"noGlobalIsFinite": "off",
"noGlobalIsNan": "off",
"useAwait": "off"
},
"style": {
"noDefaultExport": "off",
"noInferrableTypes": "off",
"noNamespaceImport": "off",
"noNonNullAssertion": "off",
"noParameterAssign": "off",
"useBlockStatements": "off",
"useFilenamingConvention": "off",
"useNamingConvention": "off",
"useNumberNamespace": "off",
"useSingleCaseStatement": "off"
},
"complexity": {
"noBannedTypes": "off",
"noForEach": "off",
"noStaticOnlyClass": "off",
"noExcessiveCognitiveComplexity": {
"level": "warn",
"options": {
"maxAllowedComplexity": 255
}
}
},
"security": {
"noGlobalEval": "off"
},
"correctness": {
"noNodejsModules": "off",
"noVoidTypeReturn": "off"
},
"performance": {
"noBarrelFile": "off"
}
}
},
"formatter": {
"enabled": true,
"indentWidth": 4,
"indentStyle": "space",
"lineEnding": "crlf",
"lineWidth": 140,
"formatWithErrors": true
},
"json": {
"linter": {
"enabled": true
},
"formatter": {
"enabled": true,
"indentWidth": 2,
"lineEnding": "crlf",
"lineWidth": 80
}
},
"javascript": {
"formatter": {
"quoteStyle": "double",
"arrowParentheses": "always",
"bracketSameLine": true,
"semicolons": "always"
}
},
"files": {
"ignoreUnknown": false,
"ignore": [".vscode", "node_modules", "docs"]
}
}
4 changes: 0 additions & 4 deletions eslint.config.mjs

This file was deleted.

18 changes: 9 additions & 9 deletions index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
export * as Connectors from './src/connectors/libs';
export * as Constants from './src/Constants';
export * as Utils from './src/Utils';
export * from './src/connectors/Connector';
export * from './src/guild/Connection';
export * from './src/guild/Player';
export * from './src/node/Node';
export * from './src/node/Rest';
export * from './src/Shoukaku';
export * as Connectors from "./src/connectors/libs";
export * as Constants from "./src/Constants";
export * as Utils from "./src/Utils";
export * from "./src/connectors/Connector";
export * from "./src/guild/Connection";
export * from "./src/guild/Player";
export * from "./src/node/Node";
export * from "./src/node/Rest";
export * from "./src/Shoukaku";
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
"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 .",
"lint": "biome lint --write",
"format": "biome format --write",
"prepare": "npm run build:ts"
},
"keywords": [
Expand Down Expand Up @@ -44,12 +45,11 @@
"ws": "^8.18.0"
},
"devDependencies": {
"@shipgirl/eslint-config": "^0.2.2",
"@types/node": "^22.2.0",
"@biomejs/biome": "^1.8.3",
"@types/node": "^22.5.1",
"@types/ws": "^8.5.12",
"eslint": "^9.9.0",
"tsup": "^8.2.4",
"typedoc": "^0.26.5",
"typedoc": "^0.26.6",
"typescript": "^5.5.4"
}
}
75 changes: 38 additions & 37 deletions src/Constants.ts
Original file line number Diff line number Diff line change
@@ -1,57 +1,58 @@
import Info from '../package.json';
import { NodeOption, ShoukakuOptions } from './Shoukaku';
import Info from "../package.json";
import type { NodeOption, ShoukakuOptions } from "./Shoukaku";

export enum State {
CONNECTING,
NEARLY,
CONNECTED,
RECONNECTING,
DISCONNECTING,
DISCONNECTED
CONNECTING = 0,
NEARLY = 1,
CONNECTED = 2,
RECONNECTING = 3,
DISCONNECTING = 4,
DISCONNECTED = 5,
}

export enum VoiceState {
SESSION_READY,
SESSION_ID_MISSING,
SESSION_ENDPOINT_MISSING,
SESSION_FAILED_UPDATE
SESSION_READY = 0,
SESSION_ID_MISSING = 1,
SESSION_ENDPOINT_MISSING = 2,
SESSION_FAILED_UPDATE = 3,
}

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

export const Versions = {
REST_VERSION: 4,
WEBSOCKET_VERSION: 4
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
Loading