From d8151e3452fae709d4b9b2f703f6a74b7c67bf0b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Ribaudo?= Date: Thu, 16 Sep 2021 23:02:25 +0200 Subject: [PATCH] Update error message --- .../src/rewrite-live-references.ts | 2 +- .../fixtures/integration/missing-flow-plugin-deep/options.json | 2 +- .../integration/missing-flow-plugin-type-cast/options.json | 2 +- .../test/fixtures/integration/missing-flow-plugin/options.json | 2 +- .../fixtures/integration/missing-ts-plugin-deep/options.json | 2 +- .../missing-ts-plugin-type-assertion-legacy/options.json | 2 +- .../integration/missing-ts-plugin-type-assertion/options.json | 2 +- .../test/fixtures/integration/missing-ts-plugin/options.json | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/packages/babel-helper-module-transforms/src/rewrite-live-references.ts b/packages/babel-helper-module-transforms/src/rewrite-live-references.ts index 7563fc8efffa..ca7b3e36e531 100644 --- a/packages/babel-helper-module-transforms/src/rewrite-live-references.ts +++ b/packages/babel-helper-module-transforms/src/rewrite-live-references.ts @@ -245,7 +245,7 @@ const rewriteReferencesVisitor: Visitor = { if (importData) { if (isInType(path)) { throw path.buildCodeFrameError( - `Cannot transform the imported ${localName} binding since it's used in a type annotation. ` + + `Cannot transform the imported binding "${localName}" since it's also used in a type annotation. ` + `Please strip type annotations using @babel/preset-typescript or @babel/preset-flow.`, ); } diff --git a/packages/babel-plugin-transform-modules-commonjs/test/fixtures/integration/missing-flow-plugin-deep/options.json b/packages/babel-plugin-transform-modules-commonjs/test/fixtures/integration/missing-flow-plugin-deep/options.json index 5488d6aa7d65..f67526e40e72 100644 --- a/packages/babel-plugin-transform-modules-commonjs/test/fixtures/integration/missing-flow-plugin-deep/options.json +++ b/packages/babel-plugin-transform-modules-commonjs/test/fixtures/integration/missing-flow-plugin-deep/options.json @@ -2,5 +2,5 @@ "externalHelpers": true, "sourceType": "module", "plugins": ["transform-modules-commonjs", "syntax-flow"], - "throws": "Cannot transform the imported A binding since it's used in a type annotation. Please strip type annotations using @babel/preset-typescript or @babel/preset-flow." + "throws": "Cannot transform the imported binding \"A\" since it's also used in a type annotation. Please strip type annotations using @babel/preset-typescript or @babel/preset-flow." } diff --git a/packages/babel-plugin-transform-modules-commonjs/test/fixtures/integration/missing-flow-plugin-type-cast/options.json b/packages/babel-plugin-transform-modules-commonjs/test/fixtures/integration/missing-flow-plugin-type-cast/options.json index 5488d6aa7d65..f67526e40e72 100644 --- a/packages/babel-plugin-transform-modules-commonjs/test/fixtures/integration/missing-flow-plugin-type-cast/options.json +++ b/packages/babel-plugin-transform-modules-commonjs/test/fixtures/integration/missing-flow-plugin-type-cast/options.json @@ -2,5 +2,5 @@ "externalHelpers": true, "sourceType": "module", "plugins": ["transform-modules-commonjs", "syntax-flow"], - "throws": "Cannot transform the imported A binding since it's used in a type annotation. Please strip type annotations using @babel/preset-typescript or @babel/preset-flow." + "throws": "Cannot transform the imported binding \"A\" since it's also used in a type annotation. Please strip type annotations using @babel/preset-typescript or @babel/preset-flow." } diff --git a/packages/babel-plugin-transform-modules-commonjs/test/fixtures/integration/missing-flow-plugin/options.json b/packages/babel-plugin-transform-modules-commonjs/test/fixtures/integration/missing-flow-plugin/options.json index 5488d6aa7d65..f67526e40e72 100644 --- a/packages/babel-plugin-transform-modules-commonjs/test/fixtures/integration/missing-flow-plugin/options.json +++ b/packages/babel-plugin-transform-modules-commonjs/test/fixtures/integration/missing-flow-plugin/options.json @@ -2,5 +2,5 @@ "externalHelpers": true, "sourceType": "module", "plugins": ["transform-modules-commonjs", "syntax-flow"], - "throws": "Cannot transform the imported A binding since it's used in a type annotation. Please strip type annotations using @babel/preset-typescript or @babel/preset-flow." + "throws": "Cannot transform the imported binding \"A\" since it's also used in a type annotation. Please strip type annotations using @babel/preset-typescript or @babel/preset-flow." } diff --git a/packages/babel-plugin-transform-modules-commonjs/test/fixtures/integration/missing-ts-plugin-deep/options.json b/packages/babel-plugin-transform-modules-commonjs/test/fixtures/integration/missing-ts-plugin-deep/options.json index 0b34b9f7a291..343fffdf6f9c 100644 --- a/packages/babel-plugin-transform-modules-commonjs/test/fixtures/integration/missing-ts-plugin-deep/options.json +++ b/packages/babel-plugin-transform-modules-commonjs/test/fixtures/integration/missing-ts-plugin-deep/options.json @@ -2,5 +2,5 @@ "externalHelpers": true, "sourceType": "module", "plugins": ["transform-modules-commonjs", "syntax-typescript"], - "throws": "Cannot transform the imported A binding since it's used in a type annotation. Please strip type annotations using @babel/preset-typescript or @babel/preset-flow." + "throws": "Cannot transform the imported binding \"A\" since it's also used in a type annotation. Please strip type annotations using @babel/preset-typescript or @babel/preset-flow." } diff --git a/packages/babel-plugin-transform-modules-commonjs/test/fixtures/integration/missing-ts-plugin-type-assertion-legacy/options.json b/packages/babel-plugin-transform-modules-commonjs/test/fixtures/integration/missing-ts-plugin-type-assertion-legacy/options.json index 0b34b9f7a291..343fffdf6f9c 100644 --- a/packages/babel-plugin-transform-modules-commonjs/test/fixtures/integration/missing-ts-plugin-type-assertion-legacy/options.json +++ b/packages/babel-plugin-transform-modules-commonjs/test/fixtures/integration/missing-ts-plugin-type-assertion-legacy/options.json @@ -2,5 +2,5 @@ "externalHelpers": true, "sourceType": "module", "plugins": ["transform-modules-commonjs", "syntax-typescript"], - "throws": "Cannot transform the imported A binding since it's used in a type annotation. Please strip type annotations using @babel/preset-typescript or @babel/preset-flow." + "throws": "Cannot transform the imported binding \"A\" since it's also used in a type annotation. Please strip type annotations using @babel/preset-typescript or @babel/preset-flow." } diff --git a/packages/babel-plugin-transform-modules-commonjs/test/fixtures/integration/missing-ts-plugin-type-assertion/options.json b/packages/babel-plugin-transform-modules-commonjs/test/fixtures/integration/missing-ts-plugin-type-assertion/options.json index 0b34b9f7a291..343fffdf6f9c 100644 --- a/packages/babel-plugin-transform-modules-commonjs/test/fixtures/integration/missing-ts-plugin-type-assertion/options.json +++ b/packages/babel-plugin-transform-modules-commonjs/test/fixtures/integration/missing-ts-plugin-type-assertion/options.json @@ -2,5 +2,5 @@ "externalHelpers": true, "sourceType": "module", "plugins": ["transform-modules-commonjs", "syntax-typescript"], - "throws": "Cannot transform the imported A binding since it's used in a type annotation. Please strip type annotations using @babel/preset-typescript or @babel/preset-flow." + "throws": "Cannot transform the imported binding \"A\" since it's also used in a type annotation. Please strip type annotations using @babel/preset-typescript or @babel/preset-flow." } diff --git a/packages/babel-plugin-transform-modules-commonjs/test/fixtures/integration/missing-ts-plugin/options.json b/packages/babel-plugin-transform-modules-commonjs/test/fixtures/integration/missing-ts-plugin/options.json index 0b34b9f7a291..343fffdf6f9c 100644 --- a/packages/babel-plugin-transform-modules-commonjs/test/fixtures/integration/missing-ts-plugin/options.json +++ b/packages/babel-plugin-transform-modules-commonjs/test/fixtures/integration/missing-ts-plugin/options.json @@ -2,5 +2,5 @@ "externalHelpers": true, "sourceType": "module", "plugins": ["transform-modules-commonjs", "syntax-typescript"], - "throws": "Cannot transform the imported A binding since it's used in a type annotation. Please strip type annotations using @babel/preset-typescript or @babel/preset-flow." + "throws": "Cannot transform the imported binding \"A\" since it's also used in a type annotation. Please strip type annotations using @babel/preset-typescript or @babel/preset-flow." }