繁体   English   中英

eslint 无法加载配置“react-app”以扩展

[英]eslint failed to load config "react-app" to extend from

我之前遇到过 eslint 的一个奇怪问题,我不得不卸载 node_modules 并安装 npm ,自从我这样做后,我的代码中出现了我以前从未遇到过的新错误。 我无法弄清楚如何解决的一个错误就是这个。

ERROR in [eslint] Failed to load config "react-app" to extend from.
Referenced from: C:\Users\Justi\Downloads\package.json

这是我的 package.json 文件夹:

{
  "name": "gingerrmarket",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@emotion/react": "^11.5.0",
    "@emotion/styled": "^11.3.0",
    "@fortawesome/free-solid-svg-icons": "^5.15.4",
    "@fortawesome/react-fontawesome": "^0.1.16",
    "@material-ui/core": "^4.12.3",
    "@material-ui/icons": "^4.11.2",
    "@mui/icons-material": "^5.0.4",
    "@mui/material": "^5.1.0",
    "@testing-library/jest-dom": "^5.14.1",
    "@testing-library/react": "^11.2.7",
    "@testing-library/user-event": "^12.8.3",
    "firebase": "^9.4.1",
    "react": "^17.0.2",
    "react-dom": "^17.0.2",
    "react-feather": "^2.0.9",
    "react-router-dom": "^6.0.0",
    "react-scripts": "^5.0.1",
    "web-vitals": "^1.1.2"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  }
}

这是我在 babel 中的 eslint 解析器文件(我不确定它是否有用。)

   "name": "@babel/eslint-parser",
  "version": "7.18.2",
  "description": "ESLint parser that allows for linting of experimental syntax transformed by Babel",
  "author": "The Babel Team (https://babel.dev/team)",
  "license": "MIT",
  "repository": {
    "type": "git",
    "url": "https://github.com/babel/babel.git",
    "directory": "eslint/babel-eslint-parser"
  },
  "publishConfig": {
    "access": "public"
  },
  "bugs": {
    "url": "https://github.com/babel/babel/issues"
  },
  "homepage": "https://babel.dev/",
  "engines": {
    "node": "^10.13.0 || ^12.13.0 || >=14.0.0"
  },
  "main": "./lib/index.cjs",
  "type": "commonjs",
  "exports": {
    ".": "./lib/index.cjs",
    "./experimental-worker": "./lib/experimental-worker.cjs",
    "./package.json": "./package.json"
  },
  "peerDependencies": {
    "@babel/core": ">=7.11.0",
    "eslint": "^7.5.0 || ^8.0.0"
  },
  "dependencies": {
    "eslint-scope": "^5.1.1",
    "eslint-visitor-keys": "^2.1.0",
    "semver": "^6.3.0"
  },
  "devDependencies": {
    "@babel/core": "^7.18.2",
    "dedent": "^0.7.0",
    "eslint": "^7.27.0",
    "eslint-8": "npm:eslint@^8.0.0"
  }
}

有没有人有什么建议? 请帮忙。

你试过运行npm i eslint-config-react-app -D了吗?

为此,所需要的只是

"eslintConfig": { "extends": [ "react-app", "react-app/jest" ] },

在 package.json

我遇到了同样的问题,但下面的代码已经附加。 谁能告诉另一种解决这个问题的方法

"eslintConfig": { "extends": [ "react-app", "react-app/jest" ]

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM