猿问

如何在没有配置文件的情况下修复导入/导出 babel-eslint?

当我点击 npm start 时,出现以下错误:


Parsing error: 'import' and 'export' may only appear at the top level

当我查看此错误时,他们说我需要更新 eslint 配置文件,并在解析器选项中设置为 true 等等。但是,我没有 eslint 配置文件,我的包 json 如下所示:


{

  "name": "client",

  "version": "0.1.0",

  "private": true,

  "dependencies": {

    "@material-ui/core": "^3.6.1",

    "@material-ui/icons": "^3.0.1",

    "material-icons-react": "^1.0.4",

    "react": "^16.6.3",

    "react-dom": "^16.6.3",

    "react-scripts": "2.1.1",

    "truffle-contract": "^4.0.0-beta.1",

    "web3": "^1.0.0-beta.36"

  },

  "scripts": {

    "start": "react-scripts start",

    "build": "react-scripts build",

    "test": "react-scripts test",

    "eject": "react-scripts eject"

  },

  "eslintConfig": {

    "extends": "react-app"

  },

  "browserslist": [

    ">0.2%",

    "not dead",

    "not ie <= 11",

    "not op_mini all"

  ]

}

更新:整个错误:


./src/App.js

  Line 131:  Parsing error: 'import' and 'export' may only appear at the top level


  129 |     );

  130 | 

> 131 |   export default App;

      |   ^

  132 | 

  133 |       <div id="dashboard">

  134 |         <div className="menu">


森栏
浏览 281回答 1
1回答
随时随地看视频慕课网APP

相关分类

JavaScript
我要回答