mirror of
https://github.com/spacebarchat/server.git
synced 2026-10-23 02:13:00 +00:00
Add ESLint (#941)
* Add eslint, switch to lint-staged for precommit * Fix all ESLint errors * Update GH workflow to check prettier and eslint
This commit is contained in:
1 parent
0c815fde91
commit
084dc0be08
157 files changed
+737
-666
No files matched your search
@@ -24,7 +24,7 @@ import crypto from "crypto";
|
||||
|
||||
export function random(length = 6) {
|
||||
// Declare all characters
|
||||
let chars =
|
||||
const chars =
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
||||
|
||||
// Pick characers randomly
|
||||
@@ -38,14 +38,14 @@ export function random(length = 6) {
|
||||
|
||||
export function snowflakeBasedInvite() {
|
||||
// Declare all characters
|
||||
let chars =
|
||||
const chars =
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
||||
let base = BigInt(chars.length);
|
||||
const base = BigInt(chars.length);
|
||||
let snowflake = Snowflake.generateWorkerProcess();
|
||||
|
||||
// snowflakes hold ~10.75 characters worth of entropy;
|
||||
// safe to generate a 8-char invite out of them
|
||||
let str = "";
|
||||
const str = "";
|
||||
for (let i = 0; i < 10; i++) {
|
||||
str.concat(chars.charAt(Number(snowflake % base)));
|
||||
snowflake = snowflake / base;
|
||||
|
||||
Reference in new issue
Block a user