JSX not allowed in files with extension ' .js' with eslint-config-airbnb

后端 未结 6 914
执笔经年
执笔经年 2020-12-04 12:08

I\'ve installed eslint-config-airbnb that is supposed to pre configure ESLINT for React:

Our default export contains all of our ESLint rules, includin

6条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-04 12:25

    Either change your file extensions to .jsx as mentioned or disable the jsx-filename-extension rule. You can add the following to your config to allow .js extensions for JSX.

    "rules": {
      "react/jsx-filename-extension": [1, { "extensions": [".js", ".jsx"] }],
    }
    

提交回复
热议问题