From 4e8f59bf70f19f2a8793873172c62f75dd4a6dcd Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Wed, 9 Nov 2022 10:01:09 +0100 Subject: [PATCH] fix(schema): add declarations to ignore list (#8787) --- packages/kit/src/resolve.ts | 6 +++--- packages/schema/src/config/common.ts | 1 + test/fixtures/basic/plugins/test.d.ts | 2 ++ 3 files changed, 6 insertions(+), 3 deletions(-) create mode 100644 test/fixtures/basic/plugins/test.d.ts diff --git a/packages/kit/src/resolve.ts b/packages/kit/src/resolve.ts index a9e6d3300b..9964a904b4 100644 --- a/packages/kit/src/resolve.ts +++ b/packages/kit/src/resolve.ts @@ -83,7 +83,7 @@ export async function resolvePath (path: string, opts: ResolvePathOptions = {}): /** * Try to resolve first existing file in paths */ -export async function findPath (paths: string|string[], opts?: ResolvePathOptions, pathType: 'file' | 'dir' = 'file'): Promise { +export async function findPath (paths: string | string[], opts?: ResolvePathOptions, pathType: 'file' | 'dir' = 'file'): Promise { if (!Array.isArray(paths)) { paths = [paths] } @@ -110,8 +110,8 @@ export function resolveAlias (path: string, alias?: Record): str } export interface Resolver { - resolve(...path: string[]): string - resolvePath(path: string, opts?: ResolvePathOptions): Promise + resolve (...path: string[]): string + resolvePath (path: string, opts?: ResolvePathOptions): Promise } /** diff --git a/packages/schema/src/config/common.ts b/packages/schema/src/config/common.ts index 6193aa28e7..c30c3f9ccb 100644 --- a/packages/schema/src/config/common.ts +++ b/packages/schema/src/config/common.ts @@ -338,6 +338,7 @@ export default defineUntypedSchema({ $resolve: async (val, get) => [ '**/*.stories.{js,ts,jsx,tsx}', // ignore storybook files '**/*.{spec,test}.{js,ts,jsx,tsx}', // ignore tests + '**/*.d.ts', // ignore type declarations '.output', await get('ignorePrefix') && `**/${await get('ignorePrefix')}*.*` ].concat(val).filter(Boolean) diff --git a/test/fixtures/basic/plugins/test.d.ts b/test/fixtures/basic/plugins/test.d.ts new file mode 100644 index 0000000000..e47a00d69a --- /dev/null +++ b/test/fixtures/basic/plugins/test.d.ts @@ -0,0 +1,2 @@ +interface MyInterface {} +export {}