From 8b03846c304e015344e90f0f03eb7b003909a3b6 Mon Sep 17 00:00:00 2001 From: YiJie Date: Mon, 14 Oct 2024 03:55:57 +0800 Subject: [PATCH] fix(core): eslint error --- eslint.config.mjs | 10 +++++++++- packages/core/src/base.ts | 3 ++- tsconfigs/tsconfig.base.json | 1 + 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/eslint.config.mjs b/eslint.config.mjs index 0127bc8..abcc15b 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -4,7 +4,15 @@ export default config({ stylistic: false, typescript: { overrides: { - 'ts/no-namespace': 'off' + 'ts/no-namespace': 'off', + 'ts/no-empty-object-type': 'off', + 'ts/method-signature-style': 'off', + 'ts/no-use-before-define': 'off' + } + }, + javascript: { + overrides: { + 'unused-imports/no-unused-vars': 'off' } } }) diff --git a/packages/core/src/base.ts b/packages/core/src/base.ts index 0a57aff..3e43f6a 100644 --- a/packages/core/src/base.ts +++ b/packages/core/src/base.ts @@ -26,6 +26,7 @@ const CANT_OVERRIDE = Object.freeze([ 'shape' ] as const) export function t(...types: T): Typp { + // eslint-disable-next-line no-undef-init let shape: unknown = undefined let consumerAttachedFields: Record = {} for (const consumer of consumers) { @@ -356,7 +357,7 @@ export namespace t { key: K, resolver: ResolverUtils[K], options: UseResolverOptions = {} ) { if (typeof resolver !== 'function') { - throw new Error(`You can't use resolver for typp, because the resolver "${key}" is not a function`) + throw new TypeError(`You can't use resolver for typp, because the resolver "${key}" is not a function`) } const isExisted = Object.hasOwnProperty.call(utils, key) if (isExisted && !options.override) { diff --git a/tsconfigs/tsconfig.base.json b/tsconfigs/tsconfig.base.json index cfe3903..f1c0519 100644 --- a/tsconfigs/tsconfig.base.json +++ b/tsconfigs/tsconfig.base.json @@ -1,6 +1,7 @@ { "compilerOptions": { "module": "ESNext", + "target": "ES2015", "strict": true, "strictNullChecks": true, "esModuleInterop": true,