From 586cb38600647f0919117573e8fa8b1e978a63fd Mon Sep 17 00:00:00 2001 From: Ben McCann <322311+benmccann@users.noreply.github.com> Date: Thu, 29 Jul 2021 08:42:09 -0700 Subject: [PATCH] Align batch warning for UNUSED_EXTERNAL_IMPORT to individual warning (#4194) * Align batch warning for UNUSED_EXTERNAL_IMPORT to individual warning * assume not undefined * prettier * prettier * prettier * quotes * double quotes --- cli/run/batchWarnings.ts | 8 +++++++- test/cli/samples/warn-import-export/_config.js | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/cli/run/batchWarnings.ts b/cli/run/batchWarnings.ts index 4b989d87ef8..5fa9a1a1fb6 100644 --- a/cli/run/batchWarnings.ts +++ b/cli/run/batchWarnings.ts @@ -237,7 +237,13 @@ const deferredHandlers: { UNUSED_EXTERNAL_IMPORT(warnings) { title('Unused external imports'); for (const warning of warnings) { - stderr(`${warning.names} imported from external module '${warning.source}' but never used`); + stderr( + warning.names + + ' imported from external module "' + + warning.source + + '" but never used in ' + + printQuotedStringList((warning.sources as string[]).map(id => relativeId(id))) + ); } } }; diff --git a/test/cli/samples/warn-import-export/_config.js b/test/cli/samples/warn-import-export/_config.js index c0c549251e3..202692684d1 100644 --- a/test/cli/samples/warn-import-export/_config.js +++ b/test/cli/samples/warn-import-export/_config.js @@ -16,7 +16,7 @@ module.exports = { assertIncludes( stderr, '(!) Unused external imports\n' + - "default imported from external module 'external' but never used\n" + `default imported from external module "external" but never used in "main.js"\n` ); assertIncludes( stderr,