Require decoratorsBeforeExport option for decorators (#8465)

* Require decoratorsBeforeExport option for syntax-decorators

* Also babylon

* Enable test
This commit is contained in:
Nicolò Ribaudo
2018-08-15 09:04:52 +02:00
committed by GitHub
parent 1e0b649485
commit d79b5eeeff
14 changed files with 111 additions and 24 deletions

View File

@@ -17,7 +17,14 @@ export default declare((api, options) => {
}
const { decoratorsBeforeExport } = options;
if (decoratorsBeforeExport !== undefined) {
if (decoratorsBeforeExport === undefined) {
if (!legacy) {
throw new Error(
"The '@babel/plugin-syntax-decorators' plugin requires a" +
" 'decoratorsBeforeExport' option, whose value must be a boolean.",
);
}
} else {
if (legacy) {
throw new Error(
"'decoratorsBeforeExport' can't be used with legacy decorators.",