How do I configure ESLint to allow fat arrow class methods

前端 未结 6 1382
北恋
北恋 2020-12-01 06:59

ESLint is throwing a Parsing error: Unexpected token = error when I try to lint my Es6 classes. What configuration parameter am I missing to enable fat arrow c

6条回答
  •  醉梦人生
    2020-12-01 07:51

    I came across the same problem today

    and @dreyescat 's answer works for me.

    By default, babel uses 3 presets: es2015, react, stage-2

    Screenshot with "Parsing error: Unexpected token ="

    Then if you also select the stage-1preset, the error is gone

    Screenshot with no error

    You can test it on the bebeljs.io site yourself

提交回复
热议问题