From aa5082402751023eeaeb7e50414fabb19799dd62 Mon Sep 17 00:00:00 2001 From: Skyler Grey Date: Wed, 3 Aug 2022 21:42:12 +0100 Subject: [PATCH] Add eslint - Copy eslint configs from TransPlace's moderation bot - Modify some settings to better fit this project --- .eslintrc.json | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ package.json | 11 +++++++++-- tsconfig.json | 3 ++- 3 files changed, 59 insertions(+), 3 deletions(-) create mode 100644 .eslintrc.json diff --git a/.eslintrc.json b/.eslintrc.json new file mode 100644 index 0000000..34a9df8 --- /dev/null +++ b/.eslintrc.json @@ -0,0 +1,48 @@ +{ + "env": { + "browser": false, + "es2021": true + }, + "ignorePatterns": ["dist/"], + "extends": [ + "eslint:recommended", + "plugin:@typescript-eslint/recommended" + ], + "parser": "@typescript-eslint/parser", + "parserOptions": { + "ecmaVersion": "latest", + "sourceType": "module" + }, + "plugins": [ + "@typescript-eslint" + ], + "rules": { + "indent": [ + "error", + 4 + ], + "linebreak-style": [ + "error", + "unix" + ], + "quotes": [ + "error", + "double" + ], + "semi": [ + "error", + "always" + ], + "no-unused-vars": "off", + "@typescript-eslint/no-unused-vars": [ + "warn", + { + "argsIgnorePattern": "^_", + "varsIgnorePattern": "^_", + "caughtErrorsIgnorePattern": "^_" + } + ], + "no-trailing-spaces": "error", + "@typescript-eslint/no-explicit-any": "error" + } +} diff --git a/package.json b/package.json index e42a2a5..a26b083 100644 --- a/package.json +++ b/package.json @@ -5,6 +5,7 @@ "agenda": "^4.3.0", "body-parser": "^1.20.0", "discord.js": "13.8.1", + "eslint": "^8.21.0", "express": "^4.18.1", "fuse.js": "^6.6.2", "humanize-duration": "^3.27.1", @@ -24,7 +25,8 @@ "scripts": { "build": "tsc", "start": "node --experimental-json-modules dist/index.js", - "dev": "rm -rf dist && tsc && node --experimental-json-modules dist/index.js" + "dev": "rm -rf dist && tsc && node --experimental-json-modules dist/index.js", + "lint": "eslint ." }, "repository": { "type": "git", @@ -41,5 +43,10 @@ }, "homepage": "https://github.com/ClicksMinutePer/Nucleus#readme", "private": false, - "type": "module" + "type": "module", + "devDependencies": { + "@tsconfig/node16-strictest-esm": "^1.0.3", + "@typescript-eslint/eslint-plugin": "^5.32.0", + "@typescript-eslint/parser": "^5.32.0" + } } diff --git a/tsconfig.json b/tsconfig.json index 0b5e28f..abdf24d 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,4 +1,5 @@ { + "extends": "@tsconfig/node16-strictest-esm/tsconfig.json", "compilerOptions": { "module": "esnext", "target": "es2020", @@ -13,4 +14,4 @@ }, "include": ["src/**/*", "installer.js"], "exclude": [] -} \ No newline at end of file +}