简体   繁体   English

eslint-config-react-app 无效 属性“覆盖”是错误的类型

[英]eslint-config-react-app is invalid Property “overrides” is the wrong type

I have a lot of ESLint warnings and I noticed my VSCode isn't showing me them in my code.我有很多 ESLint 警告,我注意到我的 VSCode 没有在我的代码中显示它们。 It's only visible in the console log for my react app.它仅在我的反应应用程序的控制台日志中可见。 I checked the output of ESLint in VSCode and it says:我在VSCode中检查了ESLint的output,它说:

[Info - 2:43:19 PM] ESLint configuration in package.json » eslint-config-react-app is invalid: - Property "overrides" is the wrong type (expected array but got {"files":["**/*.ts","**/*.tsx"],"parser":"@typescript-eslint/parser","parserOptions":{"ecmaVersion":2018,"sourceType":"module","ecmaFeatures":{"jsx":true},"warnOnUnsupportedTypeScriptVersion":true},"plugins":["@typescript-eslint"],"rules":{"default-case":"off","no-dupe-class-members":"off","@typescript-eslint/no-angle-bracket-type-assertion":"warn","no-array-constructor":"off","@typescript-eslint/no-array-constructor":"warn","@typescript-eslint/no-namespace":"error","no-unused-vars":"off","@typescript-eslint/no-unused-vars":["warn",{"args":"none","ignoreRestSiblings":true}],"no-useless-constructor":"off","@typescript-eslint/no-useless-constructor":"warn"}} ). [信息 - 下午 2:43:19] package.json » eslint-config-react-app 中的 ESLint 配置无效:- 属性“覆盖”是错误的类型(预期的数组,但得到了{"files":["**/*.ts","**/*.tsx"],"parser":"@typescript-eslint/parser","parserOptions":{"ecmaVersion":2018,"sourceType":"module","ecmaFeatures":{"jsx":true},"warnOnUnsupportedTypeScriptVersion":true},"plugins":["@typescript-eslint"],"rules":{"default-case":"off","no-dupe-class-members":"off","@typescript-eslint/no-angle-bracket-type-assertion":"warn","no-array-constructor":"off","@typescript-eslint/no-array-constructor":"warn","@typescript-eslint/no-namespace":"error","no-unused-vars":"off","@typescript-eslint/no-unused-vars":["warn",{"args":"none","ignoreRestSiblings":true}],"no-useless-constructor":"off","@typescript-eslint/no-useless-constructor":"warn"}} )。 Referenced from: C:\Users\(my-name)\(my-app)\package.json引用自:C:\Users\(my-name)\(my-app)\package.json

