ESLint:创建下一个应用程序时选项无效 [英] ESLint: Invalid Options when create-next-app

查看:40
本文介绍了ESLint:创建下一个应用程序时选项无效的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建一个新的Next.js应用程序。 当我运行yarn create-next-app并开始在Visual Studio代码中编写Java代码时,ESlint扩展每次输入数字时都会抛出一个错误。 而且,很自然地,eslint不起作用。

错误为:

ESLint: Invalid Options: - Unknown options: env, parserOptions, rules - 'parserOptions' has been removed. Please use the 'overrideConfig.parserOptions' option instead. - 'rules' has been removed. Please use the 'overrideConfig.rules' option instead.. Please see the 'ESLint' output channel for details.

这是用于即时视觉识别的图像:

Eslint extension error on Visual Studio Code

这是我的package.json文件(Next.js提供的默认Package.json):

{
  "name": "myApp",
  "private": true,
  "scripts": {
    "dev": "next dev",
    "build": "next build",
    "start": "next start",
    "lint": "next lint"
  },
  "dependencies": {
    "next": "12.0.7",
    "react": "17.0.2",
    "react-dom": "17.0.2"
  },
  "devDependencies": {
    "eslint": "8.4.1",
    "eslint-config-next": "12.0.7"
  }
}

感谢您的帮助。

推荐答案

在我的vscode文件中,将esling.options的内容包装成overrideConfig自己解决,如下所示:

"eslint.options": {
    "overrideConfig": {
      "env": {
        "browser": true,
        "es6": true
      },
      "parserOptions": {
        "ecmaVersion": 2019,
        "sourceType": "module",
        "ecmaFeatures": {
          "jsx": true
        }
      },
      "rules": {
        "no-debugger": "off"
      }
    }
  },

这篇关于ESLint:创建下一个应用程序时选项无效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