In my settings.json, I have:
"eslint.validate": [
"javascript",
"javascriptreact",
"typescript",
"typescriptreact"
]
Yet my typescript support isn't working. It catches the errors during runtime but doesn't show a red squiggly line (example below).
I also get an error when enabling ESLint and Prettier doesn't work when I enable ESLint:
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
How do I fix this problem?
The way to fix this problem is to follow these steps:
Close VSCode
CD into applications
/Users/<user>/Library/Application\ Support
ls
rm -rf code/ or .vscode/
Open up VSCode - there should be all your extensions there but stuff like your theme, extension settings will not be configured -
Now everything (extension settings, theme, etc) will be reset
You can follow the steps to fix typescript
You can also try checking the TypeScript server logs to see why TSLint is not working:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.