{
    "name": "(my-app-name)",
    "version": "0.1.0",
    "private": true,
    "dependencies": {
        "@azure/cognitiveservices-qnamaker": "^3.1.0",
        "@azure/ms-rest-azure-js": "^2.0.1",
        "@microsoft/microsoft-graph-client": "^2.0.0",
        "@types/jest": "^25.2.1",
        "@types/node": "^13.13.4",
        "@types/react": "^16.9.34",
        "@types/react-bootstrap-typeahead": "^3.4.5",
        "@types/react-dom": "^16.9.7",
        "@types/reactstrap": "^8.4.2",
        "adaptivecards": "^1.2.3",
        "axios": "^0.19.2",
        "bootstrap": "^4.1.3",
        "date-fns": "^2.12.0",
        "dotenv": "^8.2.0",
        "fusioncharts": "^3.15.1",
        "jquery": "^3.5.0",
        "luis-node-sdk": "^1.0.0",
        "merge": "^1.2.1",
        "msal": "^1.3.0",
        "ncp": "^2.0.0",
        "oidc-client": "^1.10.1",
        "promise.allsettled": "^1.0.2",
        "react": "^16.13.1",
        "react-app-polyfill": "^1.0.6",
        "react-bootstrap": "^1.0.1",
        "react-bootstrap-table": "^4.3.1",
        "react-bootstrap-typeahead": "^3.4.7",
        "react-datepicker": "^2.14.1",
        "react-dom": "^16.13.1",
        "react-fusioncharts": "^3.1.2",
        "react-router-bootstrap": "^0.24.4",
        "react-router-dom": "^5.1.2",
        "react-scripts": "^3.4.1",
        "reactstrap": "^8.4.1",
        "rimraf": "^2.6.2"
    },
    "devDependencies": {
        "@microsoft/microsoft-graph-types": "^1.12.0",
        "@types/promise.allsettled": "^1.0.3",
        "ajv": "^6.12.2",
        "cross-env": "^5.2.0",
        "eslint-config-react-app": "^4.0.1",
        "eslint-plugin-flowtype": "^2.0.0",
        "eslint-plugin-import": "^2.20.2",
        "eslint-plugin-jsx-a11y": "^6.2.1",
        "eslint-plugin-react": "^7.19.0",
        "typescript": "^3.8.3"
    },
    "eslintConfig": {
        "extends": "react-app"
    },
    "scripts": {
        "start": "rimraf ./build && react-scripts start",
        "test": "cross-env CI=true react-scripts test --env=jsdom",
        "eject": "react-scripts eject",
        "lint": "eslint ./src/",
        "build": "react-scripts build",
        "publish-qa": "node tasks/publish-qa.js",
        "publish-production": "node tasks/publish-prod.js"
    },
    "browserslist": {
        "production": [
            ">0.2%",
            "not dead",
            "not op_mini all"
        ],
        "development": [
            ">0.2%",
            "not dead",
            "not op_mini all"
        ]
    },
    "homepage": "."
}

I solved this by upgrading from eslint 6.7.2 to 6.8.0我通过从 eslint 6.7.2 升级到 6.8.0 解决了这个问题

So, essentially npm install eslint --save所以,基本上npm install eslint --save

Run this from the directory which holds your package.json file and see how it goes.从包含 package.json 文件的目录中运行它,看看它是如何运行的。

暂无
暂无

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

相关问题 Atom &amp; eslint:找不到模块 'eslint-config-react-app' - Atom & eslint: Cannot find module 'eslint-config-react-app' 如何解决这个错误:package.json » eslint-config-react-app/jest#overrides[0]: Environment key "jest/globals" is unknown - How to solve this error: package.json » eslint-config-react-app/jest#overrides[0]: Environment key "jest/globals" is unknown (ESLint)在VS 2017 react项目中找不到模块&#39;eslint-config-react-app&#39; - (ESLint) Cannot find module 'eslint-config-react-app' in VS 2017 react project create-react-app 版本 5 的“eslint-config-react-app”问题 - "eslint-config-react-app" issue with create-react-app version 5 插件“react”在“package.json » eslint-config-react-app 之间发生冲突 - Plugin "react" was conflicted between "package.json » eslint-config-react-app eslint-config-react-app throws找不到规则“ getter-return”的定义 - eslint-config-react-app throws Definition for rule 'getter-return' was not found 部署 React 应用程序时出错,它一直在说 &lt;&lt; Plugin "react" was conflicted between "package.json » eslint-config-react-app » &gt;&gt; - Error when deploying react app and it keeps sayings << Plugin "react" was conflicted between "package.json » eslint-config-react-app » >> 无法加载在“package.json » eslint-config-react-app”中声明的插件“jsx-a11y”:意外的令牌 = - Failed to load plugin 'jsx-a11y' declared in 'package.json » eslint-config-react-app': Unexpected token = 无法加载在“package.json » eslint-config-react-app”中声明的插件“flowtype”:找不到模块“eslint/use-at-your-own-risk” - Failed to load plugin 'flowtype' declared in 'package.json » eslint-config-react-app': Cannot find module 'eslint/use-at-your-own-risk' 无法加载在 'package.json » eslint-config-react-app#overrides[0]' 中声明的解析器 '@typescript-eslint/parser':找不到模块 'typescript' - Failed to load parser '@typescript-eslint/parser' declared in 'package.json » eslint-config-react-app#overrides[0]': Cannot find module 'typescript'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM