create-react-app When npm start, show "Plugin "react" was conflicted between "package.json » eslint-config-react-app..."bug

vhipe2zx  于 2个月前  发布在  React
关注(0)|答案(6)|浏览(63)
Plugin "react" was conflicted between "package.json » eslint-config-react-app » D:\d\react\test_react\node_modules\eslint-config-react-app\base.js" and "BaseConfig » D:\d\react\test_react\node_modules\eslint-config-react-app\base.js".
hgqdbh6s

hgqdbh6s1#

请尝试使用以下导入语句更新 setupTests.ts:

import `import @types/jest` as `setupTests.ts`
hxzsmxv2

hxzsmxv22#

谢谢,但我不确定。在setupTest.ts中到底做了什么?只是导入了@types/jest吗?

ttisahbt

ttisahbt3#

谢谢,但我不确定。在setupTest.ts中到底做了什么?只是导入了@types/jest吗?

你是对的,我正在使用lerna设置monorepo,事情进展得并不顺利。所以我在尝试弄清楚。实际上,你不需要那个导入,但是你需要在启动脚本中设置跳过eslint标志:DISABLE_ESLINT_PLUGIN=true。这样做是为了防止你有自定义的.eslintrc文件。此外,我还从package.json中移除了CRA eslint配置。

m4pnthwp

m4pnthwp4#

哦,是的,谢谢。

fcg9iug3

fcg9iug35#

请在项目中删除名为.eslintrc.{js,yml,json}的eslint配置文件,因为CRA提供了eslint配置,而您的自定义配置与基本配置冲突。如果您想覆盖基本的CRA esling配置,请参考此部分文档:https://create-react-app.dev/docs/setting-up-your-editor/#extending-or-replacing-the-default-eslint-config

8e2ybdfx

8e2ybdfx6#

data not shown in list

相关问题