陆大大
新手
新手
  • 最后登录2021-05-17
  • 发帖数1
阅读:3404回复:1

react创建后运行,无法编译的问题

楼主#
更多 发布于:2021-04-19 10:45
用vscode创建react项目之后,直接运行项目,项目主页一闪而过,然后报错(无法编译)

描述:报错内容

图片:1.png

报错内容

找了好久,找到了一个解决办法,在项目的根目录下创建一个.eslintrc的文件,粘贴如下代码即可正常运行了
{
    "extends": "eslint:recommended",
    "env": {
        "browser": true,
        "commonjs": true,
        "node": true,
        "es6": true
    },
    "parser": "babel-eslint",
    "parserOptions": {
        "ecmaVersion": 2018,
        "ecmaFeatures": {
            "jsx": true
        },
        "sourceType": "module"
    },
    "settings": {
        "react": {
            "pragma": "React",
            "version": "16.9"
        }
    },
    "rules": {
        "quotes": [
            "error",
            "single",
            {
                "allowTemplateLiterals": true
            }
        ],
        "semi": 0,
        "default-case": [
            "error",
            {
                "commentPattern": "^no default$"
            }
        ],
        "react/jsx-uses-vars": 0,
        "react/react-in-jsx-scope": 0,
        "no-new-wrappers": 0,
        "no-mixed-operators": 0,
        "require-atomic-updates": "off",
        "comma-dangle": "off",
        "no-unused-vars": "off",
        "no-useless-constructor": 0,
        "react/no-unescaped-entities": 0,
        "react/display-name": 0,
        "jsx-a11y/href-no-hash": "off",
        "jsx-a11y/anchor-is-valid": "off",
        "no-useless-escape": 0,
        "no-console": 0,
        "no-debugger": 0,
        "no-empty": 0,
        "linebreak-style": 0,
        "import/first": 0,
        "import/imports-first": 0,
        "no-shadow": 0,
        "disable-next-line": 0,
        "no-case-declarations": 0
    }
}

最新喜欢:

doubleyongdouble...
doubleyong
管理员
管理员
  • 最后登录2024-04-18
  • 发帖数1167
  • 最爱沙发
  • 喜欢达人
  • 原创写手
  • 社区居民
  • 忠实会员
沙发#
发布于:2021-04-19 22:25
666
知识需要管理,知识需要分享
游客


返回顶部

公众号

公众号