mirror of
https://github.com/spacebarchat/server.git
synced 2026-03-30 07:30:00 +00:00
ESLint: warn for deprecated constructs
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
module.exports = {
|
||||
export default {
|
||||
"*.{j,t}s": ["eslint", "prettier --write"],
|
||||
"src/schemas/{*,**/*}.ts": [() => "tsc -b -v", () => "node scripts/schema.js", () => "node scripts/openapi.js"],
|
||||
};
|
||||
@@ -5,6 +5,7 @@ import path from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import js from "@eslint/js";
|
||||
import { FlatCompat } from "@eslint/eslintrc";
|
||||
import { defineConfig } from "eslint/config";
|
||||
|
||||
const __filename = fileURLToPath(import.meta.url);
|
||||
const __dirname = path.dirname(__filename);
|
||||
@@ -14,12 +15,13 @@ const compat = new FlatCompat({
|
||||
allConfig: js.configs.all,
|
||||
});
|
||||
|
||||
export default [
|
||||
export default defineConfig([
|
||||
{
|
||||
ignores: ["**/node_modules", "**/dist", "**/README.md", "**/COPYING", "**/scripts/", "**/assets", "**/extra/"],
|
||||
},
|
||||
...compat.extends("eslint:recommended", "plugin:@typescript-eslint/recommended"),
|
||||
{
|
||||
files: ["**/*.ts"],
|
||||
plugins: {
|
||||
"@typescript-eslint": typescriptEslint,
|
||||
},
|
||||
@@ -30,6 +32,11 @@ export default [
|
||||
},
|
||||
|
||||
parser: tsParser,
|
||||
parserOptions: {
|
||||
ecmaVersion: "latest",
|
||||
sourceType: "module",
|
||||
project: "./tsconfig.json",
|
||||
},
|
||||
},
|
||||
|
||||
rules: {
|
||||
@@ -38,6 +45,11 @@ export default [
|
||||
"@typescript-eslint/no-var-requires": "off", // Sometimes requred by typeorm to resolve circular deps
|
||||
"@typescript-eslint/no-require-imports": "off",
|
||||
"@typescript-eslint/no-unused-vars": "off",
|
||||
"@typescript-eslint/no-deprecated": "warn",
|
||||
},
|
||||
},
|
||||
];
|
||||
{
|
||||
files: ["**/*.js", "**/*.cjs", "**/*.mjs"],
|
||||
extends: typescriptEslint.configs?.disableTypeChecked ? [typescriptEslint.configs.disableTypeChecked] : [],
|
||||
},
|
||||
]);
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
{
|
||||
"include": ["MessageInteractionSchema"],
|
||||
"includeRe": ["^MessageComponentType\\..*"],
|
||||
"include": [
|
||||
"MessageInteractionSchema"
|
||||
],
|
||||
"includeRe": [
|
||||
"^MessageComponentType\\..*"
|
||||
],
|
||||
"manual": [
|
||||
"DefaultSchema",
|
||||
"Schema",
|
||||
@@ -83,7 +87,9 @@
|
||||
"^Job"
|
||||
],
|
||||
"manualWarn": [],
|
||||
"manualWarnRe": [".*<.*>$"],
|
||||
"manualWarnRe": [
|
||||
".*<.*>$"
|
||||
],
|
||||
"auto": [
|
||||
{
|
||||
"value": "StringSchema",
|
||||
@@ -406,4 +412,4 @@
|
||||
"reason": "Schema with only uppercase properties"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -49,7 +49,11 @@ export function snowflakeBasedInvite() {
|
||||
snowflake = snowflake / base;
|
||||
}
|
||||
|
||||
return str.substr(3, 8).split("").reverse().join("");
|
||||
return str
|
||||
.slice(3, 3 + 8)
|
||||
.split("")
|
||||
.reverse()
|
||||
.join("");
|
||||
}
|
||||
|
||||
export function randomUpperString(length: number = 10) {
|
||||
|
||||
@@ -204,8 +204,8 @@ class UnixSocketListener {
|
||||
while (buffer.length >= 4) {
|
||||
const msgLen = buffer.readUInt32BE(0);
|
||||
if (buffer.length < 4 + msgLen) break;
|
||||
const msgBuf = buffer.slice(4, 4 + msgLen);
|
||||
buffer = buffer.slice(4 + msgLen);
|
||||
const msgBuf = buffer.subarray(4, 4 + msgLen);
|
||||
buffer = buffer.subarray(4 + msgLen);
|
||||
try {
|
||||
const payload = JSON.parse(msgBuf.toString());
|
||||
this.eventEmitter.emit(payload.id, payload.event);
|
||||
|
||||
Reference in New Issue
Block a user