[英]eslint Failed to load config "react-app" to extend from. when making changes in project
[英]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.