{"id":671,"hash":"06a214ee3185886e78e5b2e34e7b2c2b490699b2fbd5362966b36e17a5743700","pattern":"VS Code showing eslint error but vitest is working. &#39;vi&#39; is not defined","full_message":"I have the following tsconfig configuration:\n\n{\n  \"include\": [\"tests/**/*.ts\"],\n  \"exclude\": [],\n  \"compilerOptions\": {\n    \"composite\": true,\n    \"lib\": [],\n    \"skipLibCheck\": true,\n    \"outDir\": \"lib\",\n    \"types\": [\"vitest/globals\"]\n  }\n}\n\nAs I have defined types for vitest/globals so yarn vitest cmd is working fine and executing the tests cases as well.\n\nBut in VS Code its showing me the following error:\n\nHow I can fix or silence this issue in vs-code?","ecosystem":"npm","package_name":"visual-studio-code","package_version":null,"solution":"I had to add the following to my .eslintrc.json file to fix this issue in  a test setup module:\n\n\"globals\": {\n  \"vi\": true\n},\n\nIf you're using TypeScript, you should also add the following to your compilerOptions in your tsconfig.json. (You already had this, but I'm mentioning it anyway in case it helps someone else):\n\n\"types\": [\"vitest/globals\"]","confidence":0.95,"source":"stackoverflow","source_url":"https://stackoverflow.com/questions/73392328/vs-code-showing-eslint-error-but-vitest-is-working-vi-is-not-defined","votes":16,"created_at":"2026-04-19T04:51:28.851677+00:00","updated_at":"2026-04-19T04:51:28.851677+00:00"}