ant-design-pro: Precommit Error: Using the export keyword between a decorator and a class is not allowed

\src\routes\List\TableList.js

error Parsing error: Using the export keyword between a decorator and a class is not allowed. Please use export @dec class instead.

  64 | }))
  65 | @Form.create()
> 66 | export default class TableList extends PureComponent {
     | ^
  67 |   state = {
  68 |     modalVisible: false,
  69 |     expandForm: false,

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 23 (7 by maintainers)

Most upvoted comments

,
//  "husky": {
//    "hooks": {
//      "pre-commit": "npm run lint-staged"
//    }
//  }
```去掉就行

我clone了最新的代码,提交时依然在precommit会报错。最终发现,是因为lint-staged中会执行prettier --write命令,这个命令把decorator的用法又改回了旧的格式,导致随后的lint不通过,从而无法commit

我改的时候也感到很蛋疼。。