Auto Imports in VSCode using React not working

4.5k Views Asked by At

I have an issue and don't know the reason or how to fix it. VS Code doesn't underline the incorrect path for imports in case if they are wrong. Also the auto import does not work. I tried to setup a jsconfig file to use the absolute paths, but without any result. I use this extension for auto import.

jsconfig.json

{
  "compilerOptions": {
    "baseUrl": "src"
  },
  "include": ["src"],
  "exclude": ["node_modules"]
}

eslintrc.json

{
  "env": {
    "node": true,
    "browser": true,
    "es2021": true
  },
  "extends": ["plugin:react/recommended", "prettier", "prettier/prettier", "plugin:prettier/recommended", "eslint:recommended"],
  "parserOptions": {
    "ecmaFeatures": {
      "jsx": true
    },
    "ecmaVersion": 12,
    "sourceType": "module"
  },
  "plugins": ["react", "react-hooks"],
  "rules": {
    "no-return-await": "warn",
    "camelcase": "error",
    "react/jsx-key": "off",
    "react/prop-types": "off",
    "prettier/prettier": ["off", { "singleQuote": true }],
    "react/jsx-filename-extension": [
      "warn",
      {
        "extensions": [".jsx"]
      }
    ],
    "max-len": [
      "warn",
      {
        "code": 140
      }
    ],
    "react-hooks/rules-of-hooks": "error",
    "react-hooks/exhaustive-deps": "off",
    "import/prefer-default-export": "off"
  },
  "settings": {
    "react": {
      "version": "detect"
    }
  }
}

Does anybody know what I should do to get the wrong imports highlighted and the auto import working? Thanks in advance!

0

There are 0 best solutions below