Eslint fails to parse and red-highlights optional chaining (?.) and nullish coalescing (??) operators

后端 未结 4 755
离开以前
离开以前 2021-02-05 05:26

I am looking for the relevant eslint rules for

  • @babel/plugin-proposal-optional-chaining
  • @babel/plugin-proposal-nullish-coalescing-operator

4条回答
  •  死守一世寂寞
    2021-02-05 06:05

    Nullish coalescing operator is natively supported starting from eslint>=7.5.0.

    The easiest is set ES2020 in your package.json:

    {
      "eslintConfig":
      {
        "parserOptions":
        {
          "ecmaVersion": 2020
        }
      }
    }
    

提交回复
热议问题