Formatting and linting
This commit is contained in:
92
.eslintrc.js
92
.eslintrc.js
@@ -1,75 +1,59 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
"env": {
|
env: {
|
||||||
"node": true,
|
node: true,
|
||||||
"es2021": true,
|
es2021: true,
|
||||||
"browser": true
|
browser: true,
|
||||||
},
|
},
|
||||||
"extends": [
|
extends: ["eslint:recommended", "plugin:@typescript-eslint/recommended"],
|
||||||
"eslint:recommended",
|
overrides: [
|
||||||
"plugin:@typescript-eslint/recommended"
|
|
||||||
],
|
|
||||||
"overrides": [
|
|
||||||
{
|
{
|
||||||
"env": {
|
env: {
|
||||||
"node": true
|
node: true,
|
||||||
|
},
|
||||||
|
files: [".eslintrc.{js,cjs}"],
|
||||||
|
parserOptions: {
|
||||||
|
sourceType: "script",
|
||||||
},
|
},
|
||||||
"files": [
|
|
||||||
".eslintrc.{js,cjs}"
|
|
||||||
],
|
|
||||||
"parserOptions": {
|
|
||||||
"sourceType": "script"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"parser": "@typescript-eslint/parser",
|
|
||||||
"parserOptions": {
|
|
||||||
"ecmaVersion": "latest",
|
|
||||||
"sourceType": "module"
|
|
||||||
},
|
},
|
||||||
"plugins": [
|
|
||||||
"@typescript-eslint"
|
|
||||||
],
|
|
||||||
"rules": {
|
|
||||||
"indent": [
|
|
||||||
"error",
|
|
||||||
4
|
|
||||||
],
|
|
||||||
"linebreak-style": [
|
|
||||||
"error",
|
|
||||||
"windows"
|
|
||||||
],
|
|
||||||
"quotes": [
|
|
||||||
"warn",
|
|
||||||
"double"
|
|
||||||
],
|
|
||||||
"semi": [
|
|
||||||
"error",
|
|
||||||
"never"
|
|
||||||
],
|
],
|
||||||
|
parser: "@typescript-eslint/parser",
|
||||||
|
parserOptions: {
|
||||||
|
ecmaVersion: "latest",
|
||||||
|
sourceType: "module",
|
||||||
|
},
|
||||||
|
plugins: ["@typescript-eslint"],
|
||||||
|
rules: {
|
||||||
|
indent: ["error", 4, { SwitchCase: 1 }],
|
||||||
|
"linebreak-style": ["error", "windows"],
|
||||||
|
quotes: ["warn", "double"],
|
||||||
|
semi: ["error", "never"],
|
||||||
"no-unused-vars": "off",
|
"no-unused-vars": "off",
|
||||||
"prefer-const": "warn",
|
"prefer-const": "warn",
|
||||||
"no-var": "error",
|
"no-var": "error",
|
||||||
"no-multiple-empty-lines": ["error", { "max": 2, "maxEOF": 1, "maxBOF": 0 }],
|
"no-multiple-empty-lines": ["error", { max: 2, maxEOF: 1, maxBOF: 0 }],
|
||||||
"no-lonely-if": "error",
|
"no-lonely-if": "error",
|
||||||
"no-empty-function": "error",
|
"no-empty-function": "error",
|
||||||
"no-inline-comments": "error",
|
"no-inline-comments": "error",
|
||||||
"no-trailing-spaces": ["error"],
|
"no-trailing-spaces": ["error"],
|
||||||
"arrow-spacing": ["warn", { "before": true, "after": true }],
|
"arrow-spacing": ["warn", { before: true, after: true }],
|
||||||
"space-before-function-paren": ["error", {
|
"space-before-function-paren": [
|
||||||
"anonymous": "never",
|
"error",
|
||||||
"named": "never",
|
{
|
||||||
"asyncArrow": "always"
|
anonymous: "never",
|
||||||
}],
|
named: "never",
|
||||||
|
asyncArrow: "always",
|
||||||
|
},
|
||||||
|
],
|
||||||
"comma-spacing": "error",
|
"comma-spacing": "error",
|
||||||
"@typescript-eslint/no-var-requires": "off",
|
"@typescript-eslint/no-var-requires": "off",
|
||||||
"@typescript-eslint/no-explicit-any": "off",
|
"@typescript-eslint/no-explicit-any": "off",
|
||||||
"@typescript-eslint/no-unused-vars": [
|
"@typescript-eslint/no-unused-vars": [
|
||||||
"warn",
|
"warn",
|
||||||
{
|
{
|
||||||
"vars": "all",
|
vars: "all",
|
||||||
"args": "after-used",
|
args: "after-used",
|
||||||
"ignoreRestSiblings": false
|
ignoreRestSiblings: false,
|
||||||
}
|
},
|
||||||
],
|
],
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ const config = {
|
|||||||
bracketSpacing: true,
|
bracketSpacing: true,
|
||||||
arrowParens: "avoid",
|
arrowParens: "avoid",
|
||||||
parser: "typescript",
|
parser: "typescript",
|
||||||
endOfLine: "crlf"
|
endOfLine: "crlf",
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = config
|
module.exports = config
|
||||||
@@ -123,33 +123,33 @@ export = {
|
|||||||
if (target.isCommunicationDisabled()) {
|
if (target.isCommunicationDisabled()) {
|
||||||
if (time === 0) {
|
if (time === 0) {
|
||||||
title = "Timeout Removed"
|
title = "Timeout Removed"
|
||||||
;(description =
|
description =
|
||||||
"Removed timeout of " +
|
"Removed timeout of " +
|
||||||
userMention(target.id) +
|
userMention(target.id) +
|
||||||
" for " +
|
" for " +
|
||||||
reason),
|
reason
|
||||||
(timeouttime = null)
|
timeouttime = null
|
||||||
} else {
|
} else {
|
||||||
title = "Timeout Updated"
|
title = "Timeout Updated"
|
||||||
;(description =
|
description =
|
||||||
"Updated timeout of " +
|
"Updated timeout of " +
|
||||||
userMention(target.id) +
|
userMention(target.id) +
|
||||||
" to " +
|
" to " +
|
||||||
prettyTime +
|
prettyTime +
|
||||||
" for " +
|
" for " +
|
||||||
reason),
|
reason
|
||||||
(timeouttime = time)
|
timeouttime = time
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
title = "Member Timed Out"
|
title = "Member Timed Out"
|
||||||
;(description =
|
description =
|
||||||
"Timed out " +
|
"Timed out " +
|
||||||
userMention(target.id) +
|
userMention(target.id) +
|
||||||
" for " +
|
" for " +
|
||||||
prettyTime +
|
prettyTime +
|
||||||
" for " +
|
" for " +
|
||||||
reason),
|
reason
|
||||||
(timeouttime = time)
|
timeouttime = time
|
||||||
}
|
}
|
||||||
|
|
||||||
await target.timeout(timeouttime, reason)
|
await target.timeout(timeouttime, reason)
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ function getLevelRespectingPrestige(level: number): number {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const EASY_LEVELS = 4
|
const EASY_LEVELS = 4
|
||||||
const EASY_LEVELS_XP = 7000
|
const EASY_LEVELS_XP = 7004
|
||||||
const XP_PER_PRESTIGE = 96 * 5000 + EASY_LEVELS_XP
|
const XP_PER_PRESTIGE = 96 * 5000 + EASY_LEVELS_XP
|
||||||
const LEVELS_PER_PRESTIGE = 100
|
const LEVELS_PER_PRESTIGE = 100
|
||||||
const HIGHEST_PRESTIGE = 50
|
const HIGHEST_PRESTIGE = 50
|
||||||
|
|||||||
@@ -6,15 +6,13 @@ const GROWTH = 2500
|
|||||||
const HALF_GROWTH = 0.5 * GROWTH
|
const HALF_GROWTH = 0.5 * GROWTH
|
||||||
const REVERSE_PQ_PREFIX = -(BASE - 0.5 * GROWTH) / GROWTH
|
const REVERSE_PQ_PREFIX = -(BASE - 0.5 * GROWTH) / GROWTH
|
||||||
const REVERSE_CONST = REVERSE_PQ_PREFIX * REVERSE_PQ_PREFIX
|
const REVERSE_CONST = REVERSE_PQ_PREFIX * REVERSE_PQ_PREFIX
|
||||||
const GROWTH_DIVIDES_2 = 2 / GROWTH
|
const GROWTHDIV2 = 2 / GROWTH
|
||||||
|
|
||||||
function getLevel(exp: number): number {
|
function getLevel(exp: number): number {
|
||||||
return exp <= 1
|
if (exp <= 1) return 1
|
||||||
? 1
|
|
||||||
: Math.floor(
|
return Math.floor(
|
||||||
1 +
|
1 + REVERSE_PQ_PREFIX + Math.sqrt(REVERSE_CONST + GROWTHDIV2 * exp),
|
||||||
REVERSE_PQ_PREFIX +
|
|
||||||
Math.sqrt(REVERSE_CONST + GROWTH_DIVIDES_2 * exp),
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user