diff --git a/src/core/ctx.ts b/src/core/ctx.ts index 4cabaf94..656a2eeb 100644 --- a/src/core/ctx.ts +++ b/src/core/ctx.ts @@ -80,7 +80,7 @@ ${dts}`.trim()}\n` if (!imports.length && !resolvers.length && !dirs?.length) console.warn('[auto-import] plugin installed but no imports has defined, see https://github.com/antfu/unplugin-auto-import#configurations for configurations') - const compare = (left: string|undefined, right: NonNullable<(Options['ignore'] | Options['ignoreDts'])>[number]) => { + const compare = (left: string | undefined, right: NonNullable<(Options['ignore'] | Options['ignoreDts'])>[number]) => { return right instanceof RegExp ? right.test(left!) : right === left @@ -88,12 +88,14 @@ ${dts}`.trim()}\n` options.ignore?.forEach((name) => { const i = imports.find(i => compare(i.as, name)) - if (i) i.disabled = true + if (i) + i.disabled = true }) options.ignoreDts?.forEach((name) => { const i = imports.find(i => compare(i.as, name)) - if (i) i.dtsDisabled = true + if (i) + i.dtsDisabled = true }) return unimport.getInternalContext().replaceImports(imports) diff --git a/test/dts.ignore.test.ts b/test/dts.ignore.test.ts index 55249189..d6001cea 100644 --- a/test/dts.ignore.test.ts +++ b/test/dts.ignore.test.ts @@ -10,13 +10,13 @@ it('dts ignore', async () => { 'shouldBePresent', 'shouldAlsoBePresent', 'shouldBeIgnored', - 'ignoreme_shoudAlsoBeIgnored' - ] + 'ignoreme_shoudAlsoBeIgnored', + ], }], ignoreDts: [ 'shouldBeIgnored', - /^ignoreme_/ - ] + /^ignoreme_/, + ], }) const dtsContent = await ctx.generateDTS(join(cwd, 'index.d.ts'))