VS Code showing eslint error but vitest is working. 'vi' is not defined
Full error message
I have the following tsconfig configuration:
{
"include": ["tests/**/*.ts"],
"exclude": [],
"compilerOptions": {
"composite": true,
"lib": [],
"skipLibCheck": true,
"outDir": "lib",
"types": ["vitest/globals"]
}
}
As I have defined types for vitest/globals so yarn vitest cmd is working fine and executing the tests cases as well.
But in VS Code its showing me the following error:
How I can fix or silence this issue in vs-code?Solutionsource: stackoverflow \u2197
I had to add the following to my .eslintrc.json file to fix this issue in a test setup module: "globals": { "vi": true }, If 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): "types": ["vitest/globals"]
API access
Get this solution programmatically \u2014 free, no authentication.
curl https://depscope.dev/api/error/06a214ee3185886e78e5b2e34e7b2c2b490699b2fbd5362966b36e17a5743700hash \u00b7 06a214ee3185886e78e5b2e34e7b2c2b490699b2fbd5362966b36e17a5743700