0

我正在尝试使用 构建react.js项目npm run build,但出现以下错误,我尝试了很多解决方案,但没有什么对我有用。

**Failed to compile.**

Rules with suggestions must set the `meta.hasSuggestions` property to `true`. 
`meta.docs.suggestion` is ignored by ESLint.
 Occurred while linting 
 /Users/e0658897/Desktop//Electrical%20- 
%20Web%20Portal/src/reportWebVitals.ts:6
Rule: "@typescript-eslint/no-floating-promises"

这打破了linting.我尝试将以下内容添加到我的所有其他内容.eslintrc.js

meta: {
    hasSuggestions: true
},

这给了我以下错误:

UnhandledPromiseRejectionWarning: Error: ESLint configuration in .eslintrc.js is invalid:
    - Unexpected top-level property "meta".

包.json

{
"name": "proxusweb",
"version": "0.1.0",
"private": true,
"dependencies": {
    "@brightlayer-ui/icons-mui": "^2.8.1",
    "@brightlayer-ui/react-auth-workflow": "^2.4.0",
    "@brightlayer-ui/react-components": "^5.3.3",
    "@brightlayer-ui/react-themes": "^6.1.0",
    "@material-ui/core": "^4.11.4",
    "@material-ui/icons": "^4.11.2",
    "@material-ui/lab": "^4.0.0-alpha.60",
    "axios": "^0.26.0",
    "date-fns": "^2.28.0",
    "i18next": "^19.9.2",
    "jspdf": "^2.5.1",
    "jspdf-autotable": "^3.5.23",
    "react": "^17.0.2",
    "react-app-polyfill": "^3.0.0",
    "react-dom": "^17.0.2",
    "react-i18next": "^11.15.3",
    "react-router": "^5.2.1",
    "react-router-dom": "^5.3.0",
    "react-scripts": "5.0.0",
    "web-vitals": "^0.2.4"
},
"scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject",
    "lint": "eslint \"src/**/**.{ts,tsx}\"",
    "lint:fix": "eslint \"src/**/**.{ts,tsx}\" --fix",
    "prettier": "prettier \"src/**/**.{ts,tsx,js,jsx,json,css,scss,html}\" --write",
    "prettier:check": "prettier \"src/**/**.{ts,tsx,js,jsx,json,css,scss,html}\" --check"
},
"eslintConfig": {
    "extends": [
        "react-app",
        "react-app/jest"
    ]
},
"browserslist": {
    "production": [
        ">0.2%",
        "not dead",
        "not op_mini all"
    ],
    "development": [
        "last 1 chrome version",
        "last 1 firefox version",
        "last 1 safari version"
    ]
},
"devDependencies": {
    "@brightlayer-ui/eslint-config": "^2.0.5",
    "@brightlayer-ui/prettier-config": "^1.0.3",
    "@testing-library/jest-dom": "^5.16.1",
    "@testing-library/react": "^11.2.7",
    "@testing-library/user-event": "^13.5.0",
    "@types/enzyme-adapter-react-16": "^1.0.6",
    "@types/jest": "^26.0.24",
    "@types/node": "^12.20.42",
    "@types/react": "^17.0.38",
    "@types/react-dom": "^17.0.11",
    "@types/react-router-dom": "^5.3.3",
    "@typescript-eslint/eslint-plugin": "^4.33.0",
    "@typescript-eslint/parser": "^4.33.0",
    "@wojtekmaj/enzyme-adapter-react-17": "^0.6.6",
    "enzyme": "^3.11.0",
    "eslint": "^7.32.0",
    "eslint-config-prettier": "^6.15.0",
    "eslint-plugin-react": "^7.28.0",
    "eslint-plugin-react-hooks": "^4.2.1-rc.1-next-f0dd459e0-20220301",
    "prettier": "^2.5.1",
    "typescript": "^4.5.5"
},
"prettier": "@brightlayer-ui/prettier-config"
}

.eslinrc.js

module.exports = {
    root: true,
    parser: '@typescript-eslint/parser',
    extends: ['@brightlayer-ui/eslint-config/tsx'],
    // meta:{
    //     hasSuggestions: true
    // },
    parserOptions: {
       project: "./tsconfig.json",
       
    },
 
    env: {
        browser: true
    },
    rules: {
        // "@typescript-eslint/explicit-function-return-type": "off",
        "@typescript-eslint/explicit-function-return-type": [
            "error",
            {
                "allowExpressions": true
            }
        ],
        "no-unused-vars": "off",
        "no-undef": "off",
        "arrow-body-style": "off",
        "@typescript-eslint/no-unused-vars": "off",
        'no-console': 'off',
        "no-alert": "off",
         "react-hooks/exhaustive-deps": "off",
        "react-hooks/rule-of-hooks": "off",
    },
};
4

0 回答 0