使用时npx create-react-app appname
,react-scripts
安装的包包含一个 eslint 依赖项,其中包含“发现常见错误的最小规则集”。我想使用 prettier 和 eslint,但我找不到关于哪些 eslint 插件也作为 CRA 的一部分安装的信息(如果有的话),或者找不到基本 ESLint 配置的位置以查看包含的内容。如果需要,我将扩展基本 ESLint 配置,但 CRA 文档说它是实验性的,所以我想尽可能避免它。
编辑:更详细的信息
如果不手动安装 ESLint 作为依赖项,我会得到missing peer dependency
所有插件和配置依赖项的(有点预期)错误。
将 ESLint 作为依赖项安装后,我收到 CRA 错误:
> react-scripts start
There might be a problem with the project dependency tree.
It is likely not a bug in Create React App, but something you need to fix locally.
The react-scripts package provided by Create React App requires a dependency:
"eslint": "^6.6.0"
Don't try to install it manually: your package manager does it automatically.
However, a different version of eslint was detected higher up in the tree:
~\client\node_modules\eslint (version: 7.2.0)
Manually installing incompatible versions is known to cause hard-to-debug issues.