[英]How do you resolve conflicting linting rules in VSCode between eslint and typescript-eslint
[英]How to fix Typescript linting not working in VSCode?
在我的 settings.json 中,我有:
"eslint.validate": [
"javascript",
"javascriptreact",
"typescript",
"typescriptreact"
]
但是我的打字稿支持不起作用。 它在運行時捕獲錯誤,但不顯示紅色波浪線(下面的示例)。
啟用 ESLint 時我也收到錯誤,啟用 ESLint 時 Prettier 不起作用:
ESLint: Failed to load parser '@typescript-eslint/parser' declared in 'template/.eslintrc.js': Cannot find module 'typescript' Require stack: - /Users/henryboisdequin/Desktop/MyAwesomeProject/node_modules/@typescript-eslint/typescript-estree/dist/parser.js - /Users/henryboisdequin/Desktop/MyAwesomeProject/node_modules/@typescript-eslint/typescript-estree/dist/index.js - /Users/henryboisdequin/Desktop/MyAwesomeProject/node_modules/@typescript-eslint/parser/dist/parser.js - /Users/henryboisdequin/Desktop/MyAwesomeProject/node_modules/@typescript-eslint/parser/dist/index.js - /Users/henryboisdequin/Desktop/MyAwesomeProject/node_modules/eslint/lib/cli-engine/config-array-factory.js - /Users/henryboisdequin/Desktop/MyAwesomeProject/node_modules/eslint/lib/cli-engine/cascading-config-array-factory.js - /Users/henryboisdequin/Desktop/MyAwesomeProject/node_modules/eslint/lib/cli-engine/cli-engine.js - /Users/henryboisdequin/Desktop/MyAwesomeProject/node_modules/eslint/lib/cli-engine/index.j
我該如何解決這個問題?
解決此問題的方法是按照以下步驟操作:
關閉 VSCode
光盤進入應用程序
/Users/<user>/Library/Application\ Support
ls
rm -rf code/ or .vscode/
打開 VSCode - 那里應該有你所有的擴展,但是像你的主題這樣的東西,擴展設置不會被配置 -
現在一切(擴展設置、主題等)都將被重置
您可以按照以下步驟修復打字稿
您還可以嘗試檢查 TypeScript 服務器日志以了解 TSLint 不工作的原因:
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.