javascript - vscode 没有显示 linting 警告
问题描述
我制作了一个打字稿反应应用程序,我想使用我的 eslintrc 文件在 vs 代码中对我的文件进行 lint,但警告没有出现在 ide 中。
我的 eslintrc:
{
"extends": ["react-app"],
"rules": {
"space-infix-ops": ["warn", { "int32Hint": false }],
"semi": ["warn", "never"],
"quotes": ["warn", "single"],
"jsx-quotes": ["warn", "prefer-single"],
"no-trailing-spaces": ["warn"],
"comma-dangle": ["warn", "never"],
"space-before-function-paren": ["warn", "never"],
"space-before-blocks": "warn",
"keyword-spacing": ["warn", { "after": true, "before": true,
"overrides": {
"if": { "after": false },
"else": { "after": true },
"switch": { "after": false },
"case": {"after": true },
"for": { "after": false }
}
}
],
"key-spacing": [ "warn", { "afterColon": true }],
"no-multi-spaces": ["warn"],
"no-console": ["warn"]
}
}
我的settings.json:
{
"editor.fontSize": 15,
"eslint.enable": true,
"javascript.updateImportsOnFileMove.enabled": "always",
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},
"eslint.validate": [
"javascript",
"javascriptreact",
{ "language": "typescript", "autoFix": true },
{ "language": "typescriptreact", "autoFix": true }
],
}
输出选项卡:
[Info - 6:07:05 PM] ESLint server stopped.
[Info - 6:07:05 PM] ESLint server running in node v8.9.3
[Info - 6:07:05 PM] ESLint server is running.
(node:622) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): SyntaxError: Unexpected token {
(node:622) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
(node:622) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2): SyntaxError: Unexpected token {
(node:622) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 3): SyntaxError: Unexpected token {
(node:622) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 4): SyntaxError: Unexpected token {
(node:622) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 5): SyntaxError: Unexpected token {
(node:622) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 6): SyntaxError: Unexpected token {
(node:622) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 7): SyntaxError: Unexpected token {
(node:622) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 8): SyntaxError: Unexpected token {
(node:622) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 9): SyntaxError: Unexpected token {
(node:622) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 10): SyntaxError: Unexpected token {
(node:622) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 11): SyntaxError: Unexpected token {
(node:622) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 12): SyntaxError: Unexpected token {
(node:622) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 13): SyntaxError: Unexpected token {
(node:622) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 14): SyntaxError: Unexpected token {
我确实安装了 eslint 扩展。
我在本地为项目安装了 eslintnpm install eslint --save-dev
我已经用谷歌搜索并查看了其他人的问题,但似乎无法让它为我工作。任何正确方向的帮助将不胜感激。
谢谢
解决方案
检查Output
屏幕下半部分的选项卡。从下拉列表中选择 ESLint。或者在 Windows 上使用快捷方式:++ ctrl。所有 ESLint 服务器输出都被绘制在那里。shiftU
推荐阅读
- php - 如何检查 Phalcon id 是否有效以执行 fetchAllAssoc()?
- javascript - Javascript:推入一个空的 3d 数组
- sql - SQL:postgreSQL 中 json_pretty() 的等价物是什么
- javascript - AngularJS $http请求不适用于长时间请求
- javascript - 尝试通过 JS 向用户发送自定义输入的电子邮件
- typescript - 自动为字段或属性创建用户定义的类型保护?
- python - 如何使用通知上有按钮的python发送Windows 10通知
- c - 如何在系统范围内安装 ac 包并将 CMake 转换为 makefile
- java - 我的线性布局只闪烁背景颜色,而不是在 Android 中持续存在
- html - 容器中具有不同背景的两列