esint警告不再出现在create-rect应用程序终端中



我在create-rect应用程序中更新了react-scripts,并且当我运行npm start时,终端中显示的所有esint警告都消失了。我知道我有一些代码曾经发出警告,但现在我总是收到同样的消息:

Compiled successfully!
You can now view annotation in the browser.
Local:            http://localhost:3000
On Your Network:  http://10.0.0.110:3000
Note that the development build is not optimized.
To create a production build, use npm run build.

我没有任何自定义设置(据我所知(,所以我正在努力找出如何恢复警告。

如果您使用create-react-app,eslint的配置将在node_modules/elint-config-react-app/index.js中,所以请查看它的内部情况,通常它会覆盖您可能拥有的任何.eslitingnore或.eslint.jsc,所以请在那里设置您想要遵守的规则。

我的应用程序中没有自定义的eslint设置可以按照另一个答案中的建议进行更改或修复。我最终运行了create-react应用程序,并将代码从原始项目复制到新项目。这让我想起了我一直在寻找的警告。

也许您的package.json缺少eslintConfig:

"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
}

这就是我的遭遇。

您总是可以通过组合Ctrl+Alt+O来访问ESLint输出窗口。或者,只需单击vscode底部的任务栏,转到OUTPUT选项卡,然后从提供的下拉列表中选择ESLint。

最新更新