{"id":19614,"library":"eslint-config-vitest-globals","title":"eslint-config-vitest-globals","description":"ESLint configuration package that defines globals for Vitest test files, eliminating false no-undef errors for Vitest globals like vi, describe, it, expect, beforeEach, etc. Version 2.0.2 is current, with support for both ESLint v9 flat config and ESLint v8 traditional config. Ships TypeScript types. Differentiators: tiny focused package, no extra rules, just globals; explicit flat config path import for ESLint v9; actively maintained with recent updates.","status":"active","version":"2.0.2","language":"javascript","source_language":"en","source_url":"https://github.com/TadejPolajnar/eslint-config-vitest-globals","tags":["javascript","eslint","vitest","eslint-config","eslint-flat-config","typescript"],"install":[{"cmd":"npm install eslint-config-vitest-globals","lang":"bash","label":"npm"},{"cmd":"yarn add eslint-config-vitest-globals","lang":"bash","label":"yarn"},{"cmd":"pnpm add eslint-config-vitest-globals","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency for ESLint configuration","package":"eslint","optional":false}],"imports":[{"note":"For eslint flat config (v9+), you must import from the 'flat' subpath. The default export is the traditional legacy config.","wrong":"import vitestGlobals from 'eslint-config-vitest-globals'","symbol":"vitestGlobals","correct":"import vitestGlobals from 'eslint-config-vitest-globals/flat'"},{"note":"For ESLint v8 legacy config, extend the package by its full name or use 'eslint-config-vitest-globals'. Shorthand names may not resolve.","wrong":"\"extends\": [\"vitest-globals\"]","symbol":"default import (traditional)","correct":"\"extends\": [\"eslint-config-vitest-globals\"]"},{"note":"TypeScript types are provided; you can import the type if needed.","wrong":"","symbol":"type import (flat config)","correct":"import type VitestGlobals from 'eslint-config-vitest-globals/flat'"},{"note":"The flat config export is a function that must be called; it returns the config object.","wrong":"vitestGlobals","symbol":"flat config with function call","correct":"vitestGlobals()"}],"quickstart":{"code":"// Install: npm install --dev eslint eslint-config-vitest-globals\n\n// eslint.config.js (ESLint v9+)\nimport vitestGlobals from 'eslint-config-vitest-globals/flat';\n\nexport default [\n  vitestGlobals(),\n  {\n    files: ['**/*.test.js', '**/*.spec.js'],\n    rules: {\n      // your custom rules for test files\n    }\n  },\n  // other configs\n];","lang":"javascript","description":"Shows how to set up eslint-config-vitest-globals with ESLint v9 flat config, calling vitestGlobals() to register Vitest globals."},"warnings":[{"fix":"Update import path from 'eslint-config-vitest-globals' to 'eslint-config-vitest-globals/flat' for flat config usage.","message":"v2.0.0 changed export structure: flat config must be imported from subpath 'eslint-config-vitest-globals/flat' instead of default import.","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Use vitestGlobals() instead of vitestGlobals.","message":"Flat config export is a function, not a plain object; must be invoked as vitestGlobals().","severity":"gotcha","affected_versions":">=2.0.0"},{"fix":"Migrate to ESLint v9 flat config using 'eslint-config-vitest-globals/flat'.","message":"ESLint v8 traditional config (.eslintrc) is deprecated; future updates may only support flat config.","severity":"deprecated","affected_versions":">=2.0.0"},{"fix":"Ensure 'no-undef' is enabled in your ESLint config. The globals set by this package will be recognized.","message":"Package only provides globals, not rules. You still need to configure 'no-undef' rule correctly; globals will suppress false positives.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Update package to v2.0.0+ and ensure import path is 'eslint-config-vitest-globals/flat'.","cause":"Using flat config import but package version is <2.0.0 (old version) or import path is wrong.","error":"Error [ERR_MODULE_NOT_FOUND]: Cannot find module 'eslint-config-vitest-globals/flat'"},{"fix":"Use vitestGlobals() in your config array.","cause":"Importing default from 'eslint-config-vitest-globals/flat' but not calling it (using as object instead of function).","error":"ESLint: TypeError: vitestGlobals is not a function"},{"fix":"Change file extension to .mjs or set \"type\": \"module\" in package.json, or use require() if available.","cause":"Using 'import' in a CommonJS file without ESM support.","error":"Parsing error: The keyword 'import' is reserved"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}