From 9d244ae66b6561b5d031bdb4e4eaacd043dcbbb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Ribaudo?= Date: Wed, 29 Aug 2018 16:02:18 +0200 Subject: [PATCH] More helpful error message for missing decoratorsBeforeExport in parser (#8576) --- packages/babel-parser/src/plugin-utils.js | 6 ++++-- .../decoratorsBeforeExport-required/options.json | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/packages/babel-parser/src/plugin-utils.js b/packages/babel-parser/src/plugin-utils.js index 8260bdc00c..e378b0afda 100644 --- a/packages/babel-parser/src/plugin-utils.js +++ b/packages/babel-parser/src/plugin-utils.js @@ -55,8 +55,10 @@ export function validatePlugins(plugins: PluginList) { ); if (decoratorsBeforeExport == null) { throw new Error( - "The 'decorators' plugin requires a" + - " 'decoratorsBeforeExport' option, whose value must be a boolean.", + "The 'decorators' plugin requires a 'decoratorsBeforeExport' option," + + " whose value must be a boolean. If you are migrating from" + + " Babylon/Babel 6 or want to use the old decorators proposal, you" + + " should use the 'decorators-legacy' plugin instead of 'decorators'.", ); } else if (typeof decoratorsBeforeExport !== "boolean") { throw new Error("'decoratorsBeforeExport' must be a boolean."); diff --git a/packages/babel-parser/test/fixtures/experimental/decorators-2/decoratorsBeforeExport-required/options.json b/packages/babel-parser/test/fixtures/experimental/decorators-2/decoratorsBeforeExport-required/options.json index 6e76b5fb33..3a1e80661a 100644 --- a/packages/babel-parser/test/fixtures/experimental/decorators-2/decoratorsBeforeExport-required/options.json +++ b/packages/babel-parser/test/fixtures/experimental/decorators-2/decoratorsBeforeExport-required/options.json @@ -1,4 +1,4 @@ { "plugins": ["decorators"], - "throws": "The 'decorators' plugin requires a 'decoratorsBeforeExport' option, whose value must be a boolean." + "throws": "The 'decorators' plugin requires a 'decoratorsBeforeExport' option, whose value must be a boolean. If you are migrating from Babylon/Babel 6 or want to use the old decorators proposal, you should use the 'decorators-legacy' plugin instead of 'decorators'." }