当我尝试运行 ReactJS 项目时,我不断收到这些错误
\nprettier/prettier\n Line 23:39: Replace `'react-toastify'` with `"react-toastify"` prettier/prettier\n Line 29:59: Delete `\xe2\x8f\x8e` prettier/prettier\nRun Code Online (Sandbox Code Playgroud)\n以下是我的.eslintrc.js
module.exports = {\n parser: "babel-eslint",\n env: {\n es6: true,\n node: true,\n browser: true,\n },\n parserOptions: {\n ecmaVersion: 6,\n sourceType: "module",\n ecmaFeatures: {\n jsx: true,\n },\n },\n plugins: ["react"],\n extends: [\n "eslint:recommended",\n "plugin:react/recommended",\n "plugin:prettier/recommended",\n ]\n};\n\nRun Code Online (Sandbox Code Playgroud)\n以下是 package.json
\n{\n "name": "material-dashboard-react",\n "version": "1.10.0",\n "description": "Material Dashboard React. Coded by Creative Tim",\n "private": false,\n "main": "dist/index.js",\n "dependencies": {\n "@material-ui/core": "4.11.4",\n "@material-ui/icons": "4.11.2",\n "axios": "^0.21.1",\n "chartist": "0.10.1",\n "classnames": "2.3.1",\n "history": "5.0.0",\n "perfect-scrollbar": "1.5.1",\n "prop-types": "15.7.2",\n "react": "17.0.2",\n "react-chartist": "0.14.4",\n "react-dom": "17.0.2",\n "react-router-dom": "5.2.0",\n "react-scripts": "4.0.3",\n "react-swipeable-views": "0.14.0",\n "react-toastify": "^7.0.4"\n },\n "scripts": {\n "start": "react-scripts start",\n "build": "react-scripts build",\n "test": "react-scripts test --env=jsdom",\n "eject": "react-scripts eject",\n "install:clean": "rm -rf node_modules/ && rm -rf package-lock.json && npm install && npm start",\n "lint:check": "eslint . --ext=js,jsx; exit 0",\n "lint:fix": "eslint . --ext=js,jsx --fix; exit 0",\n "build-package-css": "cp src/assets/css/material-dashboard-react.css dist/material-dashboard-react.css",\n "build-package": "npm run build-package-css && babel src --out-dir dist"\n },\n "repository": {\n "type": "git",\n "url": "git+https://github.com/creativetimofficial/material-dashboard-react.git"\n },\n "keywords": [],\n "author": "Creative Tim <hello@creative-tim.com> (https://www.creative-tim.com/)",\n "license": "MIT",\n "bugs": {\n "url": "https://github.com/creativetimofficial/material-dashboard-react/issues"\n },\n "homepage": "https://creativetimofficial.github.io/material-dashboard-react/#/dashboard",\n "optionalDependencies": {\n "@babel/core": "7.14.0",\n "typescript": "4.2.4"\n },\n "devDependencies": {\n "eslint-config-prettier": "8.3.0",\n "eslint-plugin-prettier": "3.4.0",\n "gulp": "4.0.2",\n "gulp-append-prepend": "1.0.9",\n "prettier": "2.2.1"\n },\n "browserslist": {\n "production": [\n ">0.2%",\n "not dead",\n "not op_mini all"\n ],\n "development": []\n }\n}\n\nRun Code Online (Sandbox Code Playgroud)\n
如果您不希望它完全阻止您运行 Web 应用程序,您可以将 Prettier 的严重级别从“错误”更改为“警告”。
在您的.eslint.json文件rules对象中,更改为
"prettier/prettier": "error",
Run Code Online (Sandbox Code Playgroud)
到
"prettier/prettier": "warn",
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
7529 次 |
| 最近记录: |