簡體   English   中英

ng lint 命令成功,但 VS 代碼顯示錯誤

[英]ng lint command is suceeds but VS code shows error

我正在使用 tslint 工具我的 angular 項目。

我的 tsconfig.json 文件

{
    "compileOnSave": false,
    "compilerOptions": {
        "downlevelIteration": true,
        "importHelpers": true,
        "module": "esnext",
        "outDir": "./dist/out-tsc",
        "baseUrl": "src",
        "sourceMap": true,
        "declaration": false,
        "moduleResolution": "node",

        "emitDecoratorMetadata": true,
        "experimentalDecorators": true,
        "target": "es5",
        "typeRoots": [
            "node_modules/@types"
        ],
        "lib": [
            "es2016",
            "dom"
        ]
    },
    "include": [ "src/main.ts" ]
}

ng lint命令沒有顯示錯誤,但是 VS 代碼顯示紅色錯誤標記說明

對裝飾器的實驗性支持是一項可能在未來版本中更改的功能。 在“tsconfig”或“jsconfig”中設置“experimentalDecorators”選項以刪除此警告。ts(1219)

(我正在為 mac-os 使用 vs 代碼)

在此處輸入圖像描述

注意:我曾嘗試使用experimentalDecorators:false,但問題仍然存在,我從git 下載的項目之一具有完全相同的tsconfig.json 並且它在相同的vscode 中工作。

誰能指出為什么 vscode 顯示錯誤。

我認為 package.json 中的 typescript 版本比 Visual Studio Code 使用的版本舊。 在 Visual Studio Code 的右下角,單擊 TypeScript 版本和 select 選擇工作區版本的選項。 那么棉絨問題應該 go 消失。

ng lint 在 Angular 14 中引發節點錯誤:UnhandledPromiseRejectionWarning:#<object><div id="text_translate"><p> 我將我的應用程序從 Angular 13 升級到 14,現在當我嘗試使用安裝了最新 eslint 的<strong>ng lint</strong>命令時,出現此錯誤:</p><pre> (node:15376) UnhandledPromiseRejectionWarning: #&lt;Object&gt; (Use `node --trace-warnings...` to show where the warning was created) (node:15376) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with.catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1) (node:15376) [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.</pre><p> 我不知道如何解決這個問題,而無需降級回 13。這是我的 devDependencies:</p><pre> "devDependencies": { "@angular-devkit/build-angular": "^14.2.1", "@angular-eslint/builder": "14.0.3", "@angular-eslint/eslint-plugin": "14.0.3", "@angular-eslint/eslint-plugin-template": "14.0.3", "@angular-eslint/schematics": "14.0.3", "@angular-eslint/template-parser": "14.0.3", "@angular/cli": "^14.2.1", "@angular/compiler-cli": "^14.2.0", "@angular/language-service": "^14.2.0", "@ngxs/devtools-plugin": "~3.7.1", "@progress/kendo-licensing": "~1.2.2", "@types/lodash": "~4.14.168", "@typescript-eslint/eslint-plugin": "5.29.0", "@typescript-eslint/parser": "5.29.0", "@webcomponents/custom-elements": "^1.4.3", "eslint": "^8.18.0", "eslint-plugin-deprecation": "^1.3.2", "typescript": "^4.6.4" }</pre></div></object>

[英]ng lint throws Node error in Angular 14: UnhandledPromiseRejectionWarning: #<Object>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

相關問題 使用 `ng lint` 命令打印 linted 文件的日志 ng 命令在 vs code PowerShell 中有效,在 vs code git bash 中無效 角度4,使皮棉錯誤致命 如何在 vs 代碼中啟用 HTML 上的 lint? 在Angular中用多個項目遷移TSLint到ESLint,ng lint命令掛起 VS Code 顯示 .toDate() 函數將 firebase 時間戳轉換為 Date 的錯誤 ng lint 在 Angular 14 中引發節點錯誤:UnhandledPromiseRejectionWarning:#<object><div id="text_translate"><p> 我將我的應用程序從 Angular 13 升級到 14,現在當我嘗試使用安裝了最新 eslint 的<strong>ng lint</strong>命令時,出現此錯誤:</p><pre> (node:15376) UnhandledPromiseRejectionWarning: #&lt;Object&gt; (Use `node --trace-warnings...` to show where the warning was created) (node:15376) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with.catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1) (node:15376) [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.</pre><p> 我不知道如何解決這個問題,而無需降級回 13。這是我的 devDependencies:</p><pre> "devDependencies": { "@angular-devkit/build-angular": "^14.2.1", "@angular-eslint/builder": "14.0.3", "@angular-eslint/eslint-plugin": "14.0.3", "@angular-eslint/eslint-plugin-template": "14.0.3", "@angular-eslint/schematics": "14.0.3", "@angular-eslint/template-parser": "14.0.3", "@angular/cli": "^14.2.1", "@angular/compiler-cli": "^14.2.0", "@angular/language-service": "^14.2.0", "@ngxs/devtools-plugin": "~3.7.1", "@progress/kendo-licensing": "~1.2.2", "@types/lodash": "~4.14.168", "@typescript-eslint/eslint-plugin": "5.29.0", "@typescript-eslint/parser": "5.29.0", "@webcomponents/custom-elements": "^1.4.3", "eslint": "^8.18.0", "eslint-plugin-deprecation": "^1.3.2", "typescript": "^4.6.4" }</pre></div></object> Angular 8 - ng lint:超出最大調用堆棧大小錯誤 ng服務時提供錯誤的可視代碼編輯器和命令提示符 tslint / codelyzer / ng lint 錯誤:“for (... in ...) 語句必須用 if 語句過濾”
 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM