Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Typescript errors not showing in VSCode editor using typescript-eslint

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) example of type error not showing

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

like image 598
Elie Dutheil Avatar asked Jun 12 '20 17:06

Elie Dutheil


People also ask

Why ESLint is not showing errors VSCode?

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.


1 Answers

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.

like image 165
alibaba Avatar answered Oct 07 '22 15:10

alibaba