简体   繁体   中英

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. It's only visible in the console log for my react app. I checked the output of ESLint in VSCode and it says:

[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"}} ). Referenced from: 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

So, essentially npm install eslint --save

Run this from the directory which holds your package.json file and see how it goes.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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