From 7dece533e664da2099e130f3f42b275d27620e0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20Kr=C3=BChlmann?= Date: Wed, 1 Nov 2023 01:14:48 +0100 Subject: [PATCH] Cleanup lint and unused files --- .eslintrc.js | 1 + .estlinrrc.js | 39 ------------------------------ .prettierrc | 5 ---- Makefile | 3 +++ src/item/description/sell_price.ts | 12 --------- src/item/quality_color.ts | 14 +++++------ src/logging/loggers/async_file.ts | 16 ------------ src/logging/loggers/sync_file.ts | 16 ------------ src/main/prod.ts | 0 src/message/color_table.ts | 12 --------- 10 files changed, 11 insertions(+), 107 deletions(-) delete mode 100644 .estlinrrc.js delete mode 100644 src/item/description/sell_price.ts delete mode 100644 src/logging/loggers/async_file.ts delete mode 100644 src/logging/loggers/sync_file.ts delete mode 100644 src/main/prod.ts delete mode 100644 src/message/color_table.ts diff --git a/.eslintrc.js b/.eslintrc.js index 4e41267..d96c730 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -6,6 +6,7 @@ module.exports = { "plugin:@typescript-eslint/recommended", "./node_modules/gts/", "plugin:unicorn/recommended", + "plugin:import/recommended" ], env: { es6: true, diff --git a/.estlinrrc.js b/.estlinrrc.js deleted file mode 100644 index 4e41267..0000000 --- a/.estlinrrc.js +++ /dev/null @@ -1,39 +0,0 @@ -module.exports = { - parser: "@typescript-eslint/parser", - extends: [ - "eslint:recommended", - "plugin:@typescript-eslint/eslint-recommended", - "plugin:@typescript-eslint/recommended", - "./node_modules/gts/", - "plugin:unicorn/recommended", - ], - env: { - es6: true, - jest: true, - }, - parserOptions: { - ecmaVersion: 2019, - sourceType: "module", - }, - plugins: ["eslint-plugin-tsdoc", "unicorn", "simple-import-sort", "import"], - rules: { - indent: ["warn", 4, { SwitchCase: 1 }], - quotes: ["warn", "double"], - radix: "error", - complexity: ["error", 2], - "node/no-unpublished-import": "off", - "@typescript-eslint/camelcase": "off", - "@typescript-eslint/no-unused-vars": [2, { args: "none" }], - "@typescript-eslint/interface-name-prefix": "off", - "@typescript-eslint/prefer-interface": "off", - "@typescript-eslint/indent": "off", - "tsdoc/syntax": "error", - "unicorn/filename-case": "off", - "simple-import-sort/imports": "error", - "simple-import-sort/exports": "error", - "import/first": "error", - "import/newline-after-import": "error", - "import/no-duplicates": "error", - "max-len": ["warn", { code: 120 }], - }, -}; diff --git a/.prettierrc b/.prettierrc index 7b37d12..00bf53a 100644 --- a/.prettierrc +++ b/.prettierrc @@ -6,13 +6,8 @@ "singleQuote":false, "trailingComma":"all", "bracketSpacing":true, - "jsxBracketSameLine":false, "arrowParens":"always", "requirePragma":false, "insertPragma":false, "proseWrap":"always", - "svelteSortOrder" : "scripts-markup-styles", - "svelteStrictMode": true, - "svelteBracketNewLine": true, - "svelteAllowShorthand": false, } diff --git a/Makefile b/Makefile index 2593412..609fb17 100644 --- a/Makefile +++ b/Makefile @@ -6,6 +6,7 @@ ENTRYPOINT=$(DIST)/index.js TSC=./node_modules/.bin/tsc TSC_WATCH=./node_modules/.bin/tsc-watch ESLINT=./node_modules/.bin/eslint +PRETTIER=./node_modules/.bin/prettier JEST=./node_modules/.bin/jest TSC_FLAGS= @@ -33,8 +34,10 @@ node_modules: package.json pnpm-lock.yaml lint: node_modules $(ESLINT) $(TS_SOURCES) $(TEST_SOURCES) + $(PRETTIER) $(TS_SOURCES) $(TEST_SOURCES) fix: node_modules + $(PRETTIER) --write $(TS_SOURCES) $(TEST_SOURCES) $(ESLINT) --fix $(TS_SOURCES) $(TEST_SOURCES) dev: node_modules data.json diff --git a/src/item/description/sell_price.ts b/src/item/description/sell_price.ts deleted file mode 100644 index dcb0d3e..0000000 --- a/src/item/description/sell_price.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { ItemTooltip } from "../tooltip"; -import { DescriptionFieldParser } from "./field_parser"; - -export class SellPriceDescriptionFieldParser implements DescriptionFieldParser { - public qualifies(field: ItemTooltip): boolean { - return field.label === "Sell Price:"; - } - - public mutate_label(_field: ItemTooltip): string { - return ""; - } -} diff --git a/src/item/quality_color.ts b/src/item/quality_color.ts index cd0ef62..3dba7e4 100644 --- a/src/item/quality_color.ts +++ b/src/item/quality_color.ts @@ -4,13 +4,13 @@ import { ItemQuality } from "./quality"; export class QualityColor { protected static readonly QUALITY_COLOR_TABLE: Record = { - Poor: 0x9D_9D_9D, - Common: 0xFF_FF_FF, - Uncommon: 0x1E_FF_00, - Rare: 0x00_70_DD, - Epic: 0xA3_35_EE, - Legendary: 0xFF_80_00, - Artifact: 0xE6_CC_80, + Poor: 0x9d_9d_9d, + Common: 0xff_ff_ff, + Uncommon: 0x1e_ff_00, + Rare: 0x00_70_dd, + Epic: 0xa3_35_ee, + Legendary: 0xff_80_00, + Artifact: 0xe6_cc_80, }; protected readonly quality: ItemQuality; diff --git a/src/logging/loggers/async_file.ts b/src/logging/loggers/async_file.ts deleted file mode 100644 index 268f86d..0000000 --- a/src/logging/loggers/async_file.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { AsynchronousWriteableFile } from "../../io/writable/file/async"; -import { Preformatter } from "../preformatter/preformatter"; -import { OutputDeviceLogger } from "./output_device"; - -export class AsynchronousFileOutputLogger extends OutputDeviceLogger> { - public constructor( - path: string, - preformatter: Preformatter, - debug = true, - log = true, - warning = true, - error = true, - ) { - super(new AsynchronousWriteableFile(path), preformatter, debug, log, warning, error); - } -} diff --git a/src/logging/loggers/sync_file.ts b/src/logging/loggers/sync_file.ts deleted file mode 100644 index 0766368..0000000 --- a/src/logging/loggers/sync_file.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { SynchronousWriteableFile } from "../../io/writable/file/sync"; -import { Preformatter } from "../preformatter/preformatter"; -import { OutputDeviceLogger } from "./output_device"; - -export class SynchronousFileOutputLogger extends OutputDeviceLogger { - public constructor( - path: string, - preformatter: Preformatter, - debug = true, - log = true, - warning = true, - error = true, - ) { - super(new SynchronousWriteableFile(path), preformatter, debug, log, warning, error); - } -} diff --git a/src/main/prod.ts b/src/main/prod.ts deleted file mode 100644 index e69de29..0000000 diff --git a/src/message/color_table.ts b/src/message/color_table.ts deleted file mode 100644 index b6f8ef4..0000000 --- a/src/message/color_table.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { HexColorString } from "discord.js"; - -export const WOW_ITEM_COLORS: Record = { - POOR: "#9d9d9d", - COMMON: "#ffffff", - UNCOMMON: "#1eff00", - RARE: "#0070dd", - EPIC: "#a335ee", - LEGENDARY: "#ff8000", - ARTIFACT: "#e6cc80", - HEIRLOOM: "#00ccff", -};