From 72fa1f248ce263f1f3a6727c83c7ca0eb5de2065 Mon Sep 17 00:00:00 2001 From: Maiko Tan Date: Tue, 12 Mar 2024 09:37:39 +0800 Subject: [PATCH 1/2] chore: fix lint config and error reporting again --- .eslintrc.yml | 3 +++ package.json | 2 +- src/api.ts | 2 +- tsup.config.ts | 4 +++- 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/.eslintrc.yml b/.eslintrc.yml index 2c0d644..4bc7196 100644 --- a/.eslintrc.yml +++ b/.eslintrc.yml @@ -1,2 +1,5 @@ extends: - '@hamster-bot/eslint-config/typescript' + +ignorePatterns: + - 'lib/**/*' diff --git a/package.json b/package.json index cd609ff..dba0e73 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,7 @@ "dev": "yarn build:tsup", "build:tsup": "tsup", "test": "mocha -r tsx -r yml-register --extension .spec.ts ./__tests__", - "lint": "eslint src/**/*.ts && yarn prettier --check", + "lint": "eslint './**/*.{js,ts,tsx}' && yarn prettier --check", "format": "yarn prettier --write", "prettier": "prettier '**/*.{js,ts,json,yml,yaml,md}' '!dist/**/*'" }, diff --git a/src/api.ts b/src/api.ts index bf88b78..0bc8c46 100644 --- a/src/api.ts +++ b/src/api.ts @@ -1,5 +1,5 @@ import { Context, Service } from 'koishi' -import type { SentencesParams } from 'koishi-plugin-hitokoto-sentences' +import { SentencesParams } from 'koishi-plugin-hitokoto-sentences' import { Config } from '.' diff --git a/tsup.config.ts b/tsup.config.ts index 2b535e5..b7f6145 100644 --- a/tsup.config.ts +++ b/tsup.config.ts @@ -1,3 +1,5 @@ +/* eslint-disable import/no-named-as-default-member */ +/* eslint-disable import/default */ import yaml from 'esbuild-plugin-yaml' import { defineConfig } from 'tsup' @@ -7,6 +9,6 @@ export default defineConfig({ format: ['cjs'], clean: true, outDir: 'lib', - esbuildPlugins: [yaml.yamlPlugin()], + esbuildPlugins: [yaml.yamlPlugin({})], esbuildOptions(options, context) {}, }) From 2d44cd34cdd77a664d7e4938a63ef611259a2a96 Mon Sep 17 00:00:00 2001 From: Maiko Tan Date: Tue, 12 Mar 2024 09:40:17 +0800 Subject: [PATCH 2/2] fix: format --- src/api.ts | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/api.ts b/src/api.ts index 0bc8c46..1a5e3ab 100644 --- a/src/api.ts +++ b/src/api.ts @@ -13,10 +13,7 @@ export class HitokotoApi extends Service { private _apiUrl: string config: Config - constructor( - ctx: Context, - config: Config, - ) { + constructor(ctx: Context, config: Config) { super(ctx, 'hitokoto', true) this.config = config this._apiUrl = this.config.sentences ? '' : this.config.apiUrl ?? 'https://v1.hitokoto.cn/'