首页 > 技术文章 > eslint 报错

xx929 2020-02-20 14:46 原文

1. Parsing error: Adjacent JSX elements must be wrapped in an enclosing tag

解决方案:修改.eslintrc.js

1 // 初始
2 
3 "parser": "babel-eslint",
4 
5 // 改为
6 "parserOptions": {
7     "parser": "babel-eslint"
8 },

 

2.  Parsing error: sourceType 'module' is not supported when ecmaVersion < 2015. Consider adding `{ ecmaVersion: 2015 }` to the parser options

解决方案:修改.eslintrc.js【当ecmaVersion <2015时,不支持sourceType'module'】

parserOptions: {
    "ecmaVersion": 2015
  },

 

推荐阅读