Merge pull request #1232 from dank074/patch/eslintConfig
This commit is contained in:
commit
841b36112f
@ -1,7 +0,0 @@
|
|||||||
node_modules
|
|
||||||
dist
|
|
||||||
README.md
|
|
||||||
COPYING
|
|
||||||
src/webrtc
|
|
||||||
scripts/
|
|
||||||
assets
|
|
14
.eslintrc
14
.eslintrc
@ -1,14 +0,0 @@
|
|||||||
{
|
|
||||||
"extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended"],
|
|
||||||
"parser": "@typescript-eslint/parser",
|
|
||||||
"plugins": ["@typescript-eslint"],
|
|
||||||
"root": true,
|
|
||||||
"rules": {
|
|
||||||
"no-mixed-spaces-and-tabs": "off",
|
|
||||||
"@typescript-eslint/no-inferrable-types": "off", // Required by typeorm
|
|
||||||
"@typescript-eslint/no-var-requires": "off" // Sometimes requred by typeorm to resolve circular deps
|
|
||||||
},
|
|
||||||
"env": {
|
|
||||||
"node": true
|
|
||||||
}
|
|
||||||
}
|
|
47
eslint.config.mjs
Normal file
47
eslint.config.mjs
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
import typescriptEslint from "@typescript-eslint/eslint-plugin";
|
||||||
|
import globals from "globals";
|
||||||
|
import tsParser from "@typescript-eslint/parser";
|
||||||
|
import path from "node:path";
|
||||||
|
import { fileURLToPath } from "node:url";
|
||||||
|
import js from "@eslint/js";
|
||||||
|
import { FlatCompat } from "@eslint/eslintrc";
|
||||||
|
|
||||||
|
const __filename = fileURLToPath(import.meta.url);
|
||||||
|
const __dirname = path.dirname(__filename);
|
||||||
|
const compat = new FlatCompat({
|
||||||
|
baseDirectory: __dirname,
|
||||||
|
recommendedConfig: js.configs.recommended,
|
||||||
|
allConfig: js.configs.all
|
||||||
|
});
|
||||||
|
|
||||||
|
export default [{
|
||||||
|
ignores: [
|
||||||
|
"**/node_modules",
|
||||||
|
"**/dist",
|
||||||
|
"**/README.md",
|
||||||
|
"**/COPYING",
|
||||||
|
"src/webrtc",
|
||||||
|
"**/scripts/",
|
||||||
|
"**/assets",
|
||||||
|
],
|
||||||
|
}, ...compat.extends("eslint:recommended", "plugin:@typescript-eslint/recommended"), {
|
||||||
|
plugins: {
|
||||||
|
"@typescript-eslint": typescriptEslint,
|
||||||
|
},
|
||||||
|
|
||||||
|
languageOptions: {
|
||||||
|
globals: {
|
||||||
|
...globals.node,
|
||||||
|
},
|
||||||
|
|
||||||
|
parser: tsParser,
|
||||||
|
},
|
||||||
|
|
||||||
|
rules: {
|
||||||
|
"no-mixed-spaces-and-tabs": "off",
|
||||||
|
"@typescript-eslint/no-inferrable-types": "off", // Required by typeorm
|
||||||
|
"@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",
|
||||||
|
},
|
||||||
|
}];
|
39
package-lock.json
generated
39
package-lock.json
generated
@ -53,6 +53,8 @@
|
|||||||
"ws": "^8.18.0"
|
"ws": "^8.18.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@eslint/eslintrc": "^3.1.0",
|
||||||
|
"@eslint/js": "^9.14.0",
|
||||||
"@types/amqplib": "^0.10.5",
|
"@types/amqplib": "^0.10.5",
|
||||||
"@types/bcrypt": "^5.0.2",
|
"@types/bcrypt": "^5.0.2",
|
||||||
"@types/body-parser": "^1.19.5",
|
"@types/body-parser": "^1.19.5",
|
||||||
@ -76,6 +78,7 @@
|
|||||||
"@typescript-eslint/parser": "^8.12.2",
|
"@typescript-eslint/parser": "^8.12.2",
|
||||||
"eslint": "^9.13.0",
|
"eslint": "^9.13.0",
|
||||||
"express": "^4.21.1",
|
"express": "^4.21.1",
|
||||||
|
"globals": "^15.12.0",
|
||||||
"husky": "^9.1.6",
|
"husky": "^9.1.6",
|
||||||
"prettier": "^3.3.3",
|
"prettier": "^3.3.3",
|
||||||
"pretty-quick": "^4.0.0",
|
"pretty-quick": "^4.0.0",
|
||||||
@ -1202,7 +1205,6 @@
|
|||||||
"resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-3.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-3.1.0.tgz",
|
||||||
"integrity": "sha512-4Bfj15dVJdoy3RfZmmo86RK1Fwzn6SstsvK9JS+BaVKqC6QQQQyXekNaC+g+LKNgkQ+2VhGAzm6hO40AhMR3zQ==",
|
"integrity": "sha512-4Bfj15dVJdoy3RfZmmo86RK1Fwzn6SstsvK9JS+BaVKqC6QQQQyXekNaC+g+LKNgkQ+2VhGAzm6hO40AhMR3zQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"ajv": "^6.12.4",
|
"ajv": "^6.12.4",
|
||||||
"debug": "^4.3.2",
|
"debug": "^4.3.2",
|
||||||
@ -1249,6 +1251,18 @@
|
|||||||
"concat-map": "0.0.1"
|
"concat-map": "0.0.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/@eslint/eslintrc/node_modules/globals": {
|
||||||
|
"version": "14.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/globals/-/globals-14.0.0.tgz",
|
||||||
|
"integrity": "sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ==",
|
||||||
|
"dev": true,
|
||||||
|
"engines": {
|
||||||
|
"node": ">=18"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/sindresorhus"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/@eslint/eslintrc/node_modules/json-schema-traverse": {
|
"node_modules/@eslint/eslintrc/node_modules/json-schema-traverse": {
|
||||||
"version": "0.4.1",
|
"version": "0.4.1",
|
||||||
"resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz",
|
"resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz",
|
||||||
@ -1270,11 +1284,10 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@eslint/js": {
|
"node_modules/@eslint/js": {
|
||||||
"version": "9.13.0",
|
"version": "9.14.0",
|
||||||
"resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.13.0.tgz",
|
"resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.14.0.tgz",
|
||||||
"integrity": "sha512-IFLyoY4d72Z5y/6o/BazFBezupzI/taV8sGumxTAVw3lXG9A6md1Dc34T9s1FoD/an9pJH8RHbAxsaEbBed9lA==",
|
"integrity": "sha512-pFoEtFWCPyDOl+C6Ift+wC7Ro89otjigCf5vcuWqWgqNSQbRrpjSvdeE6ofLz4dHmyxD5f7gIdGT4+p36L6Twg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
|
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
|
||||||
}
|
}
|
||||||
@ -5878,6 +5891,15 @@
|
|||||||
"url": "https://opencollective.com/eslint"
|
"url": "https://opencollective.com/eslint"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/eslint/node_modules/@eslint/js": {
|
||||||
|
"version": "9.13.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.13.0.tgz",
|
||||||
|
"integrity": "sha512-IFLyoY4d72Z5y/6o/BazFBezupzI/taV8sGumxTAVw3lXG9A6md1Dc34T9s1FoD/an9pJH8RHbAxsaEbBed9lA==",
|
||||||
|
"dev": true,
|
||||||
|
"engines": {
|
||||||
|
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/eslint/node_modules/ajv": {
|
"node_modules/eslint/node_modules/ajv": {
|
||||||
"version": "6.12.6",
|
"version": "6.12.6",
|
||||||
"resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz",
|
"resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz",
|
||||||
@ -6735,11 +6757,10 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/globals": {
|
"node_modules/globals": {
|
||||||
"version": "14.0.0",
|
"version": "15.12.0",
|
||||||
"resolved": "https://registry.npmjs.org/globals/-/globals-14.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/globals/-/globals-15.12.0.tgz",
|
||||||
"integrity": "sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ==",
|
"integrity": "sha512-1+gLErljJFhbOVyaetcwJiJ4+eLe45S2E7P5UiZ9xGfeq3ATQf5DOv9G7MH3gGbKQLkzmNh2DxfZwLdw+j6oTQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=18"
|
"node": ">=18"
|
||||||
},
|
},
|
||||||
|
@ -38,6 +38,8 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://spacebar.chat",
|
"homepage": "https://spacebar.chat",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@eslint/eslintrc": "^3.1.0",
|
||||||
|
"@eslint/js": "^9.14.0",
|
||||||
"@types/amqplib": "^0.10.5",
|
"@types/amqplib": "^0.10.5",
|
||||||
"@types/bcrypt": "^5.0.2",
|
"@types/bcrypt": "^5.0.2",
|
||||||
"@types/body-parser": "^1.19.5",
|
"@types/body-parser": "^1.19.5",
|
||||||
@ -61,6 +63,7 @@
|
|||||||
"@typescript-eslint/parser": "^8.12.2",
|
"@typescript-eslint/parser": "^8.12.2",
|
||||||
"eslint": "^9.13.0",
|
"eslint": "^9.13.0",
|
||||||
"express": "^4.21.1",
|
"express": "^4.21.1",
|
||||||
|
"globals": "^15.12.0",
|
||||||
"husky": "^9.1.6",
|
"husky": "^9.1.6",
|
||||||
"prettier": "^3.3.3",
|
"prettier": "^3.3.3",
|
||||||
"pretty-quick": "^4.0.0",
|
"pretty-quick": "^4.0.0",
|
||||||
|
@ -108,7 +108,6 @@ export async function Authentication(
|
|||||||
req.rights = new Rights(Number(user.rights));
|
req.rights = new Rights(Number(user.rights));
|
||||||
return next();
|
return next();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
||||||
return next(new HTTPError(error!.toString(), 400));
|
return next(new HTTPError(error!.toString(), 400));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -72,7 +72,6 @@ router.post(
|
|||||||
await User.update({ id: user.id }, data);
|
await User.update({ id: user.id }, data);
|
||||||
|
|
||||||
// come on, the user has to have an email to reset their password in the first place
|
// come on, the user has to have an email to reset their password in the first place
|
||||||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
||||||
await Email.sendPasswordChanged(user, user.email!);
|
await Email.sendPasswordChanged(user, user.email!);
|
||||||
|
|
||||||
res.json({ token: await generateToken(user.id) });
|
res.json({ token: await generateToken(user.id) });
|
||||||
|
@ -171,7 +171,6 @@ export async function onIdentify(this: WebSocket, data: Payload) {
|
|||||||
// but we do want almost everything from guild.
|
// but we do want almost everything from guild.
|
||||||
// How do you do that without just enumerating the guild props?
|
// How do you do that without just enumerating the guild props?
|
||||||
guild: Object.fromEntries(
|
guild: Object.fromEntries(
|
||||||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
||||||
getDatabase()!
|
getDatabase()!
|
||||||
.getMetadata(Guild)
|
.getMetadata(Guild)
|
||||||
.columns.map((x) => [x.propertyName, true]),
|
.columns.map((x) => [x.propertyName, true]),
|
||||||
|
@ -214,7 +214,6 @@ async function subscribeToMemberEvents(this: WebSocket, user_id: string) {
|
|||||||
export async function onLazyRequest(this: WebSocket, { d }: Payload) {
|
export async function onLazyRequest(this: WebSocket, { d }: Payload) {
|
||||||
// TODO: check data
|
// TODO: check data
|
||||||
check.call(this, LazyRequestSchema, d);
|
check.call(this, LazyRequestSchema, d);
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
||||||
const { guild_id, typing, channels, activities, members } =
|
const { guild_id, typing, channels, activities, members } =
|
||||||
d as LazyRequestSchema;
|
d as LazyRequestSchema;
|
||||||
|
|
||||||
|
@ -99,7 +99,6 @@ export async function onVoiceStateUpdate(this: WebSocket, data: Payload) {
|
|||||||
voiceState.token = genVoiceToken();
|
voiceState.token = genVoiceToken();
|
||||||
voiceState.session_id = this.session_id;
|
voiceState.session_id = this.session_id;
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
||||||
const { id, ...newObj } = voiceState;
|
const { id, ...newObj } = voiceState;
|
||||||
|
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
|
@ -46,7 +46,7 @@ export class BaseClassWithoutId extends BaseEntity {
|
|||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
toJSON(): any {
|
toJSON(): any {
|
||||||
return Object.fromEntries(
|
return Object.fromEntries(
|
||||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment, @typescript-eslint/no-non-null-assertion
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||||
this.metadata!.columns // @ts-ignore
|
this.metadata!.columns // @ts-ignore
|
||||||
.map((x) => [x.propertyName, this[x.propertyName]])
|
.map((x) => [x.propertyName, this[x.propertyName]])
|
||||||
.concat(
|
.concat(
|
||||||
|
@ -69,7 +69,6 @@ export interface MessageCreateSchema {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TypeScript complains once this is used above
|
// TypeScript complains once this is used above
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
||||||
interface PollCreationSchema {
|
interface PollCreationSchema {
|
||||||
question: PollMedia;
|
question: PollMedia;
|
||||||
answers: PollAnswer[];
|
answers: PollAnswer[];
|
||||||
|
@ -18,4 +18,5 @@
|
|||||||
|
|
||||||
import { Team } from "@spacebar/util";
|
import { Team } from "@spacebar/util";
|
||||||
|
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
||||||
export interface TeamListResponse extends Array<Team> {}
|
export interface TeamListResponse extends Array<Team> {}
|
||||||
|
@ -70,7 +70,6 @@ export function enableAutoUpdate(opts: {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
||||||
async function download(url: string, dir: string) {
|
async function download(url: string, dir: string) {
|
||||||
try {
|
try {
|
||||||
// TODO: use file stream instead of buffer (to prevent crash because of high memory usage for big files)
|
// TODO: use file stream instead of buffer (to prevent crash because of high memory usage for big files)
|
||||||
|
@ -100,6 +100,7 @@ export async function listenEvent(
|
|||||||
};
|
};
|
||||||
|
|
||||||
const listener = (msg: ProcessEvent) => {
|
const listener = (msg: ProcessEvent) => {
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
|
||||||
msg.type === "event" &&
|
msg.type === "event" &&
|
||||||
msg.id === event &&
|
msg.id === event &&
|
||||||
callback({ ...msg.event, cancel });
|
callback({ ...msg.event, cancel });
|
||||||
|
@ -117,7 +117,7 @@ export const Sentry = {
|
|||||||
Integrations.setupExpressErrorHandler(app);
|
Integrations.setupExpressErrorHandler(app);
|
||||||
|
|
||||||
// The typings for this are broken?
|
// The typings for this are broken?
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unused-vars
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
app.use(function onError(err: any, req: any, res: any, next: any) {
|
app.use(function onError(err: any, req: any, res: any, next: any) {
|
||||||
res.statusCode = 500;
|
res.statusCode = 500;
|
||||||
res.end(res.sentry + "\n");
|
res.end(res.sentry + "\n");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user