Skip to content

Commit

Permalink
bot: fix lint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Behzad-rabiei committed Oct 24, 2024
1 parent 5c89dd0 commit 4505abc
Show file tree
Hide file tree
Showing 9 changed files with 118 additions and 149 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/bot-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ on:
push:
paths:
- "bot/**"
pull_request:
paths:
- "bot/**"
# pull_request:
# paths:
# - "bot/**"

jobs:
lint:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/hivemind-adapter-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ on:
push:
paths:
- "hivemind-adapter/**"
pull_request:
paths:
- "hivemind-adapter/**"
# pull_request:
# paths:
# - "hivemind-adapter/**"

jobs:
lint:
Expand Down
9 changes: 2 additions & 7 deletions bot/__tests__/unit/database/services/channel.test.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
import mongoose, { Connection } from 'mongoose'
import {
IChannel,
channelSchema,
IChannelUpdateBody,
DatabaseManager,
} from '@togethercrew.dev/db'
import { Connection } from 'mongoose'
import { IChannelUpdateBody, DatabaseManager } from '@togethercrew.dev/db'
import setupTestDB from '../../../utils/setupTestDB'
import {
channel1,
Expand Down
10 changes: 2 additions & 8 deletions bot/__tests__/unit/database/services/guildMember.test.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
import mongoose, { Connection } from 'mongoose'
import {
IGuildMember,
guildMemberSchema,
IGuildMemberUpdateBody,
DatabaseManager,
GuildMember,
} from '@togethercrew.dev/db'
import { Connection } from 'mongoose'
import { IGuildMemberUpdateBody, DatabaseManager } from '@togethercrew.dev/db'
import setupTestDB from '../../../utils/setupTestDB'
import {
guildMember1,
Expand Down
2 changes: 1 addition & 1 deletion bot/__tests__/unit/database/services/rawInfo.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import mongoose, { Connection } from 'mongoose'
import { Connection } from 'mongoose'
import { IRawInfoUpdateBody, DatabaseManager } from '@togethercrew.dev/db'
import setupTestDB from '../../../utils/setupTestDB'
import { rawInfo1, rawInfo2, rawInfo3 } from '../../../fixtures/rawInfo.fixture'
Expand Down
9 changes: 2 additions & 7 deletions bot/__tests__/unit/database/services/role.test.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
import mongoose, { Connection } from 'mongoose'
import {
IRole,
roleSchema,
IRoleUpdateBody,
DatabaseManager,
} from '@togethercrew.dev/db'
import { Connection } from 'mongoose'
import { IRoleUpdateBody, DatabaseManager } from '@togethercrew.dev/db'
import setupTestDB from '../../../utils/setupTestDB'
import {
role1,
Expand Down
168 changes: 84 additions & 84 deletions bot/package.json
Original file line number Diff line number Diff line change
@@ -1,86 +1,86 @@
{
"name": "tc-discordbot",
"version": "1.0.0",
"description": "discord bot app",
"main": "index.js",
"scripts": {
"build": "tsc",
"start": "node ./lib/index.js",
"copy-files": "copyfiles -u 1 src/**/*.yml lib",
"dev": "env-cmd -f ./src/config/dev.env nodemon ./src/index.ts",
"test": "env-cmd -f ./src/config/test.env jest --detectOpenHandles",
"test:ci": "jest --ci --detectOpenHandles",
"lint": "eslint **/*.ts",
"lint-fix": "eslint --fix **/*.ts",
"format": "prettier --write \"src/**/*.ts\" \"types/*.ts\" \"__tests__/**/*.ts\"",
"dev-migrate:create": "migrate create --template-file ./src/migrations/utils/template.ts --migrations-dir=\"./src/migrations/db\" --compiler=\"ts:./src/migrations/utils/ts-compiler.js\"",
"dev-migrate:up": "migrate --migrations-dir=\"./src/migrations/db\" up --compiler=\"ts:./src/migrations/utils/ts-compiler.js\"",
"dev-migrate:down": "migrate --migrations-dir=\"./src/migrations/db\" --compiler=\"ts:./src/migrations/utils/ts-compiler.js\" down",
"migrate:create": "migrate create --template-file ./src/migrations/utils/template.ts --migrations-dir=\"./src/migrations/db\"",
"migrate:up": "migrate --migrations-dir=\"./lib/migrations/db\" up",
"migrate:down": "migrate --migrations-dir=\"./lib/migrations/db\" down",
"cleanupCompletedJobs": "node ./lib/scripts/cleanupCompletedJobs.js",
"deleteRnDAOGuildCommands": "node ./lib/scripts/deleteRnDAOGuildCommands.js",
"fetchInitialData": "node ./lib/scripts/fetchInitialData.js"
},
"repository": {
"type": "git",
"url": "git+https://github.com/Behzad-rabiei/tc-discordBot.git"
},
"author": "Behzad Rabiei & Nima Torabi",
"license": "ISC",
"bugs": {
"url": "https://github.com/Behzad-rabiei/tc-discordBot/issues"
},
"homepage": "https://github.com/Behzad-rabiei/tc-discordBot#readme",
"dependencies": {
"@bull-board/express": "^5.14.0",
"@pyroscope/nodejs": "^0.2.8",
"@sentry/node": "^7.51.2",
"@togethercrew.dev/db": "^3.0.63",
"@togethercrew.dev/tc-messagebroker": "^0.0.48",
"babel-jest": "^29.5.0",
"bullmq": "^3.14.0",
"discord.js": "^14.15.2",
"express": "^4.18.2",
"flatted": "^3.2.9",
"joi": "^17.9.2",
"migrate": "^2.0.0",
"moment": "^2.29.4",
"mongodb": "^5.4.0",
"mongoose": "^6.11.1",
"node-fetch": "^2.6.7",
"npm": "^10.4.0",
"perf_hooks": "^0.0.1",
"pino": "^8.18.0",
"redis": "^4.6.6"
},
"devDependencies": {
"@types/express": "^4.17.21",
"@types/jest": "^29.5.1",
"@types/node": "^20.1.1",
"@types/node-fetch": "^2.6.2",
"@types/supertest": "^2.0.12",
"@typescript-eslint/eslint-plugin": "^5.62.0",
"@typescript-eslint/parser": "^5.62.0",
"env-cmd": "^10.1.0",
"eslint": "^8.56.0",
"eslint-config-prettier": "^8.8.0",
"eslint-config-standard-with-typescript": "^34.0.1",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-n": "^15.7.0",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-promise": "^6.1.1",
"jest": "^29.5.0",
"node-mocks-http": "^1.12.2",
"nodemon": "^3.0.1",
"prettier": "^3.3.3",
"supertest": "^6.3.3",
"ts-jest": "^29.1.0",
"ts-node": "^10.9.1",
"typescript": "^5.0.4"
},
"files": [
"lib/**/*"
]
"name": "tc-discordbot",
"version": "1.0.0",
"description": "discord bot app",
"main": "index.js",
"scripts": {
"build": "tsc",
"start": "node ./lib/index.js",
"copy-files": "copyfiles -u 1 src/**/*.yml lib",
"dev": "env-cmd -f ./src/config/dev.env nodemon ./src/index.ts",
"test": "env-cmd -f ./src/config/test.env jest --detectOpenHandles",
"test:ci": "jest --ci --detectOpenHandles",
"lint": "eslint **/*.ts",
"lint-fix": "eslint --fix **/*.ts",
"format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
"dev-migrate:create": "migrate create --template-file ./src/migrations/utils/template.ts --migrations-dir=\"./src/migrations/db\" --compiler=\"ts:./src/migrations/utils/ts-compiler.js\"",
"dev-migrate:up": "migrate --migrations-dir=\"./src/migrations/db\" up --compiler=\"ts:./src/migrations/utils/ts-compiler.js\"",
"dev-migrate:down": "migrate --migrations-dir=\"./src/migrations/db\" --compiler=\"ts:./src/migrations/utils/ts-compiler.js\" down",
"migrate:create": "migrate create --template-file ./src/migrations/utils/template.ts --migrations-dir=\"./src/migrations/db\"",
"migrate:up": "migrate --migrations-dir=\"./lib/migrations/db\" up",
"migrate:down": "migrate --migrations-dir=\"./lib/migrations/db\" down",
"cleanupCompletedJobs": "node ./lib/scripts/cleanupCompletedJobs.js",
"deleteRnDAOGuildCommands": "node ./lib/scripts/deleteRnDAOGuildCommands.js",
"fetchInitialData": "node ./lib/scripts/fetchInitialData.js"
},
"repository": {
"type": "git",
"url": "git+https://github.com/Behzad-rabiei/tc-discordBot.git"
},
"author": "Behzad Rabiei & Nima Torabi",
"license": "ISC",
"bugs": {
"url": "https://github.com/Behzad-rabiei/tc-discordBot/issues"
},
"homepage": "https://github.com/Behzad-rabiei/tc-discordBot#readme",
"dependencies": {
"@bull-board/express": "^5.14.0",
"@pyroscope/nodejs": "^0.2.8",
"@sentry/node": "^7.51.2",
"@togethercrew.dev/db": "^3.0.63",
"@togethercrew.dev/tc-messagebroker": "^0.0.48",
"babel-jest": "^29.5.0",
"bullmq": "^3.14.0",
"discord.js": "^14.15.2",
"express": "^4.18.2",
"flatted": "^3.2.9",
"joi": "^17.9.2",
"migrate": "^2.0.0",
"moment": "^2.29.4",
"mongodb": "^5.4.0",
"mongoose": "^6.11.1",
"node-fetch": "^2.6.7",
"npm": "^10.4.0",
"perf_hooks": "^0.0.1",
"pino": "^8.18.0",
"redis": "^4.6.6"
},
"devDependencies": {
"@types/express": "^4.17.21",
"@types/jest": "^29.5.1",
"@types/node": "^20.1.1",
"@types/node-fetch": "^2.6.2",
"@types/supertest": "^2.0.12",
"@typescript-eslint/eslint-plugin": "^5.62.0",
"@typescript-eslint/parser": "^5.62.0",
"env-cmd": "^10.1.0",
"eslint": "^8.56.0",
"eslint-config-prettier": "^8.8.0",
"eslint-config-standard-with-typescript": "^34.0.1",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-n": "^15.7.0",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-promise": "^6.1.1",
"jest": "^29.5.0",
"node-mocks-http": "^1.12.2",
"nodemon": "^3.0.1",
"prettier": "^3.3.3",
"supertest": "^6.3.3",
"ts-jest": "^29.1.0",
"ts-node": "^10.9.1",
"typescript": "^5.0.4"
},
"files": [
"lib/**/*"
]
}
4 changes: 1 addition & 3 deletions bot/src/migrations/utils/template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ import { DatabaseManager } from '@togethercrew.dev/db'

export const up = async (): Promise<void> => {
await connectToMongoDB()
const connection =
await DatabaseManager.getInstance().getGuildDb('681946187490000803')

const connection = await DatabaseManager.getInstance().getGuildDb('68194')
await connection.createCollection('my_collection')
}

Expand Down
53 changes: 20 additions & 33 deletions bot/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,34 +1,21 @@
{
"compilerOptions": {
"module": "commonjs",
"declaration": false,
"removeComments": false,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"target": "ES2017",
"sourceMap": false,
"outDir": "./lib",
"baseUrl": "./",
"incremental": true,
"strict": true,
"noImplicitAny": true,
"skipLibCheck": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true
},
"include": [
"src/**/*",
"__tests__/**/*",
"types/**/*"
],
"ts-node": {
"transpileOnly": true,
"files": true
},
"exclude": [
"./coverage",
"./lib",
"__tests__",
"jest.config.js"
]
}
"compilerOptions": {
"module": "commonjs",
"declaration": true,
"removeComments": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"allowSyntheticDefaultImports": true,
"target": "ES2021",
"sourceMap": true,
"outDir": "./dist",
"baseUrl": "./",
"incremental": true,
"skipLibCheck": true,
"strictNullChecks": false,
"noImplicitAny": false,
"strictBindCallApply": false,
"forceConsistentCasingInFileNames": false,
"noFallthroughCasesInSwitch": false
}
}

0 comments on commit 4505abc

Please sign in to comment.