My issue is that I cannot display typescript errors in editor using eslint and @typescript-eslint (on VSCode for MacOs).
Eslint errors are showing but not type errors as shown on this screenshot (tsx file)
Here the issue about unused variable is displayed but the type error when calling typedFunction
is not. If I run tsc
in my terminal the error will raise.
Eslint extension is installed my VSCode editor. Here is my .eslintrc :
{
"parser": "@typescript-eslint/parser",
"extends": [
"plugin:@typescript-eslint/recommended",
"react-app",
"prettier",
"prettier/@typescript-eslint",
"prettier/react"
],
"plugins": [
"import",
"prefer-object-spread",
"prettier",
"react",
"@typescript-eslint"
],
"env": {
"browser": true,
"es6": true,
"node": true
},
"globals": {
"alert": true,
"document": true,
"localStorage": true,
"navigator": true,
"window": true,
"HTMLElement": true
},
"rules": {
"prettier/prettier": "error",
"import/extensions": 0,
"import/no-extraneous-dependencies": [
"error",
{
"devDependencies": true,
"optionalDependencies": false,
"peerDependencies": false
}
],
"import/no-unresolved": 0,
"import/prefer-default-export": 0,
"prefer-object-spread/prefer-object-spread": 2,
"react/destructuring-assignment": 0,
"react/jsx-filename-extension": [1, { "extensions": [".ts", ".tsx"] }],
"react/no-array-index-key": 2,
"react/prefer-stateless-function": 0,
"react/prop-types": 0,
"react/require-default-props": 0,
"@typescript-eslint/explicit-function-return-type": 0,
"@typescript-eslint/explicit-member-accessibility": 0,
"@typescript-eslint/camelcase": 0,
"@typescript-eslint/interface-name-prefix": 0,
"complexity": ["error", 8],
"max-lines": ["error", 200],
"max-depth": ["error", 3],
"max-params": ["error", 4]
}
}
I tried removing all VSCode extensions, uninstalling VSCode, reboot my computer but nothing worked. My VSCode version is 1.46.0
If ESLint is running in the terminal but not inside VSCode, it is probably because the extension is unable to detect both the local and the global node_modules folders. To verify, press Ctrl+Shift+U in VSCode to open the Output panel after opening a JavaScript file with a known eslint issue.
In your VSC's Extensions panel, type "@builtin" and look for "TypeScript and JavaScript Language Features" in the "Features" section. It is most probably disabled. Enable it and restart your VSC. As suggested by Matt Bierner from here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With