From a2d27ed20ceace45e50cb4c02babda5c8c35d067 Mon Sep 17 00:00:00 2001 From: Ben McCann <322311+benmccann@users.noreply.github.com> Date: Wed, 28 Jul 2021 08:34:24 -0700 Subject: [PATCH 1/7] Align batch warning for UNUSED_EXTERNAL_IMPORT to individual warning --- 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..e129a64f10a 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${ + warning.sources + ? ' in ' + printQuotedStringList(warning.sources.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..4a7e9741762 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, From 7e771fe77e2ae8a33aa11137377b805f66a02af5 Mon Sep 17 00:00:00 2001 From: Ben McCann <322311+benmccann@users.noreply.github.com> Date: Thu, 29 Jul 2021 00:14:01 -0700 Subject: [PATCH 2/7] assume not undefined --- cli/run/batchWarnings.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/cli/run/batchWarnings.ts b/cli/run/batchWarnings.ts index e129a64f10a..ba223fc51cd 100644 --- a/cli/run/batchWarnings.ts +++ b/cli/run/batchWarnings.ts @@ -238,10 +238,8 @@ const deferredHandlers: { title('Unused external imports'); for (const warning of warnings) { stderr( - `${warning.names} imported from external module '${warning.source}' but never used${ - warning.sources - ? ' in ' + printQuotedStringList(warning.sources.map(id => relativeId(id))) - : '' + `${warning.names} imported from external module '${warning.source}' but never used in ${ + printQuotedStringList((warning.sources).map(id => relativeId(id))) }` ); } From 735e9a2814b7b37d918cbee195b47b6ccc6456ab Mon Sep 17 00:00:00 2001 From: Ben McCann <322311+benmccann@users.noreply.github.com> Date: Thu, 29 Jul 2021 00:20:51 -0700 Subject: [PATCH 3/7] prettier --- cli/run/batchWarnings.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/cli/run/batchWarnings.ts b/cli/run/batchWarnings.ts index ba223fc51cd..f9282501a67 100644 --- a/cli/run/batchWarnings.ts +++ b/cli/run/batchWarnings.ts @@ -238,9 +238,10 @@ const deferredHandlers: { title('Unused external imports'); for (const warning of warnings) { stderr( - `${warning.names} imported from external module '${warning.source}' but never used in ${ - printQuotedStringList((warning.sources).map(id => relativeId(id))) - }` + `${warning.names} imported from external module '${warning.source}' + but never used in ${printQuotedStringList( + (warning.sources as string[]).map(id => relativeId(id)) + )}` ); } } From 564f7d0a40700c840223ee5d23dd3eaf3cd06c1f Mon Sep 17 00:00:00 2001 From: Ben McCann <322311+benmccann@users.noreply.github.com> Date: Thu, 29 Jul 2021 00:27:30 -0700 Subject: [PATCH 4/7] prettier --- cli/run/batchWarnings.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/cli/run/batchWarnings.ts b/cli/run/batchWarnings.ts index f9282501a67..37541fbf0c5 100644 --- a/cli/run/batchWarnings.ts +++ b/cli/run/batchWarnings.ts @@ -238,10 +238,11 @@ const deferredHandlers: { title('Unused external imports'); for (const warning of warnings) { stderr( - `${warning.names} imported from external module '${warning.source}' - but never used in ${printQuotedStringList( - (warning.sources as string[]).map(id => relativeId(id)) - )}` + `${warning.names} imported from external module '${ + warning.source + }' but never used in ${printQuotedStringList( + (warning.sources as string[]).map(id => relativeId(id)) + )}` ); } } From 429209cfd0bf828b766559fc356f6602a39b55a8 Mon Sep 17 00:00:00 2001 From: Ben McCann <322311+benmccann@users.noreply.github.com> Date: Thu, 29 Jul 2021 00:34:47 -0700 Subject: [PATCH 5/7] prettier --- cli/run/batchWarnings.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/cli/run/batchWarnings.ts b/cli/run/batchWarnings.ts index 37541fbf0c5..28d5e2dd210 100644 --- a/cli/run/batchWarnings.ts +++ b/cli/run/batchWarnings.ts @@ -238,11 +238,11 @@ const deferredHandlers: { title('Unused external imports'); for (const warning of warnings) { stderr( - `${warning.names} imported from external module '${ - warning.source - }' but never used in ${printQuotedStringList( - (warning.sources as string[]).map(id => relativeId(id)) - )}` + warning.names + + ' imported from external module ' + + warning.source + + ' but never used in ' + + printQuotedStringList((warning.sources as string[]).map(id => relativeId(id))) ); } } From 980c845fa91c958e6b9ca11ae655bb3e1ad239fc Mon Sep 17 00:00:00 2001 From: Ben McCann <322311+benmccann@users.noreply.github.com> Date: Thu, 29 Jul 2021 00:48:59 -0700 Subject: [PATCH 6/7] quotes --- cli/run/batchWarnings.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cli/run/batchWarnings.ts b/cli/run/batchWarnings.ts index 28d5e2dd210..1af0e496168 100644 --- a/cli/run/batchWarnings.ts +++ b/cli/run/batchWarnings.ts @@ -239,9 +239,9 @@ const deferredHandlers: { for (const warning of warnings) { stderr( warning.names + - ' imported from external module ' + + " imported from external module '" + warning.source + - ' but never used in ' + + "' but never used in " + printQuotedStringList((warning.sources as string[]).map(id => relativeId(id))) ); } From ec2ac8fba44628d5cb1106e9cf9b9ebbf5d4fca6 Mon Sep 17 00:00:00 2001 From: Ben McCann <322311+benmccann@users.noreply.github.com> Date: Thu, 29 Jul 2021 07:14:52 -0700 Subject: [PATCH 7/7] double quotes --- cli/run/batchWarnings.ts | 4 ++-- test/cli/samples/warn-import-export/_config.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cli/run/batchWarnings.ts b/cli/run/batchWarnings.ts index 1af0e496168..5fa9a1a1fb6 100644 --- a/cli/run/batchWarnings.ts +++ b/cli/run/batchWarnings.ts @@ -239,9 +239,9 @@ const deferredHandlers: { for (const warning of warnings) { stderr( warning.names + - " imported from external module '" + + ' imported from external module "' + warning.source + - "' but never used in " + + '" 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 4a7e9741762..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 in "main.js"\n` + `default imported from external module "external" but never used in "main.js"\n` ); assertIncludes( stderr,