prettier: Doesn't understand decorators

I just got this error from the Atom package:

SyntaxError: Unexpected token @ (9:0)
   7 | import formousOptions from './theme-form-fields';
   8 | 
>  9 | @Formous(formousOptions)
     | ^
  10 | @Radium
  11 | class ThemeForm extends Component {
  12 |   constructor(props) {

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 22 (12 by maintainers)

Most upvoted comments

Closing as we’re not going to support this in the flow parser. You should use babylon parser if you want to use decorators.

@fiber-god Babylon also understands flow types, so you should be fine to use it.

Ah gotcha. Sorry for the misunderstanding!

The error is self-explanatory, if you attach it to a class then Babylon doesn’t complain anymore (but not Flow):

import formousOptions from "./theme-form-fields";

@Formous(formousOptions)
class test {}