add eslint & prettier

This commit is contained in:
Ryan Cao 2022-05-21 18:32:55 +08:00
parent 7950e23236
commit 0f15e2fb2c
No known key found for this signature in database
GPG key ID: 528A2C1B6656B97F
6 changed files with 805 additions and 13 deletions

8
.eslintrc.cjs Normal file
View file

@ -0,0 +1,8 @@
/* eslint-env node */
module.exports = {
root: true,
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint'],
extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended'],
};

7
.prettierrc Normal file
View file

@ -0,0 +1,7 @@
{
"singleQuote": true,
"trailingComma": "es5",
"useTabs": false,
"tabWidth": 2,
"semi": true
}

View file

@ -13,6 +13,7 @@ const client = new Client({
Intents.FLAGS.DIRECT_MESSAGES, Intents.FLAGS.DIRECT_MESSAGES,
Intents.FLAGS.GUILD_MEMBERS, Intents.FLAGS.GUILD_MEMBERS,
Intents.FLAGS.GUILD_MESSAGE_REACTIONS, Intents.FLAGS.GUILD_MESSAGE_REACTIONS,
Intents.FLAGS.GUILD_BANS,
], ],
}); });
@ -22,7 +23,14 @@ client.once('ready', async () => {
console.log(green(bold('Discord bot ready!'))); console.log(green(bold('Discord bot ready!')));
console.log( console.log(
'Invite link:', 'Invite link:',
blue(underline(client.generateInvite({ scopes: ['bot'] }))) blue(
underline(
client.generateInvite({
scopes: ['bot'],
permissions: ['ADMINISTRATOR'],
})
)
)
); );
const POLYMC_GUILD = await client.guilds.fetch(BuildConfig.GUILD_ID); const POLYMC_GUILD = await client.guilds.fetch(BuildConfig.GUILD_ID);

View file

@ -1 +0,0 @@
export const parseLog = (text: string) => {};

View file

@ -4,17 +4,24 @@
"license": "MIT", "license": "MIT",
"scripts": { "scripts": {
"dev": "nodemon --watch index.ts --exec esno index.ts", "dev": "nodemon --watch index.ts --exec esno index.ts",
"build": "esbuild index.ts --format=cjs --platform=node --bundle --minify --outfile=index.js" "build": "esbuild index.ts --format=cjs --platform=node --bundle --minify --outfile=index.js",
"lint": "eslint **/*.ts"
}, },
"dependencies": { "dependencies": {
"@cliqz/adblocker": "^1.23.8",
"bad-words": "^3.0.4", "bad-words": "^3.0.4",
"discord.js": "^13.7.0", "discord.js": "^13.7.0",
"kleur": "^4.1.4" "kleur": "^4.1.4"
}, },
"devDependencies": { "devDependencies": {
"@types/bad-words": "^3.0.1", "@types/bad-words": "^3.0.1",
"@typescript-eslint/eslint-plugin": "^5.25.0",
"@typescript-eslint/parser": "^5.25.0",
"esbuild": "^0.14.39", "esbuild": "^0.14.39",
"eslint": "^8.16.0",
"esno": "^0.16.3", "esno": "^0.16.3",
"nodemon": "^2.0.16" "nodemon": "^2.0.16",
"prettier": "^2.6.2",
"typescript": "^4.6.4"
} }
} }

781
yarn.lock

File diff suppressed because it is too large Load diff